Skip to content

Commit

Permalink
Merge pull request #1622 from NeuralEnsemble/black-formatting
Browse files Browse the repository at this point in the history
Black formatting
  • Loading branch information
zm711 authored Jan 12, 2025
2 parents af7c53c + 99501cd commit fcbcc94
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions neo/rawio/plexonrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _parse_header(self):
# To avoid overflow errors when doing arithmetic operations on numpy scalars
np_scalar_to_python_scalar = lambda x: x.item() if isinstance(x, np.generic) else x
bl_header = {key: np_scalar_to_python_scalar(bl_header[key]) for key in bl_header.dtype.names}

current_upper_byte_of_5_byte_timestamp = int(bl_header["UpperByteOf5ByteTimestamp"])
current_bl_timestamp = int(bl_header["TimeStamp"])
timestamp = current_upper_byte_of_5_byte_timestamp * 2**32 + current_bl_timestamp
Expand Down Expand Up @@ -260,11 +260,13 @@ def _parse_header(self):
chan_loop = range(nb_sig_chan)
for chan_index in chan_loop:
slow_channel_headers = slowChannelHeaders[chan_index]

# To avoid overflow errors when doing arithmetic operations on numpy scalars
np_scalar_to_python_scalar = lambda x: x.item() if isinstance(x, np.generic) else x
slow_channel_headers = {key: np_scalar_to_python_scalar(slow_channel_headers[key]) for key in slow_channel_headers.dtype.names}

slow_channel_headers = {
key: np_scalar_to_python_scalar(slow_channel_headers[key]) for key in slow_channel_headers.dtype.names
}

name = slow_channel_headers["Name"].decode("utf8")
chan_id = slow_channel_headers["Channel"]
length = self._data_blocks[5][chan_id]["size"].sum() // 2
Expand All @@ -281,7 +283,10 @@ def _parse_header(self):
gain = 5000.0 / (2048 * slow_channel_headers["Gain"] * slow_channel_headers["PreampGain"])
elif global_header["Version"] >= 103:
gain = global_header["SlowMaxMagnitudeMV"] / (
0.5 * (2 ** global_header["BitsPerSpikeSample"]) * slow_channel_headers["Gain"] * slow_channel_headers["PreampGain"]
0.5
* (2 ** global_header["BitsPerSpikeSample"])
* slow_channel_headers["Gain"]
* slow_channel_headers["PreampGain"]
)
offset = 0.0

Expand Down Expand Up @@ -381,7 +386,10 @@ def _parse_header(self):
)
elif global_header["Version"] >= 105:
wf_gain = global_header["SpikeMaxMagnitudeMV"] / (
0.5 * 2.0 ** (global_header["BitsPerSpikeSample"]) * dsp_channel_headers["Gain"] * global_header["SpikePreAmpGain"]
0.5
* 2.0 ** (global_header["BitsPerSpikeSample"])
* dsp_channel_headers["Gain"]
* global_header["SpikePreAmpGain"]
)
wf_offset = 0.0
wf_left_sweep = -1 # DONT KNOWN
Expand Down

0 comments on commit fcbcc94

Please sign in to comment.