placecell.loaders#
I/O functions for loading behavior and neural data.
Functions
|
Compute the overlapping time range between neural and behavior recordings. |
|
Load the raw behavior trajectory at behavior rate. |
|
Load visualization data: traces, max projection, and footprints. |
- placecell.loaders.compute_overlap_time_range(neural_timestamp: Path, behavior_timestamp: Path, use_neural_last_timestamp: bool = True) tuple[float, float]#
Compute the overlapping time range between neural and behavior recordings.
- Parameters:
neural_timestamp (Path) – Path to neural timestamp CSV (columns: frame, timestamp_first, timestamp_last).
behavior_timestamp (Path) – Path to behavior timestamp CSV (columns: frame_index, unix_time).
use_neural_last_timestamp (bool) – Whether to use timestamp_last for neural frames.
- Returns:
(start_time, end_time) of the overlapping window in unix time.
- Return type:
tuple[float, float]
- placecell.loaders.load_behavior_data(behavior_position: Path, behavior_timestamp: Path, bodypart: str, *, x_col: str = 'x', y_col: str = 'y') DataFrame#
Load the raw behavior trajectory at behavior rate.
Returns
frame_index, x, y, unix_time. Speed is computed downstream at the neural sample rate against the canonical neural-rate table, so no speed column is attached here.- Parameters:
behavior_position (Path) – Path to behavior position CSV file.
behavior_timestamp (Path) – Path to behavior timestamp CSV file.
bodypart (str) – Body part name to use for trajectory.
x_col (str) – Coordinate column names in the behavior CSV.
y_col (str) – Coordinate column names in the behavior CSV.
- Return type:
DataFrame
- placecell.loaders.load_visualization_data(neural_path: Path | None, trace_name: str) tuple[Any, ndarray | None, Any]#
Load visualization data: traces, max projection, and footprints.
- Parameters:
neural_path (Path | None) – Path to neural data directory.
trace_name (str) – Name of trace zarr to load.
- Returns:
(traces, max_proj, footprints) - xarray DataArray or None for each.
- Return type:
tuple