sigkit.transforms package

Submodules

sigkit.transforms.awgn module

Module for AWGN Torch Transform.

class sigkit.transforms.awgn.ApplyAWGN(snr_db: float | tuple[float, float])[source]

Bases: Module

Applies Additive White Gaussian Noise to reach a target SNR.

Parameters:

snr_db

  • If float or int: use that fixed SNR (in dB) on every forward().

  • If tuple/list of two floats: (min_snr_db, max_snr_db), sample uniformly from [min_snr_db, max_snr_db] each all.

forward(x: Tensor) Tensor[source]

Applies AWGN to the input to reach the target SNR.

Parameters:

x – torch.Tensor of shape [N], dtype=torch.complex64.

Returns:

torch.Tensor of shape [N], dtype=torch.complex64 with AWGN.

sigkit.transforms.frequency_shift module

Module for FrequencyShift Torch Transform.

class sigkit.transforms.frequency_shift.ApplyFrequencyShift(freq_offset: float | Tuple[float, float], sample_rate: float)[source]

Bases: Module

Apply a constant or random frequency offset to a 1D complex64 torch.Tensor.

Parameters:
  • freq_offset

    • If a single float or int: apply that fixed frequency (in Hz).

    • If a tuple/list of two floats: (min_freq, max_freq), pick random uniform from [min_freq, max_freq] per call.

  • sample_rate

    • Sampling rate of the signal (in samples per second).

forward(x: Tensor) Tensor[source]

Applies the frequency shift to the Tensor.

sigkit.transforms.phase_shift module

Module for PhaseShift Torch Transform.

class sigkit.transforms.phase_shift.ApplyPhaseShift(phase_offset: float | Tuple[float, float])[source]

Bases: Module

Apply a constant or random phase offset to a 1D complex64 torch.Tensor.

Parameters:

phase_offset

  • If a single float or int: apply that fixed phase (radians).

  • If a tuple/list of two floats: (min_phase, max_phase), pick random uniform phi from [min_phase, max_phase] per call

forward(x: Tensor) Tensor[source]

Applies the PhaseShift to the Tensor.

sigkit.transforms.utils module

Utility module for SigKit transforms.

class sigkit.transforms.utils.ComplexTo2D(*args, **kwargs)[source]

Bases: Module

Convert to the expected input of the model for training.

Transform a 1D torch.Tensor of dtype=torch.complex64 and shape (N,) into a 2×N torch.Tensor of dtype=torch.float32:

  • Row 0 = real part

  • Row 1 = imaginary part

Example

x = torch.randn(4096) + 1j * torch.randn(4096) x = x.to(torch.complex64) iq = ComplexTo2D(x)

forward(x: Tensor)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class sigkit.transforms.utils.Normalize(norm=inf)[source]

Bases: Module

Normalize the input data.

forward(x: Tensor) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class sigkit.transforms.utils.RandomApplyProb(transforms_p: list[tuple[Module, float]])[source]

Bases: Module

Apply a list of transforms with a given probability per transform.