CropSignal#

class ansys.sound.core.signal_utilities.CropSignal(signal=None, start_time=0.0, end_time=0.0)#

Crop a signal.

This class allows cropping a signal, that is, extracting a segment of it.

Examples

Crop a signal between 1.0 s and 3.0 s.

>>> from ansys.sound.core.signal_utilities import CropSignal
>>> crop_signal = CropSignal(signal=my_signal, start_time=1.0, end_time=3.0)
>>> crop_signal.process()
>>> signal_segment = crop_signal.get_output()

Class instantiation takes the following parameters.

Parameters:
signalFieldsContainer | Field, default: None

Signal to resample as a DPF field or fields container.

start_timefloat, default: 0.0

Start time of the part to crop in seconds.

end_timefloat, default: 0.0

End time of the part to crop in seconds.

Methods

CropSignal.get_output()

Get the cropped signal as a DPF fields container.

CropSignal.get_output_as_nparray()

Get the cropped signal as a NumPy array.

CropSignal.plot()

Plot the resulting signals in a single figure.

CropSignal.process()

Crop the signal.

Attributes

CropSignal.end_time

End time of the part to crop in s.

CropSignal.signal

Input signal as a DPF field or fields container.

CropSignal.start_time

Start time of the part to crop in s.