Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stimuli are now a mechanism to be inserted #153

Merged
merged 3 commits into from
Nov 3, 2023
Merged

Conversation

michaeldeistler
Copy link
Contributor

@michaeldeistler michaeldeistler commented Nov 3, 2023

Update API to insert stimuli. The new way is closer to how NEURON does it and it allows removing some boilerplate code.

Old API

stims = [nx.Stimulus(cell_ind, 0, 0.0, nx.step_current(i_delay, i_dur, i_amp, time_vec)) for cell_ind in range(num_cells)]
s = nx.integrate(network, stimuli=stims,  delta_t=dt)

New API

current = nx.step_current(i_delay, i_dur, i_amp, time_vec))
for cell_ind in range(num_cells):
    network.cell(cell_ind).branch(0).comp(0.0).stimulate(current) for cell_ind in range(num_cells)

s = nx.integrate(network, delta_t=dt)

Aside: How to deal with datasets

Previously, datasets were handled by the Stimuli class. Now, it works as follows:

for cell_ind in range(num_cells):
    network.cell(cell_ind).branch(0).comp(0.0).stimulate(nx.step_current(i_delay, i_dur, i_amp, time_vec)) for cell_ind in range(num_cells))

s = nx.integrate(network, currents=new_current_values, delta_t=dt)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant