placecell.dataset.maze#

Dataset class for maze/arm 1D place cell analysis.

Classes

MazeDataset(*args, **kwargs)

Dataset for 1D arm/maze place cell analysis.

class placecell.dataset.maze.MazeDataset(*args: Any, **kwargs: Any)#

Bases: BasePlaceCellDataset

Dataset for 1D arm/maze place cell analysis.

Overrides the behavior preprocessing, occupancy computation, and unit analysis steps to work on a concatenated 1D axis.

Parameters:
  • args (Any)

  • kwargs (Any)

property spatial_1d: SpatialMap1DConfig#

Shortcut to 1D spatial map config.

property p_value_threshold: float#

P-value threshold from 1D spatial map config.

load(*, force_redetect: bool = False) None#

Load neural traces, behavior from zone_tracking CSV, and vis assets.

MazeDataset reads the zone-detected zone_tracking CSV directly. If the CSV is missing, _run_zone_detection() is invoked first to project the raw behavior_position CSV onto the maze graph.

Parameters:

force_redetect (bool) – If True, re-run detect_zones_from_csv() even when zone_tracking_path already exists. Useful when zone-detection parameters have changed and the cached output is stale.

Return type:

None

preprocess_behavior() None#

Serialize to 1D, compute speed, and filter.

Zone and arm_position columns are already in self.trajectory from load(), so no extra CSV loading is needed.

Return type:

None

match_events() None#

Build the canonical neural-rate table for the maze pipeline.

After this call:
  • self.canonical holds one row per neural frame with columns frame_index, neural_time, x, y, pos_1d, arm_index, [direction], speed_1d, s_unit_*.

  • self.trajectory_1d_filtered is the speed-filtered canonical view restricted to arm frames, with frame_index aliased to frame_index.

  • self.event_place is the long-format event table derived from the same speed-filtered view.

Return type:

None

compute_occupancy() None#

Compute 1D occupancy from speed-filtered arm trajectory.

Return type:

None

analyze_units(progress_bar: Any = None, n_workers: int = 1) None#

Run 1D spatial analysis for all deconvolved units.

Parameters:
  • progress_bar (Any) – Progress bar wrapper, e.g. tqdm.

  • n_workers (int) – Number of parallel worker processes. 1 (default) runs sequentially with no multiprocessing overhead.

Return type:

None

save_bundle(path: str | Path, *, save_figures: bool = True) Path#

Save bundle, including 1D trajectory and maze metadata.

Parameters:
  • path (str | Path)

  • save_figures (bool)

Return type:

Path

classmethod load_bundle(path: str | Path) MazeDataset#

Load a saved .pcellbundle that contains 1D maze data.

Restores all base attributes via the parent loader, then adds 1D-specific state (trajectories, arm boundaries, etc.).

Parameters:

path (str | Path)

Return type:

MazeDataset