How to use a netstim to deliver several events

The basics of how to develop, test, and use models.
Post Reply
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

How to use a netstim to deliver several events

Post by mattions »

Hi all,

I would like to use a netstim object to deliver two (or more) train of inputs.

For example I would like to deliver a tstim at t=1 and t=5

Code: Select all

        
        netStim = h.NetStim()
        netStim.number = 10
        netStim.start = 1
        netStim.interval = 0.1
        netStim.noise = 0

        
        # NetCon obj
        netCon = h.NetCon(netStim, alphaSyn)
        netCon.weight[0] = 1


this will solve and be ok for the first
how can I give the second input?

I need to create another NetStim? I can't reuse that one?

Note that I'm interested to track the weight on the NetCon so I would like to use the same one and to not create another of them.

Any hint?
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: How to use a netstim to deliver several events

Post by ted »

The easiest way to generate repetitive bursts of events is by taking advantage of this feature of the NetStim class:
. . . NetStim can also be be triggered by an input event. i.e serve as the target of a NetCon. If the stimulator is in the on=0 state and receives a positive weight event, then the stimulator changes to the on=1 state and goes through its burst sequence before changing to the on=0 state. . . . A change to the on state immediately causes the first spike.
(see the Programmer's Reference entry on the NetStim class).

So just make this toy network:

Code: Select all

ns1     ns2
 o-----< o------>
ns1 projects a NetCon to ns2 with delay 0 and weight > 0 (1 is nice)
ns2 projects as many NetCons to whatever targets you like, with whatever weights and delays you like

ns1.number specifies the number of bursts
ns1.start specifies the time at which the first burst starts
ns1.interval specifies the interval between burst onsets

ns2.number specifies the number of events per burst
ns2.interval specifies the interval between events in a burst
ns2.start = 1e9 so that ns2 remains silent until ns1 tells it to start a burst

With a little cleverness, you could get very fancy with this . . .
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: How to use a netstim to deliver several events

Post by ted »

Oops, a mistake. This
ns2.start = 1e9 so that ns2 remains silent until ns1 tells it to start a burst
is not correct. ns2start should be the same as the start time of ns1. My apologies for this mistake, which was discovered by an astute reader.

Looking back, I see that I answered this back in May 2008, at which time I got it right:
viewtopic.php?f=12&t=1235
Post Reply