Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Time-dependent background stimulation

15 views
Skip to first unread message

Jake Miller

unread,
Aug 26, 2024, 2:35:59 PM8/26/24
to NetPyNE Q&A forum
Hi all, 

I'm fairly new to NetPyne, and I'm attempting to stimulate a group of cells with a time dependent current. 

Specifically, I'm trying to stimulate with a sin wave: (A*np.sin(2*np.pi*hz*t))

netParams.stimSourceParams['bkgIClamp1'] = {
'type': 'IClamp',
'del': 0,
'dur': time,
'amp': (A*np.sin(2*np.pi*hz))
}

netParams.stimTargetParams['bkg->mn'] = {
'source': 'bkgIClamp1',
'sec': 'soma',
'loc': 0.5,
'conds': {'x': [0, 5e3],'y': [0, 1.5e3],'z': [0, 12e3]}, # This stimulates the dorsal motor and ass.
'weight': 1,
'delay': 0.5,
'synMech': 'ACh'
}

 Where the sin wave amplitude and frequency can be modulated when running the script - in this example A is set to 1, and hz is set to 8. For reference it is running for 100 ms (time = 100). 

Its a bit unclear to me how to pass this in so that it is time-dependent, currently, my code is just calculating the numerical value of this function and injecting a constant current. 

Thank you in advance!

Valery Bragin

unread,
Sep 9, 2024, 12:42:26 PM9/9/24
to NetPyNE Q&A forum
Hi Jake,

You can provide only constant values for 'amp' of IClamp in NetPyNE. In order to create alternating current you have to slightly modify the mod file in order to support sinusoid. I have an example that should work exactly in your case (attached). If you look inside it, in the line 43, `i` is calculated based on sinusoid with certain amplitude, frequency and phase. So, your `stimSourceParams` should look as folows:

netParams.stimSourceParams['bkgIClamp1'] = {
'type': 'SinClamp',
'del': 0,
'dur': time,
'pkamp': A,
'freq': hz,
}

Don't forget to compile sinclamp.mod with `nrnivmodl`.

Best,
Valery
sinclamp.mod
Reply all
Reply to author
Forward
0 new messages