torchsig.signals.signal_types.SignalMetadata

class torchsig.signals.signal_types.SignalMetadata(dataset_metadata: DatasetMetadata = None, center_freq: float = None, bandwidth: float = None, start_in_samples: int = None, duration_in_samples: int = None, snr_db: float = None, class_name: str = None, class_index: int = None)[source]

Bases: object

Represents metadata associated with a signal.

dataset_metadata

The dataset metadata for the signal. Defaults to None.

Type:

DatasetMetadata

center_freq

The center frequency of the signal in Hz. Defaults to 0.0.

Type:

float

bandwidth

The bandwidth of the signal in Hz. Defaults to 0.0.

Type:

float

start_in_samples

The start time of the signal in terms of samples. Defaults to 0.

Type:

int

duration_in_samples

The duration of the signal in terms of samples. Defaults to 0.

Type:

int

snr_db

The Signal-to-Noise Ratio in dB. Defaults to 0.0.

Type:

float

class_name

The class name of the signal (e.g., modulation type). Defaults to “None”.

Type:

str

class_index

The class index of the signal in the dataset. Defaults to -1.

Type:

int

Methods

deepcopy

Returns a deep copy of itself

to_dict

Returns SignalMetadata as a full dictionary

verify

Verifies Signal Metadata fields

Attributes

dataset_metadata

Returns the dataset metadata for the signal.

duration

Signal duration (normalized)

lower_freq

Calculates the lower frequency of a signal

num_samples

Signal number of IQ samples

oversampling_rate

Calculates the oversampling rate for a signal

sample_rate

Signal sample rate

start

Signal start normalized to duration of signal

stop

Signal stop normalized to duration of signal

stop_in_samples

Signal stop in samples

upper_freq

Calculates the upper frequency of a signal

__init__(dataset_metadata: DatasetMetadata = None, center_freq: float = None, bandwidth: float = None, start_in_samples: int = None, duration_in_samples: int = None, snr_db: float = None, class_name: str = None, class_index: int = None)[source]

Initializes the SignalMetadata object.

Parameters:
  • dataset_metadata (DatasetMetadata, optional) – Metadata related to the dataset. Defaults to None.

  • center_freq (float, optional) – The center frequency of the signal in Hz. Defaults to 0.0.

  • bandwidth (float, optional) – The bandwidth of the signal in Hz. Defaults to 0.0.

  • start_in_samples (int, optional) – The start time in samples. Defaults to 0.

  • duration_in_samples (int, optional) – The duration in samples. Defaults to 0.

  • snr_db (float, optional) – The signal-to-noise ratio in decibels. Defaults to 0.0.

  • class_name (str, optional) – The class name of the signal. Defaults to “None”.

  • class_index (int, optional) – The class index of the signal. Defaults to -1.

property dataset_metadata: DatasetMetadata

Returns the dataset metadata for the signal.

Returns:

The dataset metadata.

Return type:

DatasetMetadata

property sample_rate: float

Signal sample rate

Returns:

sample rate

Return type:

float

property num_samples: int

Signal number of IQ samples

Returns:

number of IQ samples

Return type:

int

property start: float

Signal start normalized to duration of signal

Returns signal start as a percentage of total time, ex: start=0.5 means the signal starts 50% of the way into the dataset IQ samples.

Returns:

signal start

Return type:

float

property stop: float

Signal stop normalized to duration of signal

Returns signal stop as a percentage of total time, ex: stop=0.5 means the signal stops 50% of the way into the dataset IQ samples.

Returns:

signal stop

Return type:

float

property duration: float

Signal duration (normalized)

Returns signal duration normalized from 0.0 to 1.0

Returns:

signal duration

Return type:

float

property stop_in_samples: int

Signal stop in samples

Returns the index where the signal stops in the dataset IQ.

Returns:

signal stop

Return type:

int

property upper_freq: float

Calculates the upper frequency of a signal

Calculates the upper frequency edge, or highest frequency, associated with the bandwidth of the signal.

Returns:

upper frequency

Return type:

float

property lower_freq: float

Calculates the lower frequency of a signal

Calculates the lower frequency edge, or lowest frequency, associated with the bandwidth of the signal.

Returns:

lower frequency

Return type:

float

property oversampling_rate: float

Calculates the oversampling rate for a signal

Calculates the oversampling rate for a signal. If a signal’s bandwidth is 1/2 the sampling rate, the oversampling rate is 2.

Returns:

oversampling rate

Return type:

float

to_dict() dict[source]

Returns SignalMetadata as a full dictionary

deepcopy() SignalMetadata[source]

Returns a deep copy of itself

Returns:

Deep copy of SignalMetadata

Return type:

SignalMetadata

verify() None[source]

Verifies Signal Metadata fields

Raises:
  • MissingSignalMetadata – Metadata missing.

  • InvalidSignalMetadata – Metadata invalid.

__repr__()[source]

Return repr(self).