canns.analyzer.data.asa.config

Exceptions

CANN2DError

Base exception for CANN2D analysis errors.

DataLoadError

Raised when data loading fails.

ProcessingError

Raised when data processing fails.

Classes

CANN2DPlotConfig

Specialized PlotConfig for CANN2D visualizations.

Constants

Constants used throughout CANN2D analysis.

SpikeEmbeddingConfig

Configuration for spike train embedding.

TDAConfig

Configuration for Topological Data Analysis (TDA).

Module Contents

exception canns.analyzer.data.asa.config.CANN2DError[source]

Bases: Exception

Base exception for CANN2D analysis errors.

Examples

>>> try:
...     raise CANN2DError("boom")
... except CANN2DError:
...     pass

Initialize self. See help(type(self)) for accurate signature.

exception canns.analyzer.data.asa.config.DataLoadError[source]

Bases: CANN2DError

Raised when data loading fails.

Examples

>>> try:
...     raise DataLoadError("missing data")
... except DataLoadError:
...     pass

Initialize self. See help(type(self)) for accurate signature.

exception canns.analyzer.data.asa.config.ProcessingError[source]

Bases: CANN2DError

Raised when data processing fails.

Examples

>>> try:
...     raise ProcessingError("processing failed")
... except ProcessingError:
...     pass

Initialize self. See help(type(self)) for accurate signature.

class canns.analyzer.data.asa.config.CANN2DPlotConfig[source]

Bases: canns.analyzer.visualization.PlotConfig

Specialized PlotConfig for CANN2D visualizations.

Extends canns.analyzer.visualization.PlotConfig with fields that control 3D projection and torus animation parameters.

Examples

>>> from canns.analyzer.data import CANN2DPlotConfig
>>> cfg = CANN2DPlotConfig.for_projection_3d(title="Projection")
>>> cfg.zlabel
'Component 3'
classmethod for_projection_3d(**kwargs)[source]

Create configuration for 3D projection plots.

Examples

>>> cfg = CANN2DPlotConfig.for_projection_3d(figsize=(6, 5))
>>> cfg.figsize
(6, 5)
classmethod for_torus_animation(**kwargs)[source]

Create configuration for 3D torus bump animations.

Examples

>>> cfg = CANN2DPlotConfig.for_torus_animation(fps=10, n_frames=50)
>>> cfg.fps, cfg.n_frames
(10, 50)
dpi: int = 300[source]
frame_step: int = 5[source]
n_frames: int = 20[source]
numangsint: int = 51[source]
r1: float = 1.5[source]
r2: float = 1.0[source]
window_size: int = 300[source]
zlabel: str = 'Component 3'[source]
class canns.analyzer.data.asa.config.Constants[source]

Constants used throughout CANN2D analysis.

Examples

>>> from canns.analyzer.data import Constants
>>> Constants.DEFAULT_DPI
300
DEFAULT_DPI = 300[source]
DEFAULT_FIGSIZE = (10, 8)[source]
GAUSSIAN_SIGMA_FACTOR = 100[source]
MULTIPROCESSING_CORES = 4[source]
SPEED_CONVERSION_FACTOR = 100[source]
TIME_CONVERSION_FACTOR = 0.01[source]
class canns.analyzer.data.asa.config.SpikeEmbeddingConfig[source]

Configuration for spike train embedding.

res[source]

Time scaling factor that converts seconds to integer bins.

Type:

int

dt[source]

Bin width in the same scaled units as res.

Type:

int

sigma[source]

Gaussian smoothing width (scaled units).

Type:

int

smooth[source]

Whether to apply temporal smoothing to spike counts.

Type:

bool

speed_filter[source]

Whether to filter by animal speed (requires x/y/t in the input).

Type:

bool

min_speed[source]

Minimum speed threshold for speed_filter (cm/s by convention).

Type:

float

Examples

>>> from canns.analyzer.data import SpikeEmbeddingConfig
>>> cfg = SpikeEmbeddingConfig(smooth=False, speed_filter=False)
>>> cfg.min_speed
2.5
dt: int = 1000[source]
min_speed: float = 2.5[source]
res: int = 100000[source]
sigma: int = 5000[source]
smooth: bool = True[source]
speed_filter: bool = True[source]
class canns.analyzer.data.asa.config.TDAConfig[source]

Configuration for Topological Data Analysis (TDA).

dim[source]

Target PCA dimension before TDA.

Type:

int

num_times[source]

Downsampling stride in time.

Type:

int

active_times[source]

Number of most active time points to keep.

Type:

int

k[source]

Number of neighbors used in denoising.

Type:

int

n_points[source]

Number of points sampled for persistent homology.

Type:

int

metric[source]

Distance metric for point cloud (e.g., “cosine”).

Type:

str

nbs[source]

Number of neighbors for distance matrix construction.

Type:

int

maxdim[source]

Maximum homology dimension for persistence.

Type:

int

coeff[source]

Field coefficient for persistent homology.

Type:

int

show[source]

Whether to show barcode plots.

Type:

bool

do_shuffle[source]

Whether to run shuffle analysis.

Type:

bool

num_shuffles[source]

Number of shuffles for null distribution.

Type:

int

progress_bar[source]

Whether to show progress bars.

Type:

bool

standardize[source]

Whether to standardize data before PCA (z-score).

Type:

bool

Examples

>>> from canns.analyzer.data import TDAConfig
>>> cfg = TDAConfig(maxdim=1, do_shuffle=False, show=False)
>>> cfg.maxdim
1
active_times: int = 15000[source]
coeff: int = 47[source]
dim: int = 6[source]
do_shuffle: bool = False[source]
k: int = 1000[source]
maxdim: int = 1[source]
metric: str = 'cosine'[source]
n_points: int = 1200[source]
nbs: int = 800[source]
num_shuffles: int = 1000[source]
num_times: int = 5[source]
progress_bar: bool = True[source]
show: bool = True[source]
standardize: bool = True[source]