pyphi.landscape.Perturbation#

class pyphi.landscape.Perturbation(theta, h, quantity, value, derivative, left_derivative, right_derivative, margins, margin_derivatives, same_regime, sias)[source]#

Bases: Displayable, Serializable

Local finite-difference behavior of one quantity at one point.

Built from exactly three analyses, at θ − h, θ, and θ + h.

Variables:
  • theta (float) – The evaluation point.

  • h (float) – The finite-difference step.

  • quantity (str) – The differentiated quantity (one of phi, signed_phi, normalized_phi, signed_normalized_phi).

  • value (float) – The quantity at θ.

  • derivative (float) – Central difference (f(θ+h) − f(θ−h)) / 2h.

  • right_derivative (left_derivative,) – One-sided differences. When they disagree materially, the point is near a kink or a selection switch and the central estimate is not trustworthy — check same_regime.

  • margins (dict[str, float]) – The selection margins at θ, keyed "partition", "cause_state", "effect_state"; NaN where undefined.

  • margin_derivatives (dict[str, float]) – Central differences of the margins (NaN where a margin is undefined at any of the three points).

  • same_regime (bool) – Whether all three points share one selection identity (same MIP partition and specified states). When False, the central derivative straddles a regime boundary; trust only the one-sided values, and only on their own sides.

  • sias (tuple) – The raw analyses at (θ − h, θ, θ + h).

Parameters:
to_pandas()[source]#

The scalar fields as a one-row DataFrame; each margin m appears as m_margin and its derivative as m_margin_derivative.

Return type:

DataFrame

property switch_distances: dict[str, float]#

Linearized distance, in parameter units, to each kind of selection switch: margin / |d(margin)/dθ|.

A first-order estimate of how far the parameter can move before the corresponding selection changes its winner — the distance at which the margin would reach zero if it kept shrinking at its current rate. NaN where the margin or its derivative is undefined; inf where the margin is locally flat.