arista.viz.gain_comparison
Compare ΔF/F-per-°C gain across strains and cell types.
This is the headline NompC-dosage figure: for each recording fit a line through the per-step (Δ target, ΔF/F) points, take the slope as the cell’s gain, and render a raincloud (half-violin + box + jittered strip) per (strain, cell-type) group. CLAUDE.md §7.3 — raincloud over bar — is honoured by construction.
Cell-type signs: CC slope is negative (cold stimuli drive positive
response), HC slope is positive. The default panel layout keeps the
signs as-is (one panel per cell type, y-axis crosses zero) so the
direction is read directly off the figure. abs_gain=True switches
to absolute slope magnitude when the goal is direct strain comparison
across cell types.
Functions
|
Per-recording gains from a populated |
|
Raincloud comparison of per-recording gain across strains. |
Classes
|
Callable wrapper holding default styling. |
- class arista.viz.gain_comparison.GainComparison(cell_types=('CC', 'HC'), abs_gain=False, figsize=(12, 5), dpi=200, strains=None, rng_seed=13, min_steps=3)[source]
Bases:
objectCallable wrapper holding default styling.
Mirrors
arista.viz.response_curves.ResponseCurvesso the same orchestration pattern carries over to gain figures.- Parameters:
- plot(data, *, stimulus_name=None, title=None, **overrides)[source]
- Parameters:
data (pd.DataFrame | sqlite3.Connection)
stimulus_name (str | None)
title (str | None)
- Return type:
Figure
- arista.viz.gain_comparison.fetch_recording_gains(conn, *, stimulus_name, cell_types=('CC', 'HC'), strains=None, min_steps=3)[source]
Per-recording gains from a populated
arista.db.- Returns:
DataFrame with one row per (recording, strain, cell_type, hemisphere) carrying
slope,intercept,r_squared,n_points.- Parameters:
- Return type:
- arista.viz.gain_comparison.plot_gain_comparison(data, *, stimulus_name=None, cell_types=('CC', 'HC'), strains=None, abs_gain=False, min_steps=3, figsize=(12, 5), title=None, rng_seed=13)[source]
Raincloud comparison of per-recording gain across strains.
- Parameters:
data (pd.DataFrame | sqlite3.Connection) – Either an already-computed gain frame (output of
fetch_recording_gains()/compute_gains_table()) or a live SQLite connection.stimulus_name (str | None) – Stimulus protocol (mandatory when
datais a connection).cell_types (tuple[str, ...]) – Cell types to plot, one panel per.
strains (tuple[str, ...] | None) – Optional strain whitelist (in display order). When
None, every strain present indatais plotted in sorted order.abs_gain (bool) – When
Trueplot|slope|instead of signed slope — useful for direct cross-cell-type comparison.min_steps (int) – Forwarded to
compute_gains_table()whendatais a connection.title (str | None) – Optional figure suptitle.
rng_seed (int) – Seed for the jitter RNG (reproducibility).
- Returns:
matplotlib.figure.Figure. Caller owns I/O.- Return type:
Figure