Skip to content

Commit

Permalink
fix t_starts bug in is_recruited and axon_AP_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
louisreg committed Sep 17, 2024
1 parent 41c1282 commit 8e0767a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion nrv/nmod/results/_axons_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ def is_recruited(self, vm_key: str = "V_mem", t_start: float = None) -> bool:
self["recruited"] = n_aps
else:
_,t_starts = self.get_start_APs(vm_key= vm_key)
self["recruited"] = len(t_starts>=t_start) > 0
#print(t_start)
#print(t_starts)
#print(t_starts[t_starts>=t_start])
#print(len(t_starts[t_starts>=t_start])>0)
self["recruited"] = len(t_starts[t_starts>=t_start])>0
else:
self["recruited"] = n_aps
return self["recruited"]
Expand Down
8 changes: 4 additions & 4 deletions nrv/ui/_axon_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def axon_AP_threshold(axon: axon, amp_max: float, update_func: Callable,
current_amp = amp_max
Niter = 1
keep_going = 1
t_start = perf_counter()
t_start_cnt = perf_counter()

while keep_going:
if verbose and Niter == 1:
Expand Down Expand Up @@ -223,7 +223,7 @@ def axon_AP_threshold(axon: axon, amp_max: float, update_func: Callable,
if verbose:
clear_prompt_line(1)
pass_info(f"Activation threshold is {np.round(current_amp,2)}µA ({np.round(current_tol,2)}%),"
+ f" found in {Niter-1} iterations ({np.round(t_stop-t_start,2)}s).")
+ f" found in {Niter-1} iterations ({np.round(t_stop-t_start_cnt,2)}s).")
return current_amp

def axon_block_threshold(axon: axon, amp_max: float, update_func: Callable, AP_start: float,
Expand Down Expand Up @@ -285,7 +285,7 @@ def axon_block_threshold(axon: axon, amp_max: float, update_func: Callable, AP_s
current_amp = amp_max
Niter = 1
keep_going = 1
t_start = perf_counter()
t_start_cnt = perf_counter()

while keep_going:
if verbose and Niter == 1:
Expand Down Expand Up @@ -371,7 +371,7 @@ def axon_block_threshold(axon: axon, amp_max: float, update_func: Callable, AP_s
if verbose:
clear_prompt_line(1)
pass_info(f"Block threshold is {np.round(current_amp,2)}µA ({np.round(current_tol,2)}%),"
+ f" found in {Niter-1} iterations ({np.round(t_stop-t_start,2)}s).")
+ f" found in {Niter-1} iterations ({np.round(t_stop-t_start_cnt,2)}s).")
return current_amp

def firing_threshold_point_source(
Expand Down

0 comments on commit 8e0767a

Please sign in to comment.