Skip to content

Commit

Permalink
add check function for ascending spike times
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandratrapani committed Sep 18, 2023
1 parent c731513 commit c136ed8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/nwbinspector/checks/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,17 @@ def check_spike_times_not_in_unobserved_interval(units_table: Units, nunits: int
"observed intervals."
)
)


@register_check(importance=Importance.BEST_PRACTICE_VIOLATION, neurodata_type=Units)
def check_ascending_spike_times(units_table: Units):
"""Check that the values in the timestamps array are strictly increasing."""
if "spike_times" not in units_table:
return
differences = np.diff(np.asarray(units_table["spike_times"].target.data[:]))
if np.all(differences >= 0):
return InspectorMessage(
message=(
"This Units table contains spike times that are not ascending."
)
)

0 comments on commit c136ed8

Please sign in to comment.