arista.viz.adaptation_taus

Adaptation time-constant rainclouds.

Pulls adaptation_fits directly from the DB (already computed during arista-ingest --process) and renders one figure per adaptation stimulus, panel per cell type, raincloud per strain.

τ is positively skewed and bounded below at zero, so the y-axis defaults to a log scale (log_tau=True). Toggle off for a linear view. Median + IQR per group is read directly off the boxplot at the centre of each raincloud — bootstrap CI of the median is not shown here because each cell contributes a single τ value, not a distribution that benefits from re-sampling.

Functions

discover_adaptation_stimuli(conn)

Stimuli that produced adaptation_fits rows.

fetch_adaptation_taus(conn, *[, ...])

Per-recording τ values joined with v_recordings metadata.

plot_adaptation_taus(data, *[, ...])

Raincloud of adaptation τ per strain × cell-type.

Classes

AdaptationTaus([cell_types, log_tau, ...])

Callable wrapper holding default styling.

class arista.viz.adaptation_taus.AdaptationTaus(cell_types=('CC', 'HC'), log_tau=True, figsize=(12, 5), dpi=200, strains=None, rng_seed=19, min_r_squared=None)[source]

Bases: object

Callable wrapper holding default styling.

Parameters:
cell_types: tuple[str, ...] = ('CC', 'HC')
dpi: int = 200
figsize: tuple[float, float] = (12, 5)
log_tau: bool = True
min_r_squared: float | None = None
plot(data, *, stimulus_name=None, title=None, **overrides)[source]
Parameters:
Return type:

Figure

rng_seed: int = 19
save(fig, path, *, dpi=None, close=True)[source]

Save fig as PNG. SVG sibling is written automatically.

Parameters:
  • fig (Figure)

  • path (Path | str)

  • dpi (int | None)

  • close (bool)

Return type:

Path

strains: tuple[str, ...] | None = None
arista.viz.adaptation_taus.discover_adaptation_stimuli(conn)[source]

Stimuli that produced adaptation_fits rows.

Parameters:

conn (Connection)

Return type:

list[str]

arista.viz.adaptation_taus.fetch_adaptation_taus(conn, *, stimulus_name=None, cell_types=('CC', 'HC'), strains=None, min_r_squared=None)[source]

Per-recording τ values joined with v_recordings metadata.

Parameters:
  • conn (Connection) – Open SQLite connection to a populated arista.db.

  • stimulus_name (str | None) – Optional stimulus filter (one figure per stimulus in the typical batch workflow).

  • cell_types (tuple[str, ...]) – Cell types to include.

  • strains (tuple[str, ...] | None) – Optional strain whitelist.

  • min_r_squared (float | None) – Drop fits below this quality threshold; None keeps every fit.

Returns:

DataFrame with one row per recording carrying recording_id, researcher_name, strain_name, cell_type, hemisphere, stimulus_name, tau_s, amplitude, asymptote, r_squared, n_points.

Return type:

pandas.DataFrame

arista.viz.adaptation_taus.plot_adaptation_taus(data, *, stimulus_name=None, cell_types=('CC', 'HC'), strains=None, log_tau=True, figsize=(12, 5), title=None, rng_seed=19, min_r_squared=None)[source]

Raincloud of adaptation τ per strain × cell-type.

Parameters:
  • data (pd.DataFrame | sqlite3.Connection) – Either an already-fetched τ frame (output of fetch_adaptation_taus()) or a live SQLite connection.

  • stimulus_name (str | None) – Mandatory when data is a connection.

  • cell_types (tuple[str, ...]) – Cell types to plot, one panel per.

  • strains (tuple[str, ...] | None) – Optional strain whitelist (display order).

  • log_tau (bool) – Plot τ on a log y-axis (default). τ is positively skewed and bounded below at zero so log is the natural view; toggle off for a linear inspection.

  • figsize (tuple[float, float]) – (width, height) inches.

  • title (str | None) – Optional figure suptitle.

  • rng_seed (int) – Seed for the jitter RNG (reproducibility).

  • min_r_squared (float | None) – Forwarded to fetch_adaptation_taus().

Returns:

matplotlib.figure.Figure. Caller owns I/O.

Return type:

Figure