torchsig.signals.builders.fm.FMSignalBuilder¶
- class torchsig.signals.builders.fm.FMSignalBuilder(dataset_metadata: DatasetMetadata, class_name: str = 'fm', **kwargs)[source]¶
Bases:
SignalBuilderImplements SignalBuilder() for frequency modulation (FM) waveform.
- dataset_metadata¶
Parameters describing the dataset required for signal generation.
- Type:
Methods
Add parent Seedable object and set up RNGs accordingly
Builds and returns Signal
get_distributionGets second seed, usually used to seed both torch and numpy generators with slightly different seeds
Resets _signal according to defaults defined by dataset metadata.
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
Attributes
- __init__(dataset_metadata: DatasetMetadata, class_name: str = 'fm', **kwargs)[source]¶
Initializes FM Signal Builder. Sets class_name= “fm”.
- Parameters:
dataset_metadata (DatasetMetadata) – Dataset metadata.
class_name (str, optional) – Class name.
- __repr__()¶
Return repr(self).
- build() Signal¶
Builds and returns Signal
The Builder() __init__ calls reset() which initializes the signal metadata according to default values defined within dataset metadata. _update_metadata() then updates signal-specific metadata fields as needed. _update_data() creates the IQ samples and assigns them to the Signal() data field. _correct_bandwidth_and_snr() sets the power of the signal based on the PSD estimate to have the appropriate SNR and then estimates the total occupied bandwidth of the signal, including sidelobes, to develop a more accurate bounding box. .verify() ensures that the metadata values are within the appropriate bounds. The Signal() object is then stored for the return call, and reset() is called to reset the signal metadata fields to their dataset metadata defaults.
In order, calls: - reset() - _update_metadata() - _update_data() - _correct_bandwidth_and_snr() - _signal.verify()
- Returns:
Signal being built.
- Return type:
- get_second_seed(seed: int) int¶
Gets second seed, usually used to seed both torch and numpy generators with slightly different seeds
- reset() None¶
Resets _signal according to defaults defined by dataset metadata.
Signal metadata is generated according to the default values as defined by the dataset metadata. The signal data is set to noise samples.
These metadata value can be overridden if a particular modulator or special signal requires it. For example, the bandwidth of a tone is dependent on the signal duration and therefore requires recalculation and an update to the signal metadata inside _update_metadata() in the tone builder class. Similarly, the minimum duration for a constellation based signal must be at least 1 symbol, which requires recomputation in the _update_metadata() field for the constellation builder class.
This method is called by the parent Builder() __init__ and after build().