twpasolver.modes_rwa module#
Modes, frequency relations and rotating-wave-approximation (RWA) terms.
A ModeSet lists the modes of a coupled-mode-equation (CME) system,
beyond pump, signal and idler (pump harmonics p2, conversion terms ps,
signal/idler harmonics s2, …), and the relations fixing their frequencies.
A relation such as ["i", "p-s"] sets a mode to a sum or difference of other
modes, so every mode frequency is an integer combination of the independent
tones (the modes no relation defines, any number of them). The RWA terms of a
given order are the products of modes and conjugates whose combinations add up
to a mode, found exactly on these integer vectors.
Examples
See Tutorial 4 (Tutorials) for standard and custom mode sets and RWA term analysis.
- class twpasolver.modes_rwa.ModeSet(labels: Tuple[str, ...], relations: Tuple[Tuple[str, str], ...] = ())[source]#
Bases:
objectModes of a CME system and the frequency relations between them.
- Parameters:
labels – Mode names; their order is the order of the CME amplitudes.
relations –
[result, expression]pairs, e.g.["i", "p-s"]; an expression is a sum or difference of mode names (repetitions allowed,"p+p-s"). A mode is defined by at most one relation; relations must not be cyclic.
- Variables:
independent (Tuple[str, ...]) – Modes not defined by any relation (the independent tones).
matrix (numpy.ndarray) – Integer coefficients of every mode over
independent, shape (n_modes, n_independent).
- matrix: ndarray#
- classmethod basic(three_wave: bool = True) ModeSet[source]#
Pump, signal and idler, with
i = p - s(3WM) ori = 2p - s(4WM).
- classmethod extended_3wm(n_pump_harmonics: int = 1, n_frequency_conversion: int = 1, n_signal_harmonics: int = 0, n_sideband_conversion: int = 0) ModeSet[source]#
3WM pump, signal and idler with pump harmonics, conversion terms and sidebands.
Every signal order
mgives the harmonicm sand its 3WM idlerp - m s, labelleds{m}andi{m}, and their conversion chainn p + m sand(n + 1) p - m s, labelledp{n}s{m}andp{n}i{m}(mandnare left out when 1). Orderm = 1is the signal and idler themselves:s,i,ps,pi,p2s, …; order 2 givess2(2s),i2(p - 2s),ps2(p + 2s),pi2(2p - 2s), …The sidebands (
m >= 2) are second or higher order in the signal: they leave the small-signal gain unchanged and matter in compression. The idlerp - m scrosses 0 Hz ats = p / m, so keep the signals on one side of it (a mode below the frequency grid raises).- Parameters:
n_pump_harmonics – Number of pump harmonics (p2, p3, …).
n_frequency_conversion – Largest pump order
nof the conversion chain of the signal and idler (ps/pi, p2s/p2i, …).n_signal_harmonics – Number of sideband orders
m = 2, 3, ...(s2/i2, s3/i3, …).n_sideband_conversion – Largest pump order
nof the conversion chain of every sideband order (ps2/pi2, p2s2/p2i2, …).
- frequencies(tones: Mapping[str, float | ndarray]) ndarray[source]#
Frequencies of every mode, shape (n_modes, …), from the independent tones.
- Parameters:
tones – Frequency of every independent mode, scalars or arrays that broadcast together; extra keys raise.
- rwa_terms(power: int) list[tuple[Any, ...]][source]#
RWA terms with
powermode factors (2 for 3WM, 3 for 4WM).- Returns:
Tuples
(mode_idx, combination, mode_name, rhs_terms, coefficient)sorted bymode_idx: the termprod(combination)drives modemode_idx; indices incombinationat or above the number of modes are conjugated modes;coefficientis1 / prod(n_r!)over repeated factors.
- plot_relations(tones: Mapping[str, float] | None = None, figsize: Tuple[float, float] | None = None, node_size: int = 3000, font_size: int = 12, layout: str = 'hierarchical') Figure[source]#
Plot the relations between modes as a directed graph.
- Parameters:
tones – Independent tones; if given, nodes show the mode frequencies.
figsize – Figure size (width, height); None sizes it to the graph.
node_size – Size of mode nodes.
font_size – Font size for labels.
layout – Graph layout (‘hierarchical’, ‘circular’ or ‘spring’).