Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

sdynpy.SpectrumArray

Signature

class sdynpy.SpectrumArray(shape, nelements, buffer=None, offset=0, strides=None, order=None)

Data array used to store linear spectra (for example scaled FFT results)

Attributes

NameSummary
function_typeReturns the function type of the data array

function_type

Returns the function type of the data array

Methods

NameSummary
apply_transformationApplies response transformations spectra.
ifftComputes a time signal from the frequency spectrum
interpolate_by_zero_padInterpolates a spectrum by zero padding or truncating its time response
plotPlot the spectra
plot_spectrogramPlots a spectrogram

apply_transformation

def sdynpy.SpectrumArray.apply_transformation(self, transformation, invert_transformation=False)

Applies response transformations spectra.

Parameters

Returns

Raises

ifft

def sdynpy.SpectrumArray.ifft(self, norm='backward', rtol=1, atol=1e-08, odd_num_samples=False, **scipy_irfft_kwargs)

Computes a time signal from the frequency spectrum

Parameters

Returns

Raises

Notes

Note that the ifft uses the rfft function from scipy to compute the inverse fast fourier transform. This function is not round-trip equivalent for odd functions, because by default it assumes an even signal length. For an odd signal length, the user must either specify odd_num_samples = True or set num_samples to the correct number of samples.

interpolate_by_zero_pad

def sdynpy.SpectrumArray.interpolate_by_zero_pad(self, time_response_padded_length, return_time_response=False, odd_num_samples=False)

Interpolates a spectrum by zero padding or truncating its time response

Parameters

Returns

Notes

This function will automatically set the last frequency line of the SpectrumArray to zero because it won’t be accurate anyway. If time_response_padded_length is less than the current function’s num_elements, then it will be truncated instead of zero-padded.

plot

def sdynpy.SpectrumArray.plot(self, one_axis=True, subplots_kwargs={}, plot_kwargs={}, abscissa_markers=None, abscissa_marker_labels=None, abscissa_marker_type='vline', abscissa_marker_plot_kwargs={})

Plot the spectra

Parameters

Returns

plot_spectrogram

def sdynpy.SpectrumArray.plot_spectrogram(self, abscissa=None, axis=None, subplots_kwargs={}, pcolormesh_kwargs={'shading': 'auto'}, log_scale=True)

Plots a spectrogram

Parameters

Returns