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.doc.RandomVibTest

Signature

class sdynpy.doc.RandomVibTest(source_data: sdynpy.fileio.sdynpy_rattlesnake.RattlesnakeRandomEnvironmentData = None, geometry: str | sdynpy.core.sdynpy_geometry.Geometry = None, coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, control_coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, response_coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, excitation_coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, time_data: list[sdynpy.core.sdynpy_data.TimeHistoryArray] = None, cpsd: list[sdynpy.core.sdynpy_data.PowerSpectralDensityArray] = None, specification_cpsd: sdynpy.core.sdynpy_data.PowerSpectralDensityArray = None, specification_warning_psd: sdynpy.core.sdynpy_data.PowerSpectralDensityArray = None, specification_abort_psd: sdynpy.core.sdynpy_data.PowerSpectralDensityArray = None, averages: int = None, overlap: float = None, fft_lines: int = None, window: str = None, samples_per_frame: int = None, start_time: float = None, units: numpy.ndarray = None, frf: list[sdynpy.core.sdynpy_data.TransferFunctionArray] = None, oct_order: int = None)

Container for a random vibration test data set with automated plotting.

Holds time history data, cross-power spectral densities, specifications, and data for a random vibration test environment. Provides methods to compute CPSDs/FRFs and produce a standard suite of diagnostic plots.

Parameters

Attributes

NameSummary
geometryGeometry object for 3-D visualisation.
start_timeList of analysis-window start times in seconds, one per data set.
time_dataList of full-length TimeHistoryArray objects, one per data set.
time_data_truncatedTime data windowed to the analysis subset used for CPSD computation.

geometry

Geometry object for 3-D visualisation.

Returns

start_time

List of analysis-window start times in seconds, one per data set.

A value of None for any element triggers automatic selection via :func:optimal_subset when the truncated data is first requested.

Returns

time_data

List of full-length TimeHistoryArray objects, one per data set.

Returns

time_data_truncated

Time data windowed to the analysis subset used for CPSD computation.

Lazily computed on first access and cached. Each element is extracted from the corresponding full TimeHistoryArray beginning at start_time and covering exactly samples_per_frame * averages - overlap_samples * (averages - 1) samples. When start_time is None for a data set, the optimal start index is found via :func:optimal_subset and the corresponding start_time entry is updated in-place.

Returns

Methods

NameSummary
__init__Store all test data attributes.
compute_cpsdCompute cross-power spectral densities for each time data set.
compute_frfCompute FRFs for each time data set and append them to self.frf.
convert_to_octaveConvert all stored PSDs to octave-band averages.
create_all_plotsGenerate and save all standard diagnostic plots to disk.
load_rattlesnake_streaming_dataConstruct a RandomVibTest from a Rattlesnake streaming nc4 file.
plot_control_vs_specPlot measured control PSD against the specification for each control channel.
plot_cpsd_time_subsetPlot the selected time subset used for CPSD computation.
plot_kurtosisPlot the kurtosis of each response channel time history.
plot_multiple_coherencePlot multiple coherence for each response channel within the analysis bandwidth.
plot_percent_lines_outPlot the percentage of spectral lines out of tolerance for each control channel.
plot_responsePlot the measured response PSD for each response channel.
plot_rms_errorPlot the broadband RMS error between response and specification for each control channel.
plot_rms_levelPlot the broadband RMS level for each response channel.
plot_signal_to_noisePlot the signal-to-noise ratio for a two-dataset (noise + signal) test.
plot_time_historiesPlot the truncated time history for each channel.
set_tolerance_limit_psdSet the abort-tolerance PSD from the specification using a dB tolerance.

__init__

def sdynpy.doc.RandomVibTest.__init__(self, source_data: sdynpy.fileio.sdynpy_rattlesnake.RattlesnakeRandomEnvironmentData = None, geometry: str | sdynpy.core.sdynpy_geometry.Geometry = None, coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, control_coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, response_coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, excitation_coordinate: sdynpy.core.sdynpy_coordinate.CoordinateArray = None, time_data: list[sdynpy.core.sdynpy_data.TimeHistoryArray] = None, cpsd: list[sdynpy.core.sdynpy_data.PowerSpectralDensityArray] = None, specification_cpsd: sdynpy.core.sdynpy_data.PowerSpectralDensityArray = None, specification_warning_psd: sdynpy.core.sdynpy_data.PowerSpectralDensityArray = None, specification_abort_psd: sdynpy.core.sdynpy_data.PowerSpectralDensityArray = None, averages: int = None, overlap: float = None, fft_lines: int = None, window: str = None, samples_per_frame: int = None, start_time: float = None, units: numpy.ndarray = None, frf: list[sdynpy.core.sdynpy_data.TransferFunctionArray] = None, oct_order: int = None)

Store all test data attributes.

Every named parameter is assigned directly to self. See the class docstring for parameter descriptions. cpsd and frf default to empty lists when None is passed, and the specification CPSD is sanitised so that zero values are replaced with NaN.

compute_cpsd

def sdynpy.doc.RandomVibTest.compute_cpsd(self)

Compute cross-power spectral densities for each time data set.

Computes ASDs for each truncated time data segment and appends them to self.cpsd. Already-computed entries (PowerSpectralDensityArray instances) are left unchanged; only None or non-array entries are recomputed.

compute_frf

def sdynpy.doc.RandomVibTest.compute_frf(self)

Compute FRFs for each time data set and append them to self.frf.

For each truncated time data segment, computes H1 frequency response functions between the excitation (reference) channels and all response channels using the same windowing parameters as CPSD computation. Each resulting TransferFunctionArray is appended to self.frf.

Excitation channels are identified by a non-empty feedback_channel entry in the source channel table, matching the logic used in RattlesnakeData.excitation_coordinate.

convert_to_octave

def sdynpy.doc.RandomVibTest.convert_to_octave(self, oct_order=6)

Convert all stored PSDs to octave-band averages.

Restricts the analysis to the specification bandwidth, computes nominal octave-band centres for the given oct_order, then replaces the stored CPSDs, specification CPSD, warning PSD, and abort PSD with their octave-band equivalents using bandwidth_average. Sets self.oct_order so that subsequent RMS computations use octave integration.

Parameters

create_all_plots

def sdynpy.doc.RandomVibTest.create_all_plots(self, figure_root_path='Figures')

Generate and save all standard diagnostic plots to disk.

Computes CPSDs if they have not already been computed, saves a time- subset plot, then iterates over all standard plot methods, saving each figure to a labelled subdirectory under figure_root_path. All matplotlib figures are closed after each method to free memory.

The plot methods called (and their subfolder names) are:

Parameters

load_rattlesnake_streaming_data

def sdynpy.doc.RandomVibTest.load_rattlesnake_streaming_data(cls, file: os.PathLike | sdynpy.fileio.sdynpy_rattlesnake.RattlesnakeData, environment_name: str = None, geometry: os.PathLike | sdynpy.core.sdynpy_geometry.Geometry = None)

Construct a RandomVibTest from a Rattlesnake streaming nc4 file.

Reads (or reuses) a RattlesnakeData object, selects the requested environment, and populates a new RandomVibTest with all time data, coordinate arrays, specification PSDs, and spectral processing parameters drawn from the file.

Parameters

Returns

Warns

plot_control_vs_spec

def sdynpy.doc.RandomVibTest.plot_control_vs_spec(self, save_path: None | str = None)

Plot measured control PSD against the specification for each control channel.

For each data set, creates a grid of subplots — one per control channel — showing the abort-limit band (filled grey), warning-limit band (light grey), specification (dashed black), and measured response (blue). Out-of-limit regions are shaded and a percentage-out-of-limit annotation is added to each subplot. The in-band RMS level is shown as a text annotation.

Parameters

Returns

plot_cpsd_time_subset

def sdynpy.doc.RandomVibTest.plot_cpsd_time_subset(self, save_path=None)

Plot the selected time subset used for CPSD computation.

Parameters

plot_kurtosis

def sdynpy.doc.RandomVibTest.plot_kurtosis(self, save_path: None | str = None)

Plot the kurtosis of each response channel time history.

Kurtosis is computed on the truncated (analysis-window) portion of each data set using Fisher’s definition disabled (Pearson kurtosis, where Gaussian has kurtosis = 3). Bars that fall outside the range [3 - 1, 3 + 1] are coloured red.

Parameters

Returns

plot_multiple_coherence

def sdynpy.doc.RandomVibTest.plot_multiple_coherence(self, save_path: None | str = None)

Plot multiple coherence for each response channel within the analysis bandwidth.

For each data set, computes the multiple coherence between every response channel and all excitation channels (using the same windowing parameters as CPSD computation), truncates to the specification bandwidth, then produces a grid of subplots with one panel per response channel. The y-axis is fixed to [0, 1].

Parameters

Returns

plot_percent_lines_out

def sdynpy.doc.RandomVibTest.plot_percent_lines_out(self, save_path: None | str = None)

Plot the percentage of spectral lines out of tolerance for each control channel.

For each data set, computes the fraction of frequency lines within the analysis bandwidth where the measured response falls outside the abort tolerance limits, then displays the result as a horizontal bar chart. Bars exceeding a 10 % threshold are coloured red. The fraction of channels that exceed the threshold is shown in the figure title.

Parameters

Returns

plot_response

def sdynpy.doc.RandomVibTest.plot_response(self, save_path: None | str = None, one_figure=False)

Plot the measured response PSD for each response channel.

For each data set, creates a grid of subplots — one per response channel — showing the measured ASD (blue) on a log scale. The in-band RMS level is annotated on each subplot.

Parameters

Returns

plot_rms_error

def sdynpy.doc.RandomVibTest.plot_rms_error(self, save_path: None | str = None)

Plot the broadband RMS error between response and specification for each control channel.

The RMS error is computed as the difference between the measured RMS level and the specification RMS level, both restricted to the analysis bandwidth. Results are displayed as a horizontal bar chart.

Parameters

Returns

plot_rms_level

def sdynpy.doc.RandomVibTest.plot_rms_level(self, save_path: None | str = None)

Plot the broadband RMS level for each response channel.

RMS values are computed from the CPSD restricted to the analysis bandwidth defined by the specification, warning, and abort PSDs. Results are displayed as a horizontal bar chart.

Parameters

Returns

plot_signal_to_noise

def sdynpy.doc.RandomVibTest.plot_signal_to_noise(self, save_path: None | str = None)

Plot the signal-to-noise ratio for a two-dataset (noise + signal) test.

Requires exactly two data sets: the first is treated as the noise measurement and the second as the signal measurement. SNR is computed as 10 * log10(signal_power / noise_power) where power is the integral of the ASD over the full frequency range. Bars with SNR below 10 dB are coloured red.

Parameters

Returns

plot_time_histories

def sdynpy.doc.RandomVibTest.plot_time_histories(self, save_path: None | str = None)

Plot the truncated time history for each channel.

For each data set, creates a grid of subplots — one per channel in the truncated TimeHistoryArray — showing the time-domain signal. Path simplification is enabled for performance on large records.

Parameters

Returns

set_tolerance_limit_psd

def sdynpy.doc.RandomVibTest.set_tolerance_limit_psd(self, dB=6)

Set the abort-tolerance PSD from the specification using a dB tolerance.

Computes lower and upper bounds as specification_asd / 10^(dB/10) and specification_asd * 10^(dB/10) respectively, then stores them as self.specification_abort_psd. Only the abort band is updated; specification_warning_psd is not modified.

Parameters

Raises