topqad_sdk.noiseprofiler package

Subpackages

Module contents

class topqad_sdk.noiseprofiler.FitSpecification(fit_ansatz: str, param_bounds: tuple[list, list], y_scale: str, fit_ansatz_latex: str, ind_math_symbol: str)[source]

Contains all information to specify a fit for a given class of curves.

fit_ansatz

The fit function.

Type:

Callable

param_bounds

The parameter bounds.

Type:

tuple[list, list]

y_scale

Either ‘linear’ or ‘log’.

Type:

str

fit_ansatz_latex

The latex description of the fit function. Use raw strings.

Type:

str

ind_math_symbol

Indicates the independent variable in fit_ansatz.

Type:

str

Examples

import numpy as np
from topqad_sdk.noiseprofiler import FitSpecification

def fit_ansatz_memory_d_ler(distance, p_1, p_2):
    return -(distance+1)/2 * np.log(p_2) + 2*np.log(distance) + np.log(p_1)

FitSpecification(
    fit_ansatz=fit_ansatz_memory_d_ler,
    param_bounds=([0, 0], [np.inf, np.inf]),
    y_scale='log',
    fit_ansatz_latex=r"{p_1} d^2 \times {p_2}^{{-\frac{{d+1}}{{2}}}}",
    ind_math_symbol="d",
)
fit_ansatz: str
fit_ansatz_latex: str
ind_math_symbol: str
param_bounds: tuple[list, list]
y_scale: str
class topqad_sdk.noiseprofiler.Quantity(*, value: float, unit: str)[source]

A basic quantity with a value and unit.

value

The numerical value of the quantity.

Type:

float

unit

The unit of the quantity (e.g., ‘ns’, ‘μs’, ‘ms’).

Type:

str

classmethod from_raw_value(raw_value: float, unit: str) Quantity[source]
model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

unit: str
value: float