arista.viz.nompc_dosage

Phase 7d headline figure — |gain| (or signed gain) vs NompC dosage.

For every thermal_step protocol we already have per-recording gains (arista.processing.gain.compute_recording_gain). This module pools gains across protocols, canonicalises strain names through arista.constants.STRAIN_SYNONYMS, looks up the functional NompC dosage per strain via arista.constants.NOMPC_DOSAGE, and draws one raincloud per strain at its dosage x-position. One panel per cell type.

Strains sharing the same dosage tier (CantonS / white / 641 at 2.0, NompCRescue / UASnompC… also at 2.0 — though the latter alias is canonicalised to NompCRescue before plotting) get small symmetric x-offsets so their rainclouds don’t overlap; their colours come from arista.constants.STRAIN_COLOURS so the legend disambiguates.

Recordings whose strain is not in NOMPC_DOSAGE are dropped with a console-visible message; the dosage figure is by definition only meaningful for strains with a defined functional level.

Module Attributes

DEFAULT_DOSAGE_STIMULI

Default stimulus protocols pooled together for the headline figure.

Functions

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

Per-recording gains pooled across stimuli, canonicalised + dosage-tagged.

plot_nompc_dosage(data, *[, stimulus_names, ...])

One panel per cell type, raincloud per strain at its NompC dosage.

Classes

NompCDosage([cell_types, stimulus_names, ...])

Callable wrapper for batch reuse.

arista.viz.nompc_dosage.DEFAULT_DOSAGE_STIMULI: tuple[str, ...] = ('ascAmp', 'descAmp', 'ascAmpFlip', 'descAmpFlip')

Default stimulus protocols pooled together for the headline figure.

class arista.viz.nompc_dosage.NompCDosage(cell_types=('CC', 'HC'), stimulus_names=('ascAmp', 'descAmp', 'ascAmpFlip', 'descAmpFlip'), abs_gain=True, figsize=(12, 5.5), dpi=200, rng_seed=23, connect_tiers=True)[source]

Bases: object

Callable wrapper for batch reuse.

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

Figure

rng_seed: int = 23
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

stimulus_names: tuple[str, ...] = ('ascAmp', 'descAmp', 'ascAmpFlip', 'descAmpFlip')
arista.viz.nompc_dosage.fetch_dosage_gains(conn, *, stimulus_names=('ascAmp', 'descAmp', 'ascAmpFlip', 'descAmpFlip'), cell_types=('CC', 'HC'))[source]

Per-recording gains pooled across stimuli, canonicalised + dosage-tagged.

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

  • stimulus_names (tuple[str, ...]) – Thermal_step protocols to pool. Defaults to all four ramp stimuli.

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

Returns:

DataFrame with one row per (recording, stimulus) carrying the original gain columns plus canonical_strain and dosage. Rows whose strain has no entry in NOMPC_DOSAGE are dropped.

Return type:

pandas.DataFrame

arista.viz.nompc_dosage.plot_nompc_dosage(data, *, stimulus_names=('ascAmp', 'descAmp', 'ascAmpFlip', 'descAmpFlip'), cell_types=('CC', 'HC'), abs_gain=True, figsize=(12, 5.5), title=None, rng_seed=23, connect_tiers=True)[source]

One panel per cell type, raincloud per strain at its NompC dosage.

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

  • stimulus_names (tuple[str, ...]) – Thermal-step protocols to pool when fetching from a connection.

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

  • abs_gain (bool) – Plot |slope| (default, makes CC and HC comparable and reads as “how much does the cell care about temperature change”). Set False to preserve sign.

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

  • title (str | None) – Optional suptitle.

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

  • connect_tiers (bool) – When True, overlays a thin median-vs-dosage line connecting tier centres so the dose-response trend is visible at a glance.

Returns:

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

Return type:

Figure