topqad_sdk.noiseprofiler package
Subpackages
- topqad_sdk.noiseprofiler.libnoise package
- Submodules
- topqad_sdk.noiseprofiler.libnoise.models module
- topqad_sdk.noiseprofiler.libnoise.noisemodel module
- topqad_sdk.noiseprofiler.libnoise.physical_depolarizing module
NoiseModelParameters_PhysicalDepolarizing
NoiseModelParameters_PhysicalDepolarizing.T1_longitudinal_relaxation_time
NoiseModelParameters_PhysicalDepolarizing.T2_transverse_relaxation_time
NoiseModelParameters_PhysicalDepolarizing.check_T1_T2_relation()
NoiseModelParameters_PhysicalDepolarizing.is_error()
NoiseModelParameters_PhysicalDepolarizing.is_time()
NoiseModelParameters_PhysicalDepolarizing.measurement_error
NoiseModelParameters_PhysicalDepolarizing.measurement_time
NoiseModelParameters_PhysicalDepolarizing.model_config
NoiseModelParameters_PhysicalDepolarizing.one_qubit_gate_error
NoiseModelParameters_PhysicalDepolarizing.one_qubit_gate_time
NoiseModelParameters_PhysicalDepolarizing.preparation_error
NoiseModelParameters_PhysicalDepolarizing.preparation_time
NoiseModelParameters_PhysicalDepolarizing.reset_error
NoiseModelParameters_PhysicalDepolarizing.reset_time
NoiseModelParameters_PhysicalDepolarizing.two_qubit_gate_error
NoiseModelParameters_PhysicalDepolarizing.two_qubit_gate_time
NoiseModelParameters_PhysicalDepolarizing.validate_one_qubit_gate_error()
NoiseModelParameters_PhysicalDepolarizing.validate_two_qubit_gate_error()
PhysicalDepolarizing
PhysicalDepolarizing.calculate_stabilization_time()
PhysicalDepolarizing.from_dict()
PhysicalDepolarizing.from_preset()
PhysicalDepolarizing.noise_model_name
PhysicalDepolarizing.strength_gate_operation_noise_channel()
PhysicalDepolarizing.strength_idle_qubit_noise_channel()
PhysicalDepolarizing.strength_idle_qubit_stochastic_noise_channel()
PhysicalDepolarizing.strength_spam_operation_noise_channel()
- topqad_sdk.noiseprofiler.libnoise.uniform_depolarizing module
- Module contents
NoiseModel
PhysicalDepolarizing
PhysicalDepolarizing.calculate_stabilization_time()
PhysicalDepolarizing.from_dict()
PhysicalDepolarizing.from_preset()
PhysicalDepolarizing.input_noise_parameters
PhysicalDepolarizing.noise_model_name
PhysicalDepolarizing.strength_gate_operation_noise_channel()
PhysicalDepolarizing.strength_idle_qubit_noise_channel()
PhysicalDepolarizing.strength_idle_qubit_stochastic_noise_channel()
PhysicalDepolarizing.strength_spam_operation_noise_channel()
Quantity
UniformDepolarizing
- topqad_sdk.noiseprofiler.libprotocols package
- Submodules
- topqad_sdk.noiseprofiler.libprotocols.lattice_surgery module
LatticeSurgery
ModelLatticeSurgery
ModelLatticeSurgery.bus_width
ModelLatticeSurgery.distance
ModelLatticeSurgery.enforce_maximum_values()
ModelLatticeSurgery.is_bus_width()
ModelLatticeSurgery.is_distance()
ModelLatticeSurgery.is_logical_observable()
ModelLatticeSurgery.is_measurement_basis()
ModelLatticeSurgery.is_merge_observable()
ModelLatticeSurgery.is_preparation_basis()
ModelLatticeSurgery.is_rounds()
ModelLatticeSurgery.logical_observable
ModelLatticeSurgery.measurement_basis
ModelLatticeSurgery.merge_observable
ModelLatticeSurgery.model_config
ModelLatticeSurgery.preparation_basis
ModelLatticeSurgery.rounds
ModelLatticeSurgery.valid_combination()
validate_observable()
- topqad_sdk.noiseprofiler.libprotocols.magic_state_preparation_hook_injection module
MagicStatePreparationHookInjection
MagicStatePreparationHookInjection.add_instance()
MagicStatePreparationHookInjection.fit_options
MagicStatePreparationHookInjection.includes_postselection
MagicStatePreparationHookInjection.protocol_category
MagicStatePreparationHookInjection.protocol_name
MagicStatePreparationHookInjection.protocol_parameters
MagicStatePreparationHookInjection.protocol_subcategory
ModelMagicStatePreparationHookInjection
ModelMagicStatePreparationHookInjection.check_distances()
ModelMagicStatePreparationHookInjection.d_1
ModelMagicStatePreparationHookInjection.d_2
ModelMagicStatePreparationHookInjection.enforce_maximum_values()
ModelMagicStatePreparationHookInjection.inject_state
ModelMagicStatePreparationHookInjection.is_distance()
ModelMagicStatePreparationHookInjection.is_inject_state()
ModelMagicStatePreparationHookInjection.is_round()
ModelMagicStatePreparationHookInjection.model_config
ModelMagicStatePreparationHookInjection.r_2
- topqad_sdk.noiseprofiler.libprotocols.magic_state_preparation_rep_code module
MagicStatePreparationRepCode
MagicStatePreparationRepCode.add_instance()
MagicStatePreparationRepCode.fit_options
MagicStatePreparationRepCode.includes_postselection
MagicStatePreparationRepCode.protocol_category
MagicStatePreparationRepCode.protocol_name
MagicStatePreparationRepCode.protocol_parameters
MagicStatePreparationRepCode.protocol_subcategory
ModelMagicStatePreparationRepCode
ModelMagicStatePreparationRepCode.distances
ModelMagicStatePreparationRepCode.enforce_maximum_values()
ModelMagicStatePreparationRepCode.inject_state
ModelMagicStatePreparationRepCode.is_distances()
ModelMagicStatePreparationRepCode.is_inject_state()
ModelMagicStatePreparationRepCode.is_rounds()
ModelMagicStatePreparationRepCode.model_config
ModelMagicStatePreparationRepCode.rounds
- topqad_sdk.noiseprofiler.libprotocols.memory module
- topqad_sdk.noiseprofiler.libprotocols.models module
CodeModel
CodeName
FitDataModel
FitParametersModel
PlotParametersModel
ProtocolName
ProtocolSpecificationModel
ProtocolSpecificationModel.code
ProtocolSpecificationModel.fits
ProtocolSpecificationModel.model_config
ProtocolSpecificationModel.noise_models
ProtocolSpecificationModel.plots
ProtocolSpecificationModel.protocol_category
ProtocolSpecificationModel.protocol_name
ProtocolSpecificationModel.protocol_subcategory
ProtocolSpecificationModel.simulation_parameters
ProtocolSpecificationModel.simulation_table
ProtocolSpecificationModel.stabilization_times
SimulationParametersModel
StabilizationTime
- topqad_sdk.noiseprofiler.libprotocols.protocol_handler module
FitSpecification
ProtocolHandler
ProtocolHandler.add_instance()
ProtocolHandler.add_noise_model()
ProtocolHandler.execute_simulation()
ProtocolHandler.fit_data()
ProtocolHandler.fit_options
ProtocolHandler.includes_postselection
ProtocolHandler.plot()
ProtocolHandler.protocol_category
ProtocolHandler.protocol_name
ProtocolHandler.protocol_parameters
ProtocolHandler.protocol_subcategory
ProtocolHandler.set_simulation_parameters()
u_format()
- topqad_sdk.noiseprofiler.libprotocols.stability module
- Module contents
LatticeSurgery
LatticeSurgery.add_instance()
LatticeSurgery.fit_data()
LatticeSurgery.fit_options
LatticeSurgery.includes_postselection
LatticeSurgery.noise_models
LatticeSurgery.protocol_category
LatticeSurgery.protocol_name
LatticeSurgery.protocol_parameters
LatticeSurgery.protocol_subcategory
LatticeSurgery.simulation_table
LatticeSurgery.valid_observables
MagicStatePreparationHookInjection
MagicStatePreparationHookInjection.add_instance()
MagicStatePreparationHookInjection.fit_options
MagicStatePreparationHookInjection.includes_postselection
MagicStatePreparationHookInjection.noise_models
MagicStatePreparationHookInjection.protocol_category
MagicStatePreparationHookInjection.protocol_name
MagicStatePreparationHookInjection.protocol_parameters
MagicStatePreparationHookInjection.protocol_subcategory
MagicStatePreparationHookInjection.simulation_table
MagicStatePreparationRepCode
MagicStatePreparationRepCode.add_instance()
MagicStatePreparationRepCode.fit_options
MagicStatePreparationRepCode.includes_postselection
MagicStatePreparationRepCode.noise_models
MagicStatePreparationRepCode.protocol_category
MagicStatePreparationRepCode.protocol_name
MagicStatePreparationRepCode.protocol_parameters
MagicStatePreparationRepCode.protocol_subcategory
MagicStatePreparationRepCode.simulation_table
Memory
Stability
Submodules
topqad_sdk.noiseprofiler.fit module
- topqad_sdk.noiseprofiler.fit.convert_sympy_formula_to_numpy_func(formula: str, scale: str = 'linear')[source]
Convert a sympy formula string to a numerical function.
- Parameters:
formula (str) – The sympy formula string. Should only use functions available in numpy.
scale (str) – If ‘linear’ formula is computed as is. If ‘log’ the log of the formula is computed.
- Returns:
A function that computes the input formula.
- Return type:
Callable
- topqad_sdk.noiseprofiler.fit.fit_data(xs: list[float], ys: list[float], es: list[float], fit_ansatz: Callable, fit_param_bounds: tuple[list, list], fit_y_scale: str, SNR_threshold: float = 5, Abs_threshold: float = inf, verbose: bool = False) tuple[Variable, ...] [source]
Fit given data using the given ansatz.
Uses scipy’s curve_fit with method=’trf’.
- Parameters:
xs (list[float]) – The independent variable data.
ys (list[float]) – The dependent variable data.
es (list[float]) – The uncertainity in the dependent variable.
fit_ansatz (Callable) – The fit function.
fit_param_bounds (tuple[list, list]) – The bounds for the fit parameters.
fit_y_scale (str) – Either ‘linear’ or ‘log’. If ‘log’ then ys is scaled to log(ys) before fit.
SNR_threshold (float, optional) – The signal-to-noise threshold below which data is discarded. Defaults to 5.
Abs_threshold (float, optional) – The error rate above which the data is discarded. Defaults to infinity.
verbose (bool, optional) – Whether to print info. Defaults to False.
- Raises:
ValueError – If xs, ys and es don’t have the same length.
ValueError – If at least two points not provided, or less than two points remain after filtering.
- Returns:
- The fit parameters as uncertainities Variable types. Use p.nominal_value and p.std_dev to
access the stored values.
- Return type:
tuple[Variable, …]
topqad_sdk.noiseprofiler.models module
- class topqad_sdk.noiseprofiler.models.BackendSimulationParametersModel(*, num_workers: int)[source]
Bases:
BaseModel
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- num_workers: int
- class topqad_sdk.noiseprofiler.models.ProtocolSpecificationListModel(*, protocols: list[ProtocolSpecificationModel])[source]
Bases:
BaseModel
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- protocols: list[ProtocolSpecificationModel]
- class topqad_sdk.noiseprofiler.models.RequestResponseModel(*, protocols: list[ProtocolSpecificationModel], backend_simulation_parameters: BackendSimulationParametersModel | None = None, simulation_run_information: SimulationRunInformation | None = None)[source]
Bases:
BaseModel
- backend_simulation_parameters: BackendSimulationParametersModel | None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- protocols: list[ProtocolSpecificationModel]
- simulation_run_information: SimulationRunInformation | None
- class topqad_sdk.noiseprofiler.models.SimulationRunInformation(*, system: str, python_version: str, noiseprofiler_version: str, execution_time: int, report_generation_time: str)[source]
Bases:
BaseModel
- execution_time: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- noiseprofiler_version: str
- python_version: str
- report_generation_time: str
- system: str
topqad_sdk.noiseprofiler.qre_noiseprofile module
Create the noise profile needed to perform qre.
- topqad_sdk.noiseprofiler.qre_noiseprofile.noise_profile_from_preset(preset_name: str)[source]
Load a precomputed noise profile appropriate for quantum resource estimation.
- Parameters:
preset_name (str) – The name of the noise profile to load. Options include - “physical_depolarizing_baseline” - “physical_depolarizing_baseline_throughput_matched” - “physical_depolarizing_baseline_logical_time_matched” - “physical_depolarizing_target” - “physical_depolarizing_target_throughput_matched” - “physical_depolarizing_target_logical_time_matched” - “physical_depolarizing_desired” - “physical_depolarizing_desired_throughput_matched” - “physical_depolarizing_desired_logical_time_matched”
follows (The profiles have decoder reaction times as)
physical_depolarizing_baseline* (-) – parameters associated with existing state-of-the-art hardware.
physical_depolarizing_target* (-) – parameters aligned with near-term research goals.
physical_depolarizing_desired* (-) – an optimistic target for future high-quality devices.
follows
base (-) – a SotA2025 decoder that has high reaction time compared to the logical cycle time.
throughput-matched (-) – the decoder’s throughput matches the logical cycle time. However, the reaction time of the decoder is larger than the logical cycle time.
logical_time_matched (-) – reaction time equal to the logical cycle time.
- Raises:
ValueError – If unknown preset name provided.
- Returns:
A json string with the noise profile.
- Return type:
str
- topqad_sdk.noiseprofiler.qre_noiseprofile.noise_profile_from_protocols(memory: Memory, magic_state_prep: MagicStatePreparationHookInjection | MagicStatePreparationRepCode, lattice_surgery_distance: LatticeSurgery, lattice_surgery_rounds: LatticeSurgery)[source]
Create a noise profile from a set of already computed protocols.
This noise profile can be passed to “qre” to obtain a resource estimate.
Each input object should have enough simulation data in it that the fit_data method outputs the correct fit. The fit_options may be modified for this purpose as well. Before calling this function, make sure that each fit extrapolates well to very low logical error rates.
- Parameters:
memory (Memory) – Perform a memory experiment where the distance is varied.
magic_state_prep (MagicStatePreparationHookInjection | MagicStatePreparationRepCode) – A magic state prep object where the largest distance of the protocol is varied.
lattice_surgery_distance (LatticeSurgery) – A lattice surgery object where the distance is varied.
lattice_surgery_rounds (LatticeSurgery) – A lattice surgery object where the merge round are varied.
- Raises:
ValueError – If multiple noise models are founds in any of the inputs.
ValueError – If the two lattice surgery have different noise models.
- Returns:
A json string with the noise profile.
- Return type:
str
topqad_sdk.noiseprofiler.simtable module
- class topqad_sdk.noiseprofiler.simtable.FieldHeader(name: str, kind: str, *, full_label: str | None = None, math_symbol: str | None = None, compute_formula: Callable | str | None = None, floatfmt: str = '.2f', intfmt: str = ',', hidden: bool = False)[source]
Bases:
object
- class topqad_sdk.noiseprofiler.simtable.FieldHeaderModel(*, name: str, full_label: str, kind: str | None = None, math_symbol: str | None = None, compute_formula: Callable | str | None = None, floatfmt: str, intfmt: str, hidden: bool)[source]
Bases:
BaseModel
- compute_formula: Callable | str | None
- floatfmt: str
- full_label: str
- intfmt: str
- kind: str | None
- math_symbol: str | None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- class topqad_sdk.noiseprofiler.simtable.SimTable(fields: list[FieldHeader] | list[str])[source]
Bases:
object
This class provides storage for simulation data.
Data is stored in a flat 2D table. Each column is described by a FieldHeader.
- add_col(col_field: ~topqad_sdk.noiseprofiler.simtable.FieldHeader | str, formula: ~collections.abc.Callable = <function SimTable.<lambda>>)[source]
Add col to the sim table
- Parameters:
col_field (Field | str) – The column field.
formula (Callable, optional) – The formula to use to compute the data in the column by operating on each row. Defaults to lambda s: “?”.
- add_row(**kwargs)[source]
Add a row of data.
If any columns are missing, a “?” is added instead.
- Raises:
AttributeError – If data for unknown column is provided.
- compute_computed_columns(row_ind: int | None = None) None [source]
Compute the value of all columns with computed kind in the table.
Columns are computed in turn from left to rigth.
- Parameters:
row_ind (int | None, optional) – Only compute the specified row. Defaults to None.
- create_empty_copy() SimTable [source]
Create a new empty SimTable with the same field headers as this table.
- Returns:
A new SimTable instance with identical field headers but no data rows.
- Return type:
- classmethod create_from_function_parameters(func: Callable)[source]
Return a list of parameter names for a function, excluding *args and **kwargs parameters.
- Parameters:
func (Callable) – Function whose parameters to extract.
- data() list [source]
If database is a single column, return data as list.
- Raises:
ValueError – If self has multiple columns.
- Returns:
The list of values in the column.
- Return type:
list
- filter(condition: ~collections.abc.Callable = <function SimTable.<lambda>>) SimTable [source]
Output a table filtered by the condition.
- Parameters:
condition (Callable, optional) – A lambda function that determines if row should be in output. Defaults to
s (lambda) – True.
- Returns:
The filtered rows.
- Return type:
- classmethod from_json(json_str: str) SimTable [source]
Create a SimTable instance from a json string.
- Parameters:
json_str (str) – json string
- Returns:
A new SimTable instance populated from the json.
- Return type:
- get_field_names_of_kind(kind: str) list [source]
Get all field names of a particular kind.
- Parameters:
kind (str) – The kind to search for.
- Returns:
List of field names that match the kind.
- Return type:
list
- group(condition: ~collections.abc.Callable = <function SimTable.<lambda>>)[source]
Output a dictionary of simtables specified by the condition.
- Parameters:
condition (Callable, optional) – Condition to group by that is applied to each row.
- Returns:
The keys of the dictionary are the unique outputs of conditon.
- Return type:
dict[SimTable]
- sort_by(column: str, reverse: bool = False, key: Callable = None) None [source]
Sort the table by a particular column inplace.
- Parameters:
column (str) – The name of the column to sort by
reverse (bool, optional) – Whether to sort in descending order. Defaults to False.
key (Callable, optional) – A function that takes a value and returns a sort key. If None, values are compared directly. Defaults to None.
- Raises:
ValueError – If the specified column doesn’t exist in the table
- to_json() str [source]
Convert the SimTable to json.
- Returns:
The json representation of the table.
- Return type:
str
- to_model() SimTableModel [source]
- class topqad_sdk.noiseprofiler.simtable.SimTableModel(*, FieldHeaders: list[FieldHeaderModel], data: list[dict[str, Any]])[source]
Bases:
BaseModel
- FieldHeaders: list[FieldHeaderModel]
- data: list[dict[str, Any]]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
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]
Bases:
object
Contains all information to specify a fit for a given class of curves.
- Parameters:
fit_ansatz (Callable) – The fit function.
param_bounds (tuple[list, list]) – The parameter bounds.
y_scale (str) – Either ‘linear’ or ‘log’.
fit_ansatz_latex (str) – The latex description of the fit function. Use raw strings.
Examples
- 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}}}}”, )
- 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]
Bases:
BaseModel
A basic quantity with a value and unit.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- 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