torchsig.transforms.transforms.NonlinearAmplifier¶
- class torchsig.transforms.transforms.NonlinearAmplifier(gain_range: tuple[float, float] = (1.0, 1.0), psat_backoff_range: tuple[float, float] = (5.0, 20.0), phi_max_range: tuple[float, float] = (-0.05, 0.05), phi_slope_range: tuple[float, float] = (-0.1, 0.1), auto_scale: bool = True, **kwargs)[source]¶
Bases:
SignalTransformApply a memoryless nonlinear amplifier model to a signal.
- gain_range¶
Small-signal gain range (linear). Defaults to (1.0, 4.0).
- gain_distribution¶
Random draw from gain distribution.
- psat_backoff_range¶
Psat backoff factor (linear) reflecting saturated power level (Psat) relative to input signal mean power. Defaults to (5.0, 20.0).
- psat_backoff_distribution¶
Random draw from psat_backoff distribution.
- phi_max_range¶
Maximum signal relative phase shift at saturation power level (radians). Defaults to (-0.05, 0.05).
- phi_max_distribution¶
Random draw from phi_max distribution.
- phi_slope_range¶
Slope of relative phase shift response (W/radians). Defaults to (-0.1, 0.01).
- phi_slope_distribution¶
Random draw from phi_max distribution.
- auto_scale¶
Automatically rescale output power to match full-scale peak input power prior to transform, based on peak estimates. Default True.
Methods
Add parent Seedable object and set up RNGs accordingly.
Create distribution function with proper seeding.
Gets second seed, usually used to seed both torch and numpy generators with slightly different seeds.
Seed number generators with given seed.
Initialize torch and numpy number generators, and update its children.
Update numpy and torch number generators with parent seed.
- __init__(gain_range: tuple[float, float] = (1.0, 1.0), psat_backoff_range: tuple[float, float] = (5.0, 20.0), phi_max_range: tuple[float, float] = (-0.05, 0.05), phi_slope_range: tuple[float, float] = (-0.1, 0.1), auto_scale: bool = True, **kwargs)[source]¶
Initialize the NonlinearAmplifier transform.
- Parameters:
gain_range – Small-signal gain range (linear). Defaults to (1.0, 1.0).
psat_backoff_range – Psat backoff factor (linear) reflecting saturated power level (Psat) relative to input signal mean power. Defaults to (5.0, 20.0).
phi_max_range – Maximum signal relative phase shift at saturation power level (radians). Defaults to (-0.05, 0.05).
phi_slope_range – Slope of relative phase shift response (W/radians). Defaults to (-0.1, 0.1).
auto_scale – Automatically rescale output power to match full-scale peak input power prior to transform, based on peak estimates. Defaults to True.
**kwargs – Additional keyword arguments passed to the parent class.
- __call__(signal: Signal) Signal¶
Validates signal, performs transform, updates bookeeping, (optionally) enforces data type.
- Parameters:
signal – Signal to be transformed.
- Returns:
Transformed signal.
- __repr__() str¶
Transform string representation.
Should be able to recreate class from this string.
- Returns:
Transform representation.
- __str__() str¶
String representation of the transform.
- Returns:
String representation of the transform.
- add_parent(parent: Seedable, register: bool = True) None¶
Add parent Seedable object and set up RNGs accordingly.
- Parameters:
parent – Parent Seedable object to add.
register – If True (default), add self to parent.children so that future seed propagation reaches this object. Pass False for transient objects (e.g. per-sample Signal instances) that only need the parent link for metadata/RNG access during their lifetime but must not accumulate in the parent’s child list, which would otherwise cause unbounded memory growth.
- get_distribution(params: list | tuple | float, scaling: str = 'linear') Distribution¶
Create distribution function with proper seeding.
- Parameters:
params – Parameters for distribution.
scaling – Scaling param for distribution. Defaults to ‘linear’.
- Returns:
Distribution function, seeded.
- Return type: