arista.processing.sigmoid
Four-parameter logistic (4PL) fit of ΔF/F vs Δ target temperature.
Reproduces Kossen 2019 Fig 24 / 25: for each (strain × cell-type) group, pool every recording’s per-step response and fit a sigmoid
y = bottom + (top - bottom) / (1 + exp(-slope · (x - midpoint)))
CC cells produce a descending curve (more positive Δtarget → less
ΔF/F): the fit recovers this either via slope < 0 or via
bottom > top depending on the initial guess. Either parameterisation
describes the same curve, so we let scipy.optimize.curve_fit settle
on whichever the data prefers — no bounds.
Fits are computed on demand (one curve_fit per group, milliseconds)
rather than persisted alongside adaptation_fits: the fit is a
pooled-group statistic, not a per-recording one, so it doesn’t fit the
per-recording schema.
Functions
|
Fit a 4PL to pooled |
|
Run |
|
Four-parameter logistic. |
Classes
|
One 4PL sigmoid fit. |
- class arista.processing.sigmoid.SigmoidFit(bottom, top, midpoint_c, slope, r_squared, n_points)[source]
Bases:
objectOne 4PL sigmoid fit.
- Parameters:
- arista.processing.sigmoid.fit_sigmoid(deltas, responses, *, max_iterations=5000)[source]
Fit a 4PL to pooled
(Δtarget, ΔF/F)points.- Parameters:
deltas (np.ndarray | pd.Series) – x-values (Δ target temperature in °C).
responses (np.ndarray | pd.Series) – y-values (median ΔF/F per step).
max_iterations (int) –
curve_fitmaxfevceiling.
- Returns:
SigmoidFiton convergence,Nonewhen the data is too sparse (<4 points), perfectly flat, or whencurve_fitraises.- Return type:
SigmoidFit | None
- arista.processing.sigmoid.fit_sigmoids_by_group(response_df, *, group_keys=('strain_name', 'cell_type'), min_points=4)[source]
Run
fit_sigmoid()over each group in a response frame.- Parameters:
response_df (pandas.DataFrame) – Output of
arista.viz.response_curves.fetch_response_data().group_keys (tuple[str, ...]) – Columns to group by (default per strain × cell-type).
min_points (int) – Skip groups with fewer than this many finite points.
- Returns:
DataFrame with one row per group carrying
bottom,top,midpoint_c,slope,r_squared,n_pointsplus the group key columns. Groups whose fit failed are omitted.- Return type:
- arista.processing.sigmoid.four_pl(x, bottom, top, midpoint, slope)[source]
Four-parameter logistic.
bottomandtopare the left/right asymptotes,midpointis the x-value at the curve’s inflection, andslopeis the curve’s slope at the midpoint (units: 1/°C).- Parameters:
x (numpy.ndarray)
bottom (float)
top (float)
midpoint (float)
slope (float)
- Return type: