Skip to content

Commit 6f4a97c

Browse files
authored
Merge pull request #1653 from NeuralEnsemble/black-formatting
Black formatting
2 parents af3c631 + 9817a48 commit 6f4a97c

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

neo/rawio/intanrawio.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -530,42 +530,42 @@ def _demultiplex_digital_data(self, raw_digital_data, channel_ids, i_start, i_st
530530
output[:, channel_index] = demultiplex_data[i_start:i_stop].flatten()
531531

532532
return output
533-
533+
534534
def get_intan_timestamps(self, i_start=None, i_stop=None):
535535
"""
536536
Retrieves the sample indices from the Intan raw data within a specified range.
537-
538-
Note that sample indices are called timestamps in the Intan format but they are
539-
in fact just sample indices. This function extracts the sample index timestamps
537+
538+
Note that sample indices are called timestamps in the Intan format but they are
539+
in fact just sample indices. This function extracts the sample index timestamps
540540
from Intan files, which represent relative time points in sample units (not absolute time).
541541
These indices can be particularly useful when working with recordings that have discontinuities.
542-
542+
543543
Parameters
544544
----------
545545
i_start : int, optional
546546
The starting index from which to retrieve sample indices. If None, starts from 0.
547547
i_stop : int, optional
548-
The stopping index up to which to retrieve sample indices (exclusive).
548+
The stopping index up to which to retrieve sample indices (exclusive).
549549
If None, retrieves all available indices from i_start onward.
550-
550+
551551
Returns
552552
-------
553553
timestamps : ndarray
554554
The flattened array of sample indices within the specified range.
555-
555+
556556
Notes
557557
-----
558558
- Sample indices can be converted to seconds by dividing by the sampling rate of the amplifier stream.
559559
- The function automatically handles different file formats:
560560
* header-attached: Timestamps are extracted directly from the timestamp field
561561
* one-file-per-signal: Timestamps are read from the timestamp stream
562562
* one-file-per-channel: Timestamps are read from the first channel in the timestamp stream
563-
- When recordings have discontinuities (indicated by the `discontinuous_timestamps`
563+
- When recordings have discontinuities (indicated by the `discontinuous_timestamps`
564564
attribute being True), these indices allow for proper temporal alignment of the data.
565565
"""
566566
if i_start is None:
567567
i_start = 0
568-
568+
569569
# Get the timestamps based on file format
570570
if self.file_format == "header-attached":
571571
timestamps = self._raw_data["timestamp"]
@@ -576,7 +576,7 @@ def get_intan_timestamps(self, i_start=None, i_stop=None):
576576

577577
# TODO if possible ensure that timestamps memmaps are always of correct shape to avoid memory copy here.
578578
timestamps = timestamps.flatten() if timestamps.ndim > 1 else timestamps
579-
579+
580580
if i_stop is None:
581581
return timestamps[i_start:]
582582
else:

neo/rawio/tdtrawio.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def _parse_header(self):
205205
keep = info_channel_groups["TankEvType"] & EVTYPE_MASK == EVTYPE_STREAM
206206
missing_sev_channels = []
207207
for stream_index, info in enumerate(info_channel_groups[keep]):
208-
stream_index = int(stream_index) # This transforms numpy scalar to python native int
208+
stream_index = int(stream_index) # This transforms numpy scalar to python native int
209209
self._sig_sample_per_chunk[stream_index] = info["NumPoints"]
210210

211211
stream_name_bytes = info["StoreName"]
@@ -226,8 +226,12 @@ def _parse_header(self):
226226
tsq = self._tsq[seg_index]
227227
# Filter TSQ events to find all data chunks belonging to the current stream and channel
228228
# This identifies which parts of the TEV/SEV files contain our signal data
229-
is_stream_event = (tsq["evtype"] & EVTYPE_MASK) == EVTYPE_STREAM # Get only stream events (continuous data)
230-
matches_store_name = tsq["evname"] == stream_name_bytes # Match the 4-char store name (e.g., 'RSn1')
229+
is_stream_event = (
230+
tsq["evtype"] & EVTYPE_MASK
231+
) == EVTYPE_STREAM # Get only stream events (continuous data)
232+
matches_store_name = (
233+
tsq["evname"] == stream_name_bytes
234+
) # Match the 4-char store name (e.g., 'RSn1')
231235
matches_channel = tsq["channel"] == chan_id # Match the specific channel number
232236

233237
# Combine all conditions - we want events that satisfy all three criteria

0 commit comments

Comments
 (0)