meanap.pipeline.spreadsheet

Read the recording list spreadsheet, mirroring pipelineReadCSV.m.

Functions

ground_spike_times_dict(spike_times_dict, ...)

Zero out spike times for channels listed in ground_electrodes (matched by channel ID/name — MATLAB's default Params.electrodesToGroundPerRecordingUseName = 1 behavior, the only mode this port supports), port of groundSpikeTimes.m.

parse_ground_electrodes(ground)

Parse a recording's Ground spreadsheet value (comma-separated channel IDs) into a set of ints, port of groundSpikeTimes.m's electrode-list parsing.

parse_spreadsheet_range(range_str)

Parse a range like 'A2:A3' or '2:1000' into 1-indexed (start_line, end_line).

read_recording_csv(path, spreadsheet_range)

Read the recording list CSV.

Classes

RecordingInfo(filename, div, group[, ground])

class meanap.pipeline.spreadsheet.RecordingInfo(filename: 'str', div: 'float', group: 'str', ground: 'str | None' = None)[source]

Bases: object

Parameters:
  • filename (str)

  • div (float)

  • group (str)

  • ground (str | None)

div: float
filename: str
ground: str | None = None
group: str
meanap.pipeline.spreadsheet.ground_spike_times_dict(spike_times_dict, channels, ground_electrodes)[source]

Zero out spike times for channels listed in ground_electrodes (matched by channel ID/name — MATLAB’s default Params.electrodesToGroundPerRecordingUseName = 1 behavior, the only mode this port supports), port of groundSpikeTimes.m.

spike_times_dict maps 0-indexed channel position (matching channels[i]’s position) to that channel’s spike times for a single already-selected detection method — the shape this is called with in step2.py/step3.py/step4.py.

Parameters:
  • spike_times_dict (dict[int, ndarray])

  • channels (ndarray)

  • ground_electrodes (set[int] | None)

Return type:

dict[int, ndarray]

meanap.pipeline.spreadsheet.parse_ground_electrodes(ground)[source]

Parse a recording’s Ground spreadsheet value (comma-separated channel IDs) into a set of ints, port of groundSpikeTimes.m’s electrode-list parsing. Returns None if there’s nothing to ground — including pandas turning an empty cell into the string "nan", which read_recording_csv doesn’t special-case (it just calls str() on whatever pandas gives it).

Parameters:

ground (str | None)

Return type:

set[int] | None

meanap.pipeline.spreadsheet.parse_spreadsheet_range(range_str)[source]

Parse a range like 'A2:A3' or '2:1000' into 1-indexed (start_line, end_line).

Line numbers count the header as line 1, matching MATLAB’s DataLines/ csvRange convention (e.g. [2, 3] reads the first two data rows after the header).

Parameters:

range_str (str)

Return type:

tuple[int, int]

meanap.pipeline.spreadsheet.read_recording_csv(path, spreadsheet_range)[source]

Read the recording list CSV.

Expects columns: Recording Filename, DIV group, Genotype, [Ground].

Parameters:
  • path (str | Path)

  • spreadsheet_range (str)

Return type:

list[RecordingInfo]