Skip to content

Commit 0394a79

Browse files
committed
Merge remote-tracking branch 'origin/spatial_series_dims' into spatial_series_dims
# Conflicts: # tests/unit_tests/test_behavior.py
2 parents 164b14e + ce47907 commit 0394a79

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

nwbinspector/checks/behavior.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
@register_check(importance=Importance.CRITICAL, neurodata_type=SpatialSeries)
77
def check_spatial_series_dims(spatial_series: SpatialSeries):
88
if len(spatial_series.data.shape) > 1 and spatial_series.data.shape[1] > 3:
9-
return InspectorMessage("SpatialSeries should have either 2 columns (x,y) or 3 columns (x,y,z).")
9+
return InspectorMessage("SpatialSeries should have either 2 columns (x,y) or 3 columns (x,y,z).")

nwbinspector/checks/time_series.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ def check_regular_timestamps(
1313
time_series: TimeSeries, time_tolerance_decimals: int = 9, gb_severity_threshold: float = 1.0
1414
):
1515
"""If the TimeSeries uses timestamps, check if they are regular (i.e., they have a constant rate)."""
16-
if time_series.timestamps is not None and check_regular_series(
17-
series=time_series.timestamps, tolerance_decimals=time_tolerance_decimals
16+
if (
17+
time_series.timestamps is not None
18+
and len(time_series.timestamps) > 2
19+
and check_regular_series(series=time_series.timestamps, tolerance_decimals=time_tolerance_decimals)
1820
):
1921
timestamps = np.array(time_series.timestamps)
2022
if timestamps.size * timestamps.dtype.itemsize > gb_severity_threshold * 1e9:

tests/unit_tests/test_behavior.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ def test_pass_check_spatial_series_dims_1d():
4343
reference_frame="reference_frame",
4444
)
4545

46-
assert check_spatial_series_dims(spatial_series) is None
46+
assert check_spatial_series_dims(spatial_series) is None

tests/unit_tests/test_time_series.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ def test_check_regular_timestamps():
3535
)
3636

3737

38+
def test_pass_check_regular_timestamps():
39+
"""Should pass because there are only two timestamps"""
40+
assert (
41+
check_regular_timestamps(
42+
time_series=pynwb.TimeSeries(
43+
name="test_time_series",
44+
unit="test_units",
45+
data=[0, 0],
46+
timestamps=[1.2, 3.2],
47+
)
48+
)
49+
is None
50+
)
51+
52+
3853
def test_check_data_orientation():
3954
assert check_data_orientation(
4055
time_series=pynwb.TimeSeries(

0 commit comments

Comments
 (0)