twpasolver.analysis.core module#
TWPAnalysis: the interface for simulating a TWPA.
- pydantic model twpasolver.analysis.core.TWPAnalysis[source]#
Bases:
BaseModelInterface for simulating a TWPA with coupled mode equations (CMEs).
Frequencies are given and reported in
unit; the solvers work in Hz. The linear response is computed on demand (linear) and recomputed whentwpa,freqsorunitchange; analysis methods return their results without storing them.Show JSON schema
{ "title": "TWPAnalysis", "description": "Interface for simulating a TWPA with coupled mode equations (CMEs).\n\nFrequencies are given and reported in ``unit``; the solvers work in Hz. The\nlinear response is computed on demand (:attr:`linear`) and recomputed when\n``twpa``, ``freqs`` or ``unit`` change; analysis methods return their results\nwithout storing them.", "type": "object", "properties": { "twpa": { "$ref": "#/$defs/TWPA" }, "freqs": { "anyOf": [ { "maxItems": 3, "minItems": 3, "prefixItems": [ { "minimum": 0, "type": "number" }, { "minimum": 0, "type": "number" }, { "exclusiveMinimum": 0, "type": "number" } ], "type": "array" }, { "items": { "minimum": 0, "type": "number" }, "type": "array" } ], "description": "Frequency grid of the linear response, in ``unit``: a tuple ``(start, stop, step)`` passed to ``numpy.arange``, or a list or array of frequencies. Stored as the explicit list.", "title": "Freqs" }, "unit": { "default": "GHz", "enum": [ "Hz", "kHz", "MHz", "GHz", "THz" ], "title": "Unit", "type": "string" }, "ports": { "$ref": "#/$defs/Ports" } }, "$defs": { "Ports": { "additionalProperties": false, "description": "Connectors at the device ends and the impedance of the external lines.\n\nPort 1 of a connector faces the external line, port 2 the TWPA. Without\nconnectors the device is joined directly to lines of impedance ``Z_ext``.", "properties": { "input": { "default": null, "description": "Connector (``TwoPortModel``) at x=0; also used at x=L when ``output`` is None.", "title": "Input" }, "output": { "default": null, "description": "Connector at x=L.", "title": "Output" }, "Z_ext": { "default": 50.0, "description": "Impedance of the external lines (e.g. the fridge coaxial lines).", "title": "Z Ext", "type": "number" } }, "title": "Ports", "type": "object" }, "TWPA": { "description": "Simple model for TWPAs.", "properties": { "Z0_ref": { "default": 50.0, "description": "Reference line impedance of the two-port component.", "title": "Z0 Ref", "type": "number" }, "N": { "default": 1, "description": "Number of repetitions of the model in the computed abcd matrix.", "minimum": 0, "title": "N", "type": "integer" }, "cells": { "description": "List of TwoPortModels representing the basic cells. Nested lists are allowed.", "items": {}, "title": "Cells", "type": "array" }, "name": { "const": "TWPA", "default": "TWPA", "title": "Name", "type": "string" }, "Istar": { "default": 0.0065, "description": "Nonlinearity scale current parameter.", "minimum": 0, "title": "Istar", "type": "number" }, "Istar2": { "anyOf": [ { "minimum": 0, "type": "number" }, { "type": "null" } ], "default": null, "description": "Second order scaling current parameter.", "title": "Istar2" }, "Idc": { "default": 0.001, "description": "Bias dc current.", "minimum": 0, "title": "Idc", "type": "number" }, "Ip0": { "default": 0.0002, "description": "Rf pump amplitude.", "minimum": 0, "title": "Ip0", "type": "number" } }, "title": "TWPA", "type": "object" } }, "additionalProperties": false, "required": [ "twpa", "freqs" ] }
- Fields:
- Validators:
- field freqs: tuple[typing.Annotated[float, Ge(ge=0)], typing.Annotated[float, Ge(ge=0)], typing.Annotated[float, Gt(gt=0)]] | list[typing.Annotated[float, Ge(ge=0)]] [Required]#
Frequency grid of the linear response, in
unit: a tuple(start, stop, step)passed tonumpy.arange, or a list or array of frequencies. Stored as the explicit list.- Validated by:
_expand_grid
- property f: ndarray#
Frequency grid in Hz.
- property linear: LinearData#
Linear response on the grid, recomputed when
twpa,freqsorunitchange.
- response(connectors: bool = True) TwoPortCell[source]#
Linear two-port response of the device on the grid (
.s.S21,.abcd, …).With
connectorsthe connectors ofportsare cascaded at both ends (the output one reversed: its port 2 faces the device) and the parameters refer toports.Z_ext, as theblochgains do; otherwise the bare device, referred totwpa.Z0_refas inlinear.
- problem(modes: str | ModeSet, tones: Mapping[str, Any]) CMEProblem[source]#
CME inputs of
modesat the frequencies set by the independenttones.- Parameters:
modes – A
ModeSetor"basic_3wm"/"basic_4wm".tones – Frequency of every independent mode, in
unit(scalars or arrays of one length).
- phase_matching(signal_freqs: Tuple[float, float, float] | List[float] | ndarray, pump_freqs: Tuple[float, float, float] | List[float] | ndarray, process: Literal['PA', 'FCU', 'FCD'] = 'PA', mixing: Literal['3WM', '4WM'] = '3WM', modes: str | ModeSet = 'basic_3wm', signal_mode: str = 's', pump_mode: str = 'p', idler_mode: str = 'i', tones: Mapping[str, float] | None = None, pump_Ip0: float | None = None, relative: bool = True) PhaseMatchingResult[source]#
Phase mismatch of a 3WM or 4WM process over pump and signal frequencies.
- Parameters:
signal_freqs – A tuple
(start, stop, step)passed tonumpy.arange, or the explicit frequencies.pump_freqs – A tuple
(start, stop, step)passed tonumpy.arange, or the explicit frequencies.process –
"PA"(amplification),"FCU"or"FCD"(up/down conversion); the idler frequency is the onemodesgivesidler_mode.mixing –
"3WM"or"4WM".tones – Frequencies of further independent modes of
modes.pump_Ip0 – Pump current of the Kerr term; None uses
twpa.Ip0, 0 gives the linear mismatch.relative – Divide the mismatch by the signal wavenumber.
optimal_pump_freqof the result is the pump with the smallest mean|delta|over the signals, so restrict them to the band of interest; pumps inside a stopband get NaN and are never chosen. Segmented devices give the length-weighted mean of the per-segment mismatch.
- gain(signal_freqs: Tuple[float, float, float] | List[float] | ndarray, pump: float, Is0: float = 1e-07, Ip0: float | None = None, model: str | GainModel = GainModel.SIMPLE, modes: str | ModeSet = 'basic_3wm', signal_mode: str = 's', pump_mode: str = 'p', tones: Mapping[str, float] | None = None, initial_amplitudes_fwd: List[float] | ndarray | None = None, initial_amplitudes_bwd: List[float] | ndarray | None = None, thin: int = 50, bloch_config: BlochSolverConfig | None = None, rk_config: RKSolverConfig | None = None) GainResult[source]#
Gain of the TWPA from the coupled mode equations.
- Parameters:
signal_freqs – Signal frequencies, in
unit: a tuple(start, stop, step)passed tonumpy.arange, or the explicit frequencies.pump – Pump frequency. There is no automatic choice; for an estimate use
phase_matching(...).optimal_pump_freq.Is0 – Signal current amplitude injected at x=0 (A).
Ip0 – Pump current amplitude injected at x=0 (A); defaults to
twpa.Ip0. From a power in dBm usetwpasolver.mathutils.dBm_to_I(P_dBm, Z0=twpa.Z0_ref).model –
"simple"(forward-only textbook CMEs, no reflections or connectors) or"bloch"(forward-backward CMEs in the Bloch basis with exact couplings and boundaries); seeGainModel.modes – A
ModeSetor"basic_3wm"/"basic_4wm".signal_mode – Independent modes swept over
signal_freqsand set topump.pump_mode – Independent modes swept over
signal_freqsand set topump.tones – Frequencies of further independent modes (e.g. a second pump).
initial_amplitudes_fwd – Currents of every mode incident at x=0 and at x=L, shape (n_modes,) or (n_freq, n_modes);
initial_amplitudes_fwdoverridesIs0andIp0. Backward inputs need"bloch".initial_amplitudes_bwd – Currents of every mode incident at x=0 and at x=L, shape (n_modes,) or (n_freq, n_modes);
initial_amplitudes_fwdoverridesIs0andIp0. Backward inputs need"bloch".thin – Approximate spacing in unit cells of the stored positions:
N_tot // thinpoints (at least two), evenly spaced and including both ends.blochiterates its envelopes on this grid (plus segment edges), so it also sets their interpolation accuracy.bloch_config – Settings of
"bloch"(defaultBlochSolverConfig()).rk_config – Settings of the RK45 integrator (default
RKSolverConfig()).