Skip to content

Commit d6d3e0b

Browse files
Merge pull request #382 from h-mayorquin/fix_another_warning_monotonic
Fix #375
2 parents 8d63b44 + 08eb0a7 commit d6d3e0b

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Upcoming
2+
### Fixes
3+
* `check_time_interval_time_columns` now only checks for `start_time` with `is_ascending_series` . [#382](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/382)
24

35
# v0.4.28
46

src/nwbinspector/checks/tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def check_time_interval_time_columns(time_intervals: TimeIntervals, nelems: Opti
5858
"""
5959
unsorted_cols = []
6060
for column in time_intervals.columns:
61-
if column.name[-5:] == "_time":
61+
if column.name == "start_time":
6262
if not is_ascending_series(column.data, nelems):
6363
unsorted_cols.append(column.name)
6464
if unsorted_cols:

src/nwbinspector/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def is_ascending_series(series: Union[h5py.Dataset, ArrayLike], nelems: Optional
9292
if isinstance(series, h5py.Dataset):
9393
differences = np.diff(_cache_data_selection(data=series, selection=slice(nelems)))
9494
else:
95-
differences = np.diff(series[:nelems])
95+
differences = np.diff(series[:nelems]) # already in memory, no need to cache
9696

97-
return np.all(differences >= 0) # already in memory, no need to cache
97+
return np.all(differences >= 0)
9898

9999

100100
def is_dict_in_string(string: str):

tests/unit_tests/test_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_check_time_interval_time_columns():
8686

8787
assert check_time_interval_time_columns(time_intervals) == InspectorMessage(
8888
message=(
89-
"['start_time', 'stop_time'] are time columns but the values are not in ascending order. "
89+
"['start_time'] are time columns but the values are not in ascending order. "
9090
"All times should be in seconds with respect to the session start time."
9191
),
9292
importance=Importance.BEST_PRACTICE_VIOLATION,

0 commit comments

Comments
 (0)