Skip to content

Commit

Permalink
try to be more robust in handling unexpected values
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Sep 18, 2023
1 parent 6ba126e commit 1beeab4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def from_neo(cls, signal, down_sample_factor):
"times_dimensionality": str(signal.t_start.units.dimensionality),
"values_units": str(signal.units.dimensionality),
}
if down_sample_factor in (None, ""):
try:
down_sample_factor = int(down_sample_factor)
except (ValueError, TypeError):
down_sample_factor = 1
if isinstance(signal, neo.AnalogSignal):
data["sampling_period"] = (
Expand Down

0 comments on commit 1beeab4

Please sign in to comment.