Raman cascade (CW) and RIN transfer¶
Continuous-wave multi-order Raman cascade, its conservation diagnostics, and the linearized relative-intensity-noise transfer function. Provenance-checked benchmark fixtures for Mermelstein 2003, Keita 2006 and Zhu 2007. Docstrings are the source of truth, rendered with mkdocstrings (numpydoc style).
See Raman cascade: power flow and RIN transfer for the physics, the unit conventions and which published targets reproduce.
photonics_helper.raman_transfer ¶
Raman RIN transfer analytics: closed forms and the continuous-wave cascade.
This module answers a narrow question with as little machinery as possible: how does relative intensity noise from a pump laser appear at the signal of a Raman amplifier, and how does that transfer function depend on fiber loss, gain, length, dispersion, and geometry?
Three published results pin the answer down exactly, and all three are implemented here so that a regression in the physics fails the test suite rather than the paper.
Keita et al. 2006, JOSA B 23(12) 2479, doi 10.1364/JOSAB.23.002479
.. math::
\sigma_{\mathrm{dB}} = \frac{20}{\ln 10}
\ln\!\left[\frac{\ln\!\left(10^{g_{\mathrm{net}}/20}\right)}{\alpha_p}
+ \frac{\alpha_s L}{2}\right]
is the low-frequency transfer for a single pump, Keita Eq. 4.7. Note that the paper defines
:math:\sigma_{\mathrm{dB}} = 10\ln(\sigma)/\ln 10, a power ratio, which differs
from the amplitude convention :math:20\log_{10} used elsewhere in this library. The
loss-coefficient units must therefore be consistent with the paper. Their Eq. 4.9 and
Eq. 4.10 give the full co- and counter-propagating expressions including the walk-off term
:math:\Delta_k.
Zhu, Zhang, Zhang 2007, JLT 25(6) 1458, doi 10.1109/JLT.2007.895532
.. math::
|H(f)|^2 = \frac{[\ln G_R]^2\,(V_s/L_{\mathrm{eff}})^2}
{(\alpha_p V_s)^2 + (4\pi f)^2}
is the single-pump frequency-dependent transfer, Zhu Eq. 7, implying a DC level of
:math:\ln G_R/(\alpha_p L_{\mathrm{eff}}) and a corner at :math:\alpha_p V_s/(4\pi).
Mermelstein, Brar, Headley 2003, JLT 21(6) 1518, doi 10.1109/JLT.2003.812461
solve the full dual-order continuous-wave cascade: three coupled steady-state power equations plus six complex modulation-index equations, integrated as nine ODEs, with the sign of the walk-off term selecting co- or counter-propagating geometry.
Units
Every public function takes quantities in documented SI units and performs no implicit conversion. The loss-coefficient normalization is the single most likely transcription error in this physics, and implicit conversion hides it rather than surfacing it.
Benchmark fixtures
Published targets live under benchmarks/raman_noise/<paper>/fixture.json and are loaded
with :func:load_benchmark. Every numeric entry carries its source, DOI, unit, and whether it
was read from a table, a figure, or running text, so a reader can judge its precision.
Figure-transcribed values are marked kind: "figure" and should not be held to table
precision.
Scope
Amplifier, not laser. Cavity boundaries, above-threshold dynamics, and distributed Rayleigh feedback are out of scope here and are modelled in the later cascade stages. The RIN transfer physics tested by every benchmark in this module lives in the amplifier.
ProvenanceError ¶
Bases: ValueError
A benchmark fixture entry is missing required provenance metadata.
BenchmarkFixture
dataclass
¶
BenchmarkFixture(key: str, citation: str, doi: str, path: Path, data: dict[str, Any])
A loaded benchmark fixture with its provenance metadata intact.
entry ¶
entry(*keys: str) -> dict[str, Any]
Return one provenance-tagged entry, validating it on the way out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*keys
|
str
|
Nested key path, for example |
()
|
is_figure_transcribed ¶
is_figure_transcribed(*keys: str) -> bool
Whether the entry was read by eye from a figure rather than a table.
Geometry ¶
Propagation geometry, which sets the sign of the walk-off term.
Keita 2006 writes Delta_k = [(1/v_p) -/+ (1/v_s)] nu_s with the upper sign for co-propagating and the lower sign for counter-propagating beams. Using the class rather than a raw sign keeps the choice visible at every call site, because an inverted geometry is silent: it produces a plausible curve with the corner frequency wrong by orders of magnitude.
PropagationDirection ¶
Per-channel propagation direction of a multi-pump cascade.
A channel descriptor carries its own direction so that an arbitrary pump set can be
forward, backward, or a mixture, rather than the whole cascade sharing one global
geometry. Zhu 2007's six pumps are backward and its signal is forward; Ma 2012's
laser is co-propagating. Keeping the direction on the channel is what lets the same
:class:RamanChannel describe both.
The values are +1 for forward and -1 for backward, the same sign convention
:class:Geometry uses, so a per-channel direction maps onto the solver's global
geometry without a second translation table.
RamanChannel
dataclass
¶
RamanChannel(index: int, label: str, wavelength: Wavelength, power_w: float, loss_db_per_km: float, gains: tuple[float, ...], group_index: float | None = None, direction: int = PropagationDirection.FORWARD)
One channel of a continuous-wave Raman cascade.
Attributes:
| Name | Type | Description |
|---|---|---|
index |
int
|
Position in the cascade, 1-based, ordered from highest to lowest frequency. |
label |
str
|
Human-readable name, for example |
wavelength |
Wavelength
|
Channel wavelength, as a :class: |
loss_db_per_km |
float
|
Fiber loss at this wavelength, in the usual dB/km convention. Converted to inverse metres internally. |
gains |
tuple[float, ...]
|
Raman gain coefficient to each other channel, in |
group_index |
float | None
|
Group index at this wavelength. Derived from the fiber Sellmeier parameters when
left as |
CascadeResult
dataclass
¶
CascadeResult(z_m: NDArray[float64], powers_w: NDArray[float64], labels: tuple[str, ...], power_balance_drift: float, photon_flux_drift: float = 0.0, signal_reversed: bool = False, length_m: float = 0.0)
Steady-state powers along the cascade.
z_m
instance-attribute
¶
z_m: NDArray[float64]
Sample positions in metres, always ascending from 0 to the span length.
powers_w
instance-attribute
¶
powers_w: NDArray[float64]
Powers with shape (n_positions, n_channels), in channel index order.
labels
instance-attribute
¶
labels: tuple[str, ...]
Channel labels, matching the column order of powers_w.
power_balance_drift
instance-attribute
¶
power_balance_drift: float
Residual of power balance over the span, with the known fiber loss subtracted.
photon_flux_drift
class-attribute
instance-attribute
¶
photon_flux_drift: float = 0.0
Residual of photon-flux balance, sum(P / lambda), with fiber loss subtracted.
Zero to integration tolerance only when the cascade was built with
photon_consistent=True. In the default Mermelstein form this drifts by a few
percent of the transferred power, which is a property of those equations rather than
a solver error; see :func:photon_flux_drift.
signal_reversed
class-attribute
instance-attribute
¶
signal_reversed: bool = False
Whether the signal column runs against the propagation direction.
length_m
class-attribute
instance-attribute
¶
length_m: float = 0.0
Span length in metres, used for the on-off gain loss correction.
output_w
property
¶
output_w: NDArray[float64]
Power of each channel where it leaves the span.
Only the signal is reversed in a counter-propagating cascade; the pumps always
enter at z = 0 and leave at z = L.
raw_gain_db ¶
raw_gain_db() -> NDArray[np.float64]
Raw power gain 10 log10(out/in), including fiber loss.
This is not the figure the literature reports. A channel fed at 780 mW and leaving at 4.7e-4 W looks like -32 dB here even though it converted almost everything it could into the next order; most of the missing power went into fiber attenuation, not into the cascade.
on_off_gain_db ¶
on_off_gain_db(loss_per_m: NDArray[float64]) -> NDArray[np.float64]
On-off gain in dB, that is the raw gain with the fiber loss divided out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loss_per_m
|
NDArray[float64]
|
Loss of each channel in inverse metres, in the same order as
:attr: |
required |
Notes
This is the quantity Mermelstein 2003 quotes as "approximately 13 dB of on/off gain". For the signal that is 13.41 dB here, against 2.67 dB of raw gain, so the distinction is not cosmetic: quoting raw gain would understate the result by more than 10 dB and would not match the paper.
The loss correction uses the channel's own loss over the span it actually traverses, which for a counter-propagating signal is the same span length.
CWWCascade ¶
CWWCascade(channels: Sequence[RamanChannel], length: Length, *, geometry: int = Geometry.COUNTER_PROPAGATING, n_points: int = 601, rtol: float = 1e-09, atol: float = 1e-14, photon_consistent: bool = False, noise_max_iter: int = 60)
Continuous-wave Raman cascade with a linearized noise response.
Implements the dual-order model of Mermelstein, Brar, Headley 2003, JLT 21(6) 1518, doi 10.1109/JLT.2003.812461: three coupled steady-state power equations (their Eqs. 5a to 5c) plus six complex modulation-index equations for the noise response (their Eqs. 6a to 6c), with the walk-off parameter of their Eq. 2 selecting co- or counter-propagating geometry.
Integration order. Mermelstein integrates all nine equations together. This class splits them into passes, because the counter-propagating geometry makes the signal travel against the pump direction, which is a two-point problem rather than an initial-value problem:
- pumps forward from
z = 0toz = L; - the signal steady state, forward for co-propagating and backward from
z = Lfor counter-propagating; - the modulation indices, with
m1andm2following the pumps forward andm3following the signal.
Eq. 5b correction. Mermelstein's Eq. 5b as printed depletes P2 by
gamma_23 * P1 * P3, while their Eq. 5c gains the signal by gamma_23 * P2 * P3.
The same Raman interaction cannot be P1 P3 on one side and P2 P3 on the other,
and their Eqs. 5a and 5c are self-consistent for both other gain pairs. This class
implements the self-consistent - gamma_23 * P2 * P3, which is also the only version
under which the photon-flux conservation diagnostic is meaningful. See the
eq_5_steady_state block in the Mermelstein fixture.
Scope. Amplifier only. No cavity boundaries, no threshold, no distributed Rayleigh feedback.
result
property
¶
result: CascadeResult
The most recent :meth:solve result.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :meth: |
loss_per_m
property
¶
loss_per_m: NDArray[float64]
Loss of each channel in inverse metres, in channel order.
solve ¶
solve(*, max_iter: int = 200, tol: float = 1e-06) -> CascadeResult
Integrate the steady state and return powers versus distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_iter
|
int
|
Iteration cap for the counter-propagating fixed point. Unused for co-propagating, which is a single forward pass. |
200
|
tol
|
float
|
Convergence tolerance on the maximum relative change in signal power. The
iteration converges geometrically with a rate set by the fraction of pump
power drained into the signal, about 0.1 per pass for this configuration. It
then stalls near 6e-8, which is the noise floor of the underlying ODE
integrations at |
1e-06
|
Returns:
| Type | Description |
|---|---|
CascadeResult
|
Powers sampled on an ascending grid from |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If an integration fails or the counter-propagating fixed point does not converge. An unconverged cascade is never returned, because it would look like a physical result. |
Notes
The counter-propagating case is a two-point boundary value problem: pumps are
specified at z = 0 and the signal at z = L. It is solved by fixed-point
iteration between a forward pump pass and a backward signal pass. The iteration
is well conditioned here because the signal is roughly four orders of magnitude
weaker than the pumps, so the loop gain is the fraction of pump power drained into
the signal and is small.
powers_at ¶
powers_at(z_m: float | NDArray[float64]) -> NDArray[np.float64]
Steady-state channel powers at arbitrary positions, shape (..., n_channels).
Requires :meth:solve to have run. This reads the dense interpolant of the
solved system rather than resampling the output grid, so the linearized noise
response sees the same profiles the conservation diagnostics were computed from.
noise_response ¶
noise_response(frequencies_hz: NDArray[float64], source: int = 1) -> NoiseResponse
Complex RIN transfer from one perturbed pump to the signal.
Linearizes Eqs. 5 about the solved steady state and integrates the complex
modulation indices with the source pump launched at m_source = 1. The
returned transfer is m_signal(output) / m_source(launch), the dimensionless
amplitude ratio a 100 percent pump modulation produces at the signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies_hz
|
NDArray[float64]
|
Offset frequencies in Hz, at least two points. |
required |
source
|
int
|
1-based index of the perturbed pump. Mermelstein 2003 Figs. 5 and 6 report the second-order (1) and first-order (2) pump responses separately. |
1
|
Returns:
| Type | Description |
|---|---|
NoiseResponse
|
Frequencies, complex transfer, and amplitude in dB. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :meth: |
modulation_indices ¶
modulation_indices(z_m: NDArray[float64], frequency_hz: float, source: int = 1) -> NDArray[np.complex128]
Complex modulation index of every channel along the span.
This is the same linearized solution :meth:noise_response reads at one point, kept
as a profile so that the spatial build-up of a perturbation can be inspected. It
is what Mermelstein 2003 Fig. 7 plots, and what the interaction-length check
measures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z_m
|
NDArray[float64]
|
Ascending positions in metres. |
required |
frequency_hz
|
float
|
Modulation frequency in Hz. |
required |
source
|
int
|
1-based index of the perturbed pump. |
1
|
Returns:
| Type | Description |
|---|---|
NDArray of complex
|
One row per position, one column per channel, in channel index order. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :meth: |
interaction_length_km ¶
interaction_length_km(frequency_hz: float, *, indirect: bool, threshold: float = 0.37) -> float
Full width at 1/e of the first-order pump's power fluctuation, in km.
Under direct modulation the perturbed pump is the first-order pump itself; under indirect modulation the second-order pump is perturbed and the first-order pump's perturbation is induced through the cascade, which is what Mermelstein 2003 Fig. 7 compares.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency_hz
|
float
|
Modulation frequency in Hz. |
required |
indirect
|
bool
|
|
required |
threshold
|
float
|
Fraction of the peak the fluctuation must fall to, |
0.37
|
Returns:
| Type | Description |
|---|---|
float
|
Distance in kilometres between the rising and falling crossings of
|
Notes
Two details matter and both were wrong in the first implementation.
Absolute, not relative. Mermelstein's Fig. 7 plots the 1465 nm pump power
fluctuation dP_2 in milliwatts, not the relative modulation index m_2.
The first-order pump is amplified along the span, so dP_2 = m_2 P_2 rises as
the pump grows even where m_2 is flat, and the two have their peaks at
different positions. Measuring the relative index puts the direct peak at
z = 0 and gives 17.4 km; measuring the absolute fluctuation puts it at the
pump-power maximum and gives the published 20.5 km.
Full width, not distance from the peak. The figure's two arrows span both the
rising and the falling 1/e crossing. For the indirect case the fluctuation is
still above 1/e of its peak at z = L, so a distance-from-peak measurement
never terminates; the full width does.
This is a mechanism check, not a fitted quantity. It is worth having because a model that gets the corner frequencies right by construction, rather than through walk-off and spatial averaging, produces the two lengths in the wrong order.
NoiseResponse
dataclass
¶
NoiseResponse(frequencies_hz: NDArray[float64], transfer: NDArray[complex128], db: NDArray[float64], source: int)
Frequency-dependent RIN transfer from one perturbed pump to the signal.
transfer
instance-attribute
¶
transfer: NDArray[complex128]
Complex modulation-index ratio m_signal / m_source at the signal output.
db
instance-attribute
¶
db: NDArray[float64]
20 log10 |transfer|, the amplitude convention used by Mermelstein 2003.
double_pole ¶
double_pole() -> tuple[float, float]
Fit :func:double_pole_fit to this response and return (dc_db, corner_hz).
db_from_linear ¶
db_from_linear(rho: float | NDArray[float64], *, amplitude: bool = True) -> float | NDArray[np.float64]
Convert a linear power ratio to decibels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rho
|
float | NDArray[float64]
|
Linear ratio. For RIN transfer this is a variance ratio, so pass
|
required |
amplitude
|
bool
|
|
True
|
effective_length ¶
effective_length(alpha_per_m: float, length: Length) -> Length
Effective interaction length (1 - exp(-alpha L)) / alpha, as a :class:Length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha_per_m
|
float
|
Loss in inverse metres. |
required |
length
|
Length
|
Physical length. |
required |
Notes
Computed as -expm1(-alpha L) / alpha rather than
(1 - exp(-alpha L)) / alpha, because 1 - exp(-x) cancels
catastrophically for small x and a low-loss Raman amplifier is exactly that case.
walk_off_parameter ¶
walk_off_parameter(inv_v_pump: float, inv_v_signal: float, offset_hz: float, geometry: int = Geometry.COUNTER_PROPAGATING) -> float
First-order walk-off term Delta_k of Keita 2006.
.. math::
\Delta_k^{(1)} = \left[\frac{1}{v_p} \mp \frac{1}{v_s}\right]\nu_s
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inv_v_pump
|
float
|
Inverse group velocities, in inverse velocity. |
required |
inv_v_signal
|
float
|
Inverse group velocities, in inverse velocity. |
required |
offset_hz
|
float
|
The modulation frequency :math: |
required |
geometry
|
int
|
:data: |
COUNTER_PROPAGATING
|
rin_transfer_monochromatic_pump ¶
rin_transfer_monochromatic_pump(gain_coefficient: float, alpha_p: float, delta_k: float, length: float, geometry: int = Geometry.COUNTER_PROPAGATING) -> float
RIN transfer for a modulated monochromatic pump, Keita 2006 Eq. 4.5.
.. math::
\rho = \frac{G^2}{\Delta_k^2 + \alpha_p^2}
\left\{1 - 2\cos(\Delta_k L)\exp(-\alpha_p L)
+ \exp(-2\alpha_p L)\right\}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gain_coefficient
|
float
|
Raman gain coefficient :math: |
required |
alpha_p
|
float
|
Pump loss in inverse length. |
required |
delta_k
|
float
|
Walk-off term from :func: |
required |
length
|
float
|
Length, matching the inverse-length units above. |
required |
geometry
|
int
|
Unused. The geometry is carried entirely by the sign of |
COUNTER_PROPAGATING
|
Returns:
| Type | Description |
|---|---|
float
|
Linear transfer ratio :math: |
rin_transfer_low_frequency ¶
rin_transfer_low_frequency(gain_coefficient: float, alpha_p: float, length: float) -> float
Low-frequency RIN transfer, Keita 2006 Eq. 4.6.
This is the exact limit of :func:rin_transfer_monochromatic_pump as
:math:\Delta_k \to 0, obtained by writing
:math:1 - 2 e^{-\alpha_p L} + e^{-2\alpha_p L} = (1 - e^{-\alpha_p L})^2.
.. math::
\rho = \left(\frac{G}{\alpha_p}\right)^2
\left[1 - \exp(-\alpha_p L)\right]^2
rin_transfer_from_net_gain ¶
rin_transfer_from_net_gain(g_net_db: float, alpha_p: float, length: float) -> float
Low-frequency RIN transfer against net gain, Keita 2006 Eq. 4.7.
.. math::
\rho_{\mathrm{dB}} = \frac{20}{\ln 10}
\ln\!\left[\frac{\ln 10}{20}\,g_{\mathrm{net}} + \frac{\alpha_p L}{2}\right]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
g_net_db
|
float
|
The paper's net gain in dB, which includes pump depletion. Note this is
not |
required |
alpha_p
|
float
|
Pump loss in inverse length. |
required |
length
|
float
|
Length, matching |
required |
Returns:
| Type | Description |
|---|---|
float
|
The transfer in decibels, using the paper's power convention |
rin_transfer_dispersion ¶
rin_transfer_dispersion(gain_coefficient: float, alpha_p: float, delta_k: float, length: float, geometry: int = Geometry.COUNTER_PROPAGATING) -> float
Alias selecting Eq. 4.9 or Eq. 4.10 by geometry.
Keita 2006 prints the two geometries as separate equations, Eq. 4.9 for
co-propagating and Eq. 4.10 for counter-propagating. These describe the
large-bandwidth pump case and are distinct from Eq. 4.5, which covers a
modulated monochromatic pump. Here gain_coefficient is the Raman gain
coefficient in inverse length, as printed.
.. note::
Eq. 4.9 and Eq. 4.10 describe the response when the pump bandwidth is much
smaller than the Raman linewidth, which is the regime where the walk-off term
:math:\Delta_k alone shapes the response. Keita 2006 Eq. 4.8 states the
approximation requires a propagation distance much greater than
2 pi / ((1/v_p -/+ 1/v_s) Delta_nu_p), which is 1e-7 km for
counter-propagating beams at a 10 nm pump linewidth but 3e-3 km for
co-propagating beams even at D = 2 ps/(nm km). It is not satisfied for
a 1 km fiber pumped by a 0.1 nm bandwidth source.
single_pump_transfer ¶
single_pump_transfer(f_hz: NDArray[float64], g_on_off_db: float, alpha_p: float, v_signal: float, l_eff: float) -> NDArray[np.float64]
Analytical RIN transfer for a single-pump amplifier, Zhu 2007 Eq. 7.
.. math::
|H(f)|^2 = \frac{[\ln G_R]^2\,(V_s/L_{\mathrm{eff}})^2}
{(\alpha_p V_s)^2 + (4\pi f)^2}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_hz
|
NDArray[float64]
|
Offset frequency array, in Hz. |
required |
g_on_off_db
|
float
|
On-off Raman gain in dB, as a power ratio, so the linear gain is
|
required |
alpha_p
|
float
|
Fiber loss at the pump wavelength, in inverse length. |
required |
v_signal
|
float
|
Group velocity at the signal wavelength. |
required |
l_eff
|
float
|
Effective fiber length at the pump wavelength, from :func: |
required |
Notes
This is the squared magnitude :math:|H(f)|^2, so the DC level of the amplitude
transfer is :math:\\ln(G_R)/(\\alpha_p L_{\\mathrm{eff}}) and that of
:math:|H|^2 is its square. Take the square root before converting to dB if you
want amplitude decibels. Use :func:single_pump_corner_frequency for the corner
rather than re-deriving it.
single_pump_corner_frequency ¶
single_pump_corner_frequency(alpha_p: float, v_signal: float) -> float
Corner frequency of Zhu 2007 Eq. 7, alpha_p * V_s / (4 pi), in Hz.
group_index ¶
group_index(wavelength_nm: float, group_index_zero: float, slope_ps_per_km_nm2: float, lambda0_nm: float) -> float
Group index from the zero-dispersion wavelength and the dispersion slope.
Uses :math:dn_g/d\lambda = c\,D(\lambda) with
:math:D(\lambda) = S_0(\lambda-\lambda_0), which integrates to
.. math::
n_g(\lambda) = n_{g,0} + \frac{c S_0}{2}(\lambda-\lambda_0)^2
.. note::
Mermelstein 2003 prints n_i = n_0 + (S_0/8) (lambda_i - lambda_0^2/lambda_i)^2.
That form is dimensionally inconsistent, because the bracket carries units of
length squared while the dispersion slope carries time per length cubed, so an
implicit conversion must be hiding in the printed expression. Substituting
Table I directly gives a group index of 2293, which is not a physical value.
The relation implemented here is the one derived from
:math:D = -(\lambda/c)\,d^2n/d\lambda^2 and gives 1.46681 at 1560 nm,
consistent with the standard single-mode value near 1.468 at 1550 nm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength_nm
|
float
|
Evaluation wavelength, in nm. |
required |
group_index_zero
|
float
|
Group index at the zero-dispersion wavelength. |
required |
slope_ps_per_km_nm2
|
float
|
Dispersion slope at the zero-dispersion wavelength, in ps/(km nm^2). |
required |
lambda0_nm
|
float
|
Zero-dispersion wavelength, in nm. |
required |
build_cascade ¶
build_cascade(channels: Sequence[RamanChannel], *, group_index_zero: float, slope_ps_per_km_nm2: float, lambda0_nm: float) -> tuple[RamanChannel, ...]
Fill in group velocities from Sellmeier parameters and validate the gain matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channels
|
Sequence[RamanChannel]
|
Channels ordered by |
required |
group_index_zero
|
float
|
The fiber's zero-dispersion wavelength, dispersion slope, and group index there,
following Mermelstein 2003. See :func: |
required |
slope_ps_per_km_nm2
|
float
|
The fiber's zero-dispersion wavelength, dispersion slope, and group index there,
following Mermelstein 2003. See :func: |
required |
lambda0_nm
|
float
|
The fiber's zero-dispersion wavelength, dispersion slope, and group index there,
following Mermelstein 2003. See :func: |
required |
Returns:
| Type | Description |
|---|---|
tuple of RamanChannel
|
New channels with |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the gain matrix is not square with a zero diagonal, if it is asymmetric, or if
the channel indices are not |
walk_off ¶
walk_off(observer: RamanChannel, source: RamanChannel, geometry: int = Geometry.COUNTER_PROPAGATING) -> float
Walk-off parameter d_ij of Mermelstein 2003 Eq. 2, in km^-1.
.. math::
d_{ij} = \frac{1}{v_j} \mp \frac{1}{v_i}
with the upper sign for co-propagating and the lower for counter-propagating beams, in the observer's travelling frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observer
|
RamanChannel
|
The channel whose modulation is being propagated, |
required |
source
|
RamanChannel
|
The channel whose power fluctuation averages the observer, |
required |
geometry
|
int
|
:data: |
COUNTER_PROPAGATING
|
Notes
The paper writes d_31 and d_32, i.e. always with the signal as i. The
geometry sign multiplies the source term, so for co-propagating channels with equal
group velocity the walk-off vanishes, which is the physical statement that
co-propagating waves with matched group velocity do not separate.
photon_flux ¶
photon_flux(power_w: float, wavelength: Wavelength) -> float
Photon flux of a channel in photons per second, P * lambda / (h c).
Real stimulated Raman scattering is photon-count preserving: a 1375 nm photon becomes a 1465 nm photon and the energy difference goes into a phonon. Use this when you want the photon picture, for example when comparing channel budgets across orders of very different wavelength.
.. note::
Note the P * lambda weighting. A photon count is P / E with
E = hc / lambda, so it grows with wavelength at fixed power; P / lambda
weights by photon energy and is conserved by nothing physical.
Do not use this as a solver diagnostic. The Mermelstein 2003 power equations
transfer equal power between a coupled pair rather than equal photon number, so
their conserved quantity is power and the photon flux drifts by a few percent of
the transferred power. Build the cascade with
CWWCascade(..., photon_consistent=True) for a photon-conserving one, and then
:func:photon_flux_drift is the solver check.
channel_wavelengths ¶
channel_wavelengths(channels: Sequence[RamanChannel]) -> WavelengthArray
Collect the channel wavelengths into a :class:base.WavelengthArray.
photon_flux_drift ¶
photon_flux_drift(powers_w: NDArray[float64], z_m: NDArray[float64], alpha_per_m: NDArray[float64], lambda_m: NDArray[float64]) -> float
Relative drift of the photon flux sum_i P_i lambda_i along a solved span.
The weighting is P * lambda, not P / lambda: a photon count is
P lambda / (h c), which a power-coupled pair conserves only once the Stokes power
gain is reduced by lambda_pump / lambda_stokes. That reduction is what
CWWCascade(..., photon_consistent=True) applies. The fiber-loss contribution is
subtracted analytically, so what remains is the part of the flux change the coupled
equations do not account for.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
powers_w
|
NDArray[float64]
|
Powers with shape |
required |
z_m
|
NDArray[float64]
|
Ascending sample positions in metres. |
required |
alpha_per_m
|
NDArray[float64]
|
Per-channel loss in inverse metres and wavelength in metres. |
required |
lambda_m
|
NDArray[float64]
|
Per-channel loss in inverse metres and wavelength in metres. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Maximum absolute residual over the span, normalised by the flux entering at
|
Notes
This is near zero only for a cascade built with photon_consistent=True.
Mermelstein 2003 Eqs. 5a to 5c move equal power rather than equal photon number, so
this diagnostic reports a few percent of the transferred power for them, and that is
a statement about the model rather than about the integrator. Use
:attr:CascadeResult.power_balance_drift as the solver check for that model.
double_pole_fit ¶
double_pole_fit(f_hz: NDArray[float64], transfer_db: NDArray[float64]) -> tuple[float, float]
Fit a double-pole response and return (dc_db, corner_hz).
This is the trial function of Mermelstein 2003 Eq. 10, whose dc level and 6 dB corner frequency they report for every measured transfer function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_hz
|
NDArray[float64]
|
Offset frequency array, in Hz, sorted ascending. |
required |
transfer_db
|
NDArray[float64]
|
Transfer magnitude in dB at each frequency. |
required |
Returns:
| Type | Description |
|---|---|
tuple of float
|
The dc level in dB and the 6 dB corner frequency in Hz. |
Notes
The fit is performed on the linear amplitude 10**(db/20) by nonlinear least
squares over (dc, corner), not on the decibels, because the trial function is
rational and a fit in log space biases the corner.
load_benchmark ¶
load_benchmark(key: str, root: Path | None = None) -> BenchmarkFixture
Load and validate a Raman noise benchmark fixture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Paper key, matching the directory name under |
required |
root
|
Path | None
|
Repository root. Defaults to the package's parent directory. |
None
|
Returns:
| Type | Description |
|---|---|
BenchmarkFixture
|
The fixture with every provenance record validated. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the fixture file does not exist. |
ProvenanceError
|
If any numeric entry lacks a source, a non-empty DOI, a unit, or a valid kind. |