stanza.analysis.fitting

Module Contents

Classes

NameDescription
PinchoffFitResultResult of pinchoff curve fitting.

Functions

NameDescription
pinchoff_curveSmooth pinchoff curve with coefficients a, b, c
derivative_extrema_indicesReturn the indices of key voltages for pinchoff curves.
_compute_initial_paramsCompute initial parameter estimates from normalized data.
_compute_parameter_boundsCompute robust parameter bounds from normalized data.
_map_index_to_voltageMap an array index to the corresponding voltage value.
fit_pinchoff_parametersFit the pinchoff parameters a, b, c of the pinchoff curve, and returns the cut-off, transition, and conducting voltages.

Data

DEFAULT_C_MARGIN DEFAULT_BOUNDS

API

1stanza.analysis.fitting.DEFAULT_C_MARGIN

Value: 10.0

1stanza.analysis.fitting.DEFAULT_BOUNDS

Value: [(1e-08, 1.0), (), ()]

1class stanza.analysis.fitting.PinchoffFitResult

Result of pinchoff curve fitting.

Attributes: v_cut_off: Cut-off voltage (where current flowing through the device approaches a near-zero value) v_transition: Transition voltage (midpoint of transition from cut-off to saturation) v_saturation: Conducting voltage (where current flowing through the device approaches a saturated state) popt: Fitted parameters [a, b, c] for pinchoff_curve in normalized space pcov: Covariance matrix of fitted parameters v_min: Minimum voltage value used for normalization v_max: Maximum voltage value used for normalization i_min: Minimum current value used for normalization i_max: Maximum current value used for normalization

Note: popt parameters are fitted in normalized [0,1] space. To generate the fitted curve in original space, use the fit_curve() method or manually normalize voltages before applying pinchoff_curve().

1v_cut_off: float | None

Value: None

1v_transition: float | None

Value: None

1v_saturation: float | None

Value: None

1popt: numpy.ndarray

Value: None

1pcov: numpy.ndarray

Value: None

1v_min: float

Value: 0.0

1v_max: float

Value: 1.0

1i_min: float

Value: 0.0

1i_max: float

Value: 1.0

1fit_curve(voltages: numpy.ndarray) -> numpy.ndarray

Generate fitted curve in original voltage/current space.

Parameters:

voltages
numpy.ndarray

Voltage array in original space

Returns:

Fitted current values in original space

1stanza.analysis.fitting.pinchoff_curve(
2 x: numpy.ndarray,
3 a: float,
4 b: float,
5 c: float
6) -> numpy.ndarray

Smooth pinchoff curve with coefficients a, b, c

From: Darulová, J. et al. Autonomous tuning and charge state detection of gate defined quantum dots. Physical Review, Applied 13, 054005 (2019).

Parameters:

Returns:

np.ndarray: Pinchoff current f(x) output

1stanza.analysis.fitting.derivative_extrema_indices(
2 x: numpy.ndarray, y: numpy.ndarray
3) -> tuple[int, int, int]

Return the indices of key voltages for pinchoff curves.

v_cut_off corresponds to the cut-off state (low current) v_saturation corresponds to the saturated state (high current) v_transition corresponds to the transition from cut-off to saturation (steepest slope)

Parameters:

Returns:

Tuple[int, int, int]: (transition_v_ind, saturation_v_ind, cut_off_v_ind)

1stanza.analysis.fitting._compute_initial_params(
2 v_norm: numpy.ndarray, i_norm: numpy.ndarray
3) -> numpy.ndarray

Compute initial parameter estimates from normalized data.

For inverted curves (decreasing with voltage), we use negative b values to represent the inversion while keeping amplitude positive.

1stanza.analysis.fitting._compute_parameter_bounds(
2 v_norm: numpy.ndarray, i_norm: numpy.ndarray
3) -> tuple[numpy.ndarray, numpy.ndarray]

Compute robust parameter bounds from normalized data.

Calculates appropriate lower and upper bounds for the three parameters [a, b, c] of the pinchoff_curve function based on the characteristics of the input data. The bounds are designed to constrain the optimization while allowing for both normal and inverted pinchoff curves.

Parameters:

v_norm
numpy.ndarray

Normalized voltage array (typically in [0, 1] range)

i_norm
numpy.ndarray

Normalized current array (typically in [0, 1] range)

Returns:

Tuple of (lower_bounds, upper_bounds) where each is a numpy array of shape (3,) containing bounds for parameters [a, b, c]:

  • a (amplitude): Positive value, typically 0.01*i_range to 2.0*i_range
  • b (slope): Can be negative for inverted curves, |b| <= 20.0/v_range
  • c (offset): Computed to ensure curve spans the voltage range If computed bounds are invalid (lower >= upper), falls back to DEFAULT_BOUNDS for that parameter.
1stanza.analysis.fitting._map_index_to_voltage(
2 index: int, voltages: numpy.ndarray
3) -> float | None

Map an array index to the corresponding voltage value.

Parameters:

index
int

Array index

voltages
numpy.ndarray

Array of voltage values

Returns:

Voltage at the given index, or None if index is out of bounds

1stanza.analysis.fitting.fit_pinchoff_parameters(
2 voltages: numpy.ndarray,
3 currents: numpy.ndarray,
4 sigma: float = 2.0
5) -> stanza.analysis.fitting.PinchoffFitResult

Fit the pinchoff parameters a, b, c of the pinchoff curve, and returns the cut-off, transition, and conducting voltages.

Parameters:

Returns:

PinchoffFitResult containing fitted voltages and parameters