torchsig.datasets.narrowband.NewNarrowband

class torchsig.datasets.narrowband.NewNarrowband(dataset_metadata: DatasetMetadata | str | dict, **kwargs)[source]

Bases: NewTorchSigDataset

Creates a Narrowband dataset.

This class is responsible for creating the Narrowband dataset, which includes the dataset metadata and signal impairments.

Parameters:
  • dataset_metadata (DatasetMetadata | str | dict) – Metadata for the Narrowband dataset. This can be a DatasetMetadata object, a string (path to the metadata file), or a dictionary.

  • **kwargs – Additional keyword arguments passed to the parent class (NewTorchSigDataset).

Methods

add_parent

Add parent Seedable object and set up RNGs accordingly

get_distribution

get_second_seed

Gets second seed, usually used to seed both torch and numpy generators with slightly different seeds

reset

Resets the dataset to its initial state.

seed

Seed number generators with given seed.

setup_rngs

Initialize torch and numpy number generators, and update its children.

update_from_parent

Update numpy and torch number generators with parent seed

Attributes

dataset_metadata

Returns the dataset metadata.

__init__(dataset_metadata: DatasetMetadata | str | dict, **kwargs)[source]

Initializes the Narrowband dataset.

Parameters:

dataset_metadata (NarrowbandMetadata) – The metadata specific to the Narrowband dataset.

__repr__()

Returns a string representation of the object with all its attributes.

Returns:

String representation of the object with its attributes.

Return type:

str

__str__() str

Returns a string representation of the dataset, including its metadata and the signal builders.

Returns:

String representation of the dataset.

Return type:

str

add_parent(parent) None

Add parent Seedable object and set up RNGs accordingly

property dataset_metadata

Returns the dataset metadata.

Returns:

The dataset metadata.

Return type:

DatasetMetadata

get_second_seed(seed: int) int

Gets second seed, usually used to seed both torch and numpy generators with slightly different seeds

Parameters:

seed (int) – Seed to use.

Returns:

New seed.

Return type:

int

reset()

Resets the dataset to its initial state.

seed(seed: int) None

Seed number generators with given seed.

Parameters:

seed (int) – Seed to use.

setup_rngs() None

Initialize torch and numpy number generators, and update its children.

update_from_parent() None

Update numpy and torch number generators with parent seed