torchsig.datasets.datasets.apply_transforms_and_labels_to_signal

torchsig.datasets.datasets.apply_transforms_and_labels_to_signal(sample: Signal, transforms: list[Transform | callable], target_labels: list) Signal | np.ndarray | tuple[source]

Applies a series of transformations to a signal sample and retrieves specified label values.

Parameters:
  • sample – The signal sample to process.

  • transforms – A list of function objects, each taking a Signal object and returning a transformed Signal object.

  • target_labels – Labels to be retrieved from the signal sample after transformations. If None, the transformed signal is returned. If an empty list, the signal data is returned.

Returns:

  • If target_labels is None, a Signal object with all applied transforms.

  • If target_labels is an empty list, the numpy.ndarray data of the sample.

  • If target_labels contains one label, a tuple of (sample_data, target_value).

  • If target_labels contains multiple labels, a tuple of (sample_data, [target_values]).