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

Refractory tests and corrected hh_cond_exp_traub (fixes #473) #590

Merged
merged 14 commits into from
Jan 11, 2017
Merged
13 changes: 7 additions & 6 deletions pynest/nest/tests/test_refractory.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@


# --------------------------------------------------------------------------- #
# Simulation and refractory time
# Simulation and refractory time limits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Silmathoron, Sorry, I meant to change this to "Simulation time and refractory time limits"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easy ;)

# -------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could change this to "refractory time limits" to avoid confusion as this are only the lower and upper bounds right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (and additional comments added)

#

simtime = 100
resolution = 0.1
min_steps = 1
max_steps = 200
min_steps = 1 # minimal number of refractory steps (t_ref = resolution in ms)
max_steps = 200 # maximal number of steps (t_ref = 200 * resolution in ms)


# --------------------------------------------------------------------------- #
Expand Down Expand Up @@ -201,12 +201,13 @@ def compute_reftime(self, model, sd, vm, neuron):
else:
Vr = nest.GetStatus(neuron, "V_reset")[0]
times = nest.GetStatus(vm, "events")[0]["times"]
idx_max = (np.argwhere(np.isclose(times, spike_times[1]))[0][0]
if len(spike_times) > 1 else -1)
# index of the 2nd spike
idx_max = np.argwhere(times == spike_times[1])[0][0]
name_Vm = "V_m.s" if model == "iaf_cond_alpha_mc" else "V_m"
Vs = nest.GetStatus(vm, "events")[0][name_Vm]
# get the index at which the spike occured
idx_spike = np.argwhere(times == spike_times[0])[0][0]
# find end of refractory period between 1st and 2nd spike
idx_end = np.where(
np.isclose(Vs[idx_spike:idx_max], Vr, 1e-6))[0][-1]
t_ref_sim = idx_end * resolution
Expand All @@ -226,7 +227,7 @@ def test_refractory_time(self, model):
vm_params = {"interval": resolution, "record_from": [name_Vm]}
vm = nest.Create("voltmeter", params=vm_params)
sd = nest.Create("spike_detector", params={'precise_times': True})
cg = nest.Create("dc_generator", params={"amplitude": 600.})
cg = nest.Create("dc_generator", params={"amplitude": 900.})
# for models that do not clamp V_m, use very large current to trigger
# almost immediate spiking => t_ref almost equals interspike
if model in neurons_interspike_ps:
Expand Down