Skip to content

Commit

Permalink
feat: Add spike drift visualization for openephys recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhixiaoSu committed Jul 12, 2024
2 parents 6f794ac + 397edff commit 541526f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/aind_ephys_rig_qc/temporal_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ def align_timestamps( # noqa
# and remove residual chunks to avoid misalignment
sample_numbers = main_stream.sample_numbers
main_stream_start_sample = np.min(sample_numbers)
main_stream_start_sample = np.min(sample_numbers)
sample_intervals = np.diff(sample_numbers)
sample_intervals_cat, sample_intervals_counts = np.unique(
sample_intervals, return_counts=True
Expand Down Expand Up @@ -476,13 +477,23 @@ def align_timestamps( # noqa
& (events.line == local_sync_line)
& (events.state == 0)
]
else:
else: if 'PXIe' in stream_name and flip_NIDAQ:
print('Flipping NIDAQ stream...')
# flip the NIDAQ stream if sync line is inverted
# between NIDAQ and main stream
events_for_stream = events[
(events.stream_name == stream_name)
& (events.processor_id == source_node_id)
& (events.line == local_sync_line)
& (events.state == 1)
& (events.state == 0)
]
else:
events_for_stream = events[
(events.stream_name == stream_name)
& (events.processor_id == source_node_id)
& (events.line == local_sync_line)
& (events.state == 1)
]

# sort by sample number in case timestamps are not in order
events_for_stream = events_for_stream.sort_values(
Expand Down

0 comments on commit 541526f

Please sign in to comment.