Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjorthmedh committed Sep 5, 2024
1 parent d1030ea commit f3cb61d
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 67 deletions.

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions snudda/simulate/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,16 @@ def add_bath_application(self, species_name, concentration, time, neuron_id=None

############################################################################

def sanity_check_play_vectors(self, sim_end_time):
# TODO: Add additional checks that all bath application play vectors are long enough

for species_name, bath_data in self.bath_application.items():
bath_max_time = np.max(bath_data[0])

if sim_end_time > bath_max_time:
raise ValueError(f"Simulation duration {sim_end_time} is "
f"longer than time vector for bath application of {species_name}")

def run(self, t=None, hold_v=None):

""" Run simulation. """
Expand All @@ -2051,6 +2061,8 @@ def run(self, t=None, hold_v=None):
else:
t = 1000.0

self.sanity_check_play_vectors(sim_end_time=t)

if hold_v is None:
if self.sim_info is not None and "hold_voltage" in self.sim_info:
hold_v = self.sim_info["hold_voltage"]
Expand Down

0 comments on commit f3cb61d

Please sign in to comment.