Edit and manipulate signals

The Signal Processing Tool provides different options to edit the input signal. Tools to crop, combine, scale, shift, rotate, filter and other manipulations are available. This section provides an overview of the available methods.

All methods have an optional parameter ‘override’ to select if a new time domain data object should be created or if the input updates the instance itself. By default, the instance self is updated. If user selects to create a new instance, the object should be added to collection by the user.

Scale amplitude

The method scale_amplitude() allows to scale the amplitude of the input signal by a given factor. The user can specify the scaling factor and the method will multiply the amplitudes of the signal by this factor.

time_domain_data.scale_amplitude(factor=2.0)

Crop time domain

The method crop_time_domain() is available to crop the time domain signal to a specified time range. The user should specify the direction of cropping. Either select from_front=True (default): Crops from the beginning of the signal. Or from_front=False: Crops from the end of the signal.

Example 1 - Crop based on number of items: This example crops the signal, by removing the first 100 points of the signal.

time_domain_data.crop_time_domain(number_of_items=100)

Example 2 - Crop based on amount of time: Crop based on a time duration. In this example 2 seconds worth of data is removed from the end of the signal.

time_domain_data.crop_time_domain(time_duration=2.0, from_front=False)

Example 3 - Percentage to crop: Crop a percentage of the total signal length. In this example 10% of the signal is removed at the end.

time_domain_data.crop_time_domain(percentage_to_crop=10, from_front=False)

or:

time_domain_data.crop_time_domain(percentage_to_crop=90)

Example 4 - Crop at time value: Crop all data before or after a specific time value. In this example the part before 2.3 seconds is removed.

time_domain_data.crop_time_domain(crop_at=2.3)

Apply zero padding

The method zero_pad_time_domain() extends a time-domain signal by adding zero-valued samples at the front, back, or both ends of the signal. This is useful for improving frequency resolution in FFTs, aligning signals, or preparing data for further processing. For the theoretical background of zero padding please refer to the section Zero padding.

Example 1 - Pad a fixed number of samples: In this example 100 zeros are added at the start and end of the signal (both is default value for the direction pad_from). Front, back or both ends can be selected.

time_domain_data.zero_pad_time_domain(number_of_items=100)

Example 2 - Pad by time amount: Pad based on a time duration. The method calculates how many samples this corresponds to using the time step. In the example 2 seconds worth of zeros are added at the end.

time_domain_data.zero_pad_time_domain(time_amount=2.0, pad_from='back')

Example 3 - Pad by percentage: Pad a percentage of the original signal length. In the example 10% of the signal length is added as zeros.

time_domain_data.zero_pad_time_domain(percentage_to_pad=10, pad_from='front')

Combine signals

The method combine_time_domains() merges the amplitudes of multiple time-domain signals into a single signal, assuming they share a common time base or overlap in time.

time_domain_data.combine_time_domains(other_time_domain_list=[other_time_domain_data])

Note

The combining of time domain data requires overlapping time stamps to match across all signals. If signal lengths differ, a warning is issued and shorter signals are zero-padded.

Stitch signals

The method stitch_time_domain() concatenates multiple time-domain signals end-to-end, creating a single continuous signal by placing each one directly after the previous.

time_domain_data.stitch_time_domains(other_time_domain_list=[other_time_domain_data])

Shift time

The method shift_start_time() adjusts a the time domain signal so that the signal starts at the specified time.

time_domain_data.shift_start_time(start_time=0.0)

Rotate signals

The method rotate_with_orthogonal_pair() applies a 2D rotation to two orthogonal signals (e.g. representing x and y components), rotating them by a specified angle.

time_domain_data.rotate_with_orthogonal_pair(partner_signal=other_time_domain_data, rotation_angle_degrees=30.0)

Remove baseline

The method remove_baseline() eliminates the constant offset (baseline) from a time-domain signal. This is useful for removing unwanted static components such as: DC offset in electrical signals, gravity-induced acceleration in mechanical measurements or constant velocity or displacement bias in motion data.

time_domain_data.remove_baseline()

Segment signal

The method segment_time_domain() divides the time-domain signal into overlapping segments, useful for spectral analysis (e.g., Welch’s method) to reduce random error.

This example segments the signal into segments of 0.5 seconds duration with 20% overlap between consecutive segments.

time_domain_data.segment_time_domain(overlap=0.2, segment_duration=0.5)