torchsig.transforms.transforms.DigitalAGC¶
- class torchsig.transforms.transforms.DigitalAGC(initial_gain_db: tuple[float] = (0, 0), alpha_smooth: tuple[float] = (1e-07, 1e-06), alpha_track: tuple[float] = (1e-06, 1e-05), alpha_overflow: tuple[float] = (0.1, 0.3), alpha_acquire: tuple[float] = (1e-06, 1e-05), track_range_db: tuple[float] = (0.5, 2), **kwargs)[source]¶
Bases:
SignalTransformAutomatic Gain Control performing sample-by-sample AGC algorithm.
- initial_gain_db¶
Inital gain value in dB.
- alpha_smooth¶
Alpha for averaging the measure signal level level_n = level_n * alpha + level_n-1(1-alpha)
- alpha_track¶
Amount to adjust gain when in tracking state.
- alpha_overflow¶
Amount to adjust gain when in overflow state [level_db + gain_db] >= max_level.
- alpha_acquire¶
Amount to adjust gain when in acquire state.
- track_range_db¶
dB range for operating in tracking state.
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__(initial_gain_db: tuple[float] = (0, 0), alpha_smooth: tuple[float] = (1e-07, 1e-06), alpha_track: tuple[float] = (1e-06, 1e-05), alpha_overflow: tuple[float] = (0.1, 0.3), alpha_acquire: tuple[float] = (1e-06, 1e-05), track_range_db: tuple[float] = (0.5, 2), **kwargs)[source]¶
Initialize the DigitalAGC transform.
- Parameters:
initial_gain_db – Inital gain value in dB. Defaults to (0, 0).
alpha_smooth – Alpha for averaging the measure signal level. Defaults to (1e-7, 1e-6).
alpha_track – Amount to adjust gain when in tracking state. Defaults to (1e-6, 1e-5).
alpha_overflow – Amount to adjust gain when in overflow state. Defaults to (1e-1, 3e-1).
alpha_acquire – Amount to adjust gain when in acquire state. Defaults to (1e-6, 1e-5).
track_range_db – dB range for operating in tracking state. Defaults to (0.5, 2).
**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: