sdynpy.core.sdynpy_data.ShockResponseSpectrumArray

class ShockResponseSpectrumArray(shape, nelements, buffer=None, offset=0, strides=None, order=None)[source]

Bases: NDDataArray

__init__()

Methods

mimo_inverse(transfer_function, sample_rate, ...)

Computes an input signal that would recreate the specified SRS

plot([one_axis, subplots_kwargs, ...])

Plot the shock response spectrum

sum_decayed_sines(sample_rate, block_size[, ...])

Generate a Sum of Decayed Sines signal given an SRS.

Attributes

function_type

Returns the function type of the data array

property function_type

Returns the function type of the data array

mimo_inverse(transfer_function, sample_rate, block_size, srs_damping=0.03, num_time_constants=None, tau=None, sine_decays=None, rcond=None, accuracy_weight=1, input_weight=0, return_drive_signal=True, return_drive_table=False, return_projected_srs=False, return_optimization_result=False, return_complex_targets=False)[source]

Computes an input signal that would recreate the specified SRS

Computes an input signal that would recreate the specified SRSs if played into a system with the specified transfer functions. It uses a phase-matching approach to compute a preferred phasing between responses that are not specified by the SRS functions. It then uses the transfer functions to solve for drive signals that will achieve those desired responses.

Parameters
  • transfer_function (TransferFunctionArray) – The transfer functions to use in the MIMO calculation

  • sample_rate (float) – The number of samples per second in the output signal

  • block_size (int) – The number of samples in the output signal

  • srs_damping (float, optional) – The damping used in SRS computations. The default is 0.03.

  • num_time_constants (int, optional) – Number of decay time constants in the signal. One of this, tau, or sine_decays must be specified.

  • tau (float, optional) – The decay constant for the sine waves. One of this, num_time_constants, or sine_decays must be specified.

  • sine_decays (ndarray, optional) – An array of sine decay terms as used in the decayed sine table. One of this, num_time_constants, or tau must be specified.

  • rcond (float, optional) – A regularization parameter used on the MIMO inverse problem. The default is no regularization.

  • accuracy_weight (float, optional) – A weighting factor to give to the accuracy of the MIMO solution. The default is 1.

  • input_weight (float, optional) – A weighting factor to give to the magnitude of the drive signal in the MIMO solution. The default is 0.

  • return_drive_signal (bool, optional) – If True, return the calculated drive signal. The default is True.

  • return_drive_table (bool, optional) – If True, return a DecayedSineTable containing the parameters of the drive signal. The default is False.

  • return_projected_srs (bool, optional) – If True, compute the response SRS achieved from the computed drive signal. The default is False.

  • return_optimization_result (bool, optional) – If True, return the optimization results. The default is False.

  • return_complex_targets (bool, optional) – If True, return the complex targets of the MIMO calculation. The default is False.

Returns

  • drive_signal (TimeHistoryArray) – A time history that when played through the transfer functions will produce the specified SRS. Only returned if return_drive_signal is True.

  • drive_table (DecayedSineTable) – A table containing frequency, amplitude, delay, and decay parameters for each signal. Only returned if return_drive_table is True.

  • projected_srs (ShockResponseSpectrumArray) – A SRS computed from the predicted response of playing the drive signal through the provided transfer functions. Only returned if return_projected_srs is True.

  • optimization_result (list of OptimizationResult) – A set of results from the nonlinear optimizers. Only returned if return_optimization_result is True.

  • complex_targets (ndarray) – The complex amplitudes of the response signals that were targeted by the MIMO computation. Only returned if return_complex_targets is True.

plot(one_axis: bool = True, subplots_kwargs: dict = {}, plot_kwargs: dict = {}, abscissa_markers=None, abscissa_marker_labels=None, abscissa_marker_type='vline', abscissa_marker_plot_kwargs={})[source]

Plot the shock response spectrum

Parameters
  • one_axis (bool, optional) – Set to True to plot all data on one axis. Set to False to plot data on multiple subplots. one_axis can also be set to a matplotlib axis to plot data on an existing axis. The default is True.

  • subplots_kwargs (dict, optional) – Keywords passed to the matplotlib subplots function to create the figure and axes. The default is {}.

  • plot_kwargs (dict, optional) – Keywords passed to the matplotlib plot function. The default is {}.

  • abscissa_markers (ndarray, optional) – Array containing abscissa values to mark on the plot to denote significant events.

  • abscissa_marker_labels (str or ndarray) – Array of strings to label the abscissa_markers with, or alternatively a format string that accepts index and abscissa inputs (e.g. ‘{index:}: {abscissa:0.2f}’). By default no label will be applied.

  • abscissa_marker_type (str) – The type of marker to use. This can either be the string ‘vline’ or a valid matplotlib symbol specifier (e.g. ‘o’, ‘x’, ‘.’).

  • abscissa_marker_plot_kwargs (dict) – Additional keyword arguments used when plotting the abscissa label markers.

Returns

axis – On which the data were plotted

Return type

matplotlib axis or array of axes

sum_decayed_sines(sample_rate, block_size, sine_frequencies=None, sine_tone_range=None, sine_tone_per_octave=None, sine_amplitudes=None, sine_decays=None, sine_delays=None, srs_damping=0.03, srs_type='MMAA', compensation_frequency=None, compensation_decay=0.95, number_of_iterations=3, convergence=0.8, error_tolerance=0.05, tau=None, num_time_constants=None, decay_resolution=None, scale_factor=1.02, acceleration_factor=1.0, plot_results=False, srs_frequencies=None, return_velocity=False, return_displacement=False, return_srs=False, return_sine_table=False, ignore_compensation_pulse=False, verbose=False)[source]

Generate a Sum of Decayed Sines signal given an SRS.

Note that there are many approaches to do this, with many optional arguments so please read the documentation carefully to understand which arguments must be passed to the function.

Parameters
  • sample_rate (float) – The sample rate of the generated signal.

  • block_size (int) – The number of samples in the generated signal.

  • sine_frequencies (np.ndarray, optional) – The frequencies of the sine tones. If this argument is not specified and the sine_tone_range argument is not specified, then the sine_tone_range will be set to the maximum and minimum abscissa value for this ShockResponseSpectrumArray.

  • sine_tone_range (np.ndarray, optional) – A length-2 array containing the minimum and maximum sine tone to generate. If this argument is not specified and the sine_frequencies argument is not specified, then the sine_tone_range will be set to the maximum and minimum abscissa value for this ShockResponseSpectrumArray.

  • sine_tone_per_octave (int, optional) – The number of sine tones per octave. If not specified along with sine_tone_range, then a default value of 4 will be used if the srs_damping is >= 0.05. Otherwise, the formula of sine_tone_per_octave = 9 - srs_damping*100 will be used.

  • sine_amplitudes (np.ndarray, optional) – The initial amplitude of the sine tones used in the optimization. If not specified, they will be set to the value of the SRS at each frequency divided by the quality factor of the SRS.

  • sine_decays (np.ndarray, optional) – An array of decay value time constants (often represented by variable tau). Tau is the time for the amplitude of motion to decay 63% defined by the equation 1/(2*np.pi*freq*zeta) where freq is the frequency of the sine tone and zeta is the fraction of critical damping. If not specified, then either the tau or num_time_constants arguments must be specified instead.

  • sine_delays (np.ndarray, optional) – An array of delay values for the sine components. If not specified, all tones will have zero delay.

  • srs_damping (float, optional) – Fraction of critical damping to use in the SRS calculation (e.g. you should specify 0.03 to represent 3%, not 3). If not defined, a default of 0.03 will be used.

  • srs_type (int or str) –

    The type of spectrum desired: This can be an integer or a string. If srs_type is an integer: if srs_type > 0 (pos) then the SRS will be a base acceleration-absolute acceleration model If srs_type < 0 (neg) then the SRS will be a base acceleration-relative displacement model (expressed in equivalent static acceleration units). If abs(srs_type) is:

    1–positive primary, 2–negative primary, 3–absolute maximum primary 4–positive residual, 5–negative residual, 6–absolute maximum residual 7–largest of 1&4, maximum positive, 8–largest of 2&5, maximum negative 9 – maximax, the largest absolute value of 1-8

    10 – returns a matrix s(9,length(fn)) with all the types 1-9.

  • compensation_frequency (float) – The frequency of the compensation pulse. If not specified, it will be set to 1/3 of the lowest sine tone

  • compensation_decay (float) – The decay value for the compensation pulse. If not specified, it will be set to 0.95.

  • number_of_iterations (int, optional) – The number of iterations to perform. At least two iterations should be performed. 3 iterations is preferred, and will be used if this argument is not specified.

  • convergence (float, optional) – The fraction of the error corrected each iteration. The default is 0.8.

  • error_tolerance (float, optional) – Allowable relative error in the SRS. The default is 0.05.

  • tau (float, optional) – If a floating point number is passed, then this will be used for the sine_decay values. Alternatively, a dictionary can be passed with the keys containing a length-2 tuple specifying the minimum and maximum frequency range, and the value specifying the value of tau within that frequency range. If this latter approach is used, all sine_frequencies must be contained within a frequency range. If this argument is not specified, then either sine_decays or num_time_constants must be specified instead.

  • num_time_constants (int, optional) – If an integer is passed, then this will be used to set the sine_decay values by ensuring the specified number of time constants occur in the block_size. Alternatively, a dictionary can be passed with the keys containing a length-2 tuple specifying the minimum and maximum frequency range, and the value specifying the value of num_time_constants over that frequency range. If this latter approach is used, all sine_frequencies must be contained within a frequency range. If this argument is not specified, then either sine_decays or tau must be specified instead.

  • decay_resolution (float, optional) – A scalar identifying the resolution of the fractional decay rate (often known by the variable zeta). The decay parameters will be rounded to this value. The default is to not round.

  • scale_factor (float, optional) – A scaling applied to the sine tone amplitudes so the achieved SRS better fits the specified SRS, rather than just touching it. The default is 1.02.

  • acceleration_factor (float, optional) – Optional scale factor to convert acceleration into velocity and displacement. For example, if sine amplitudes are in G and displacement is desired in inches, the acceleration factor should be set to 386.089. If sine amplitudes are in G and displacement is desired in meters, the acceleration factor should be set to 9.80665. The default is 1, which assumes consistent units (e.g. acceleration in m/s^2, velocity in m/s, displacement in m).

  • plot_results (bool, optional) – If True, a figure will be plotted showing the acceleration, velocity, and displacement signals, as well as the desired and achieved SRS.

  • srs_frequencies (np.ndarray, optional) – If specified, these frequencies will be used to compute the SRS that will be plotted when the plot_results value is True.

  • return_velocity (bool, optional) – If specified, a velocity signal will also be returned. Default is False

  • return_displacement (bool, optional) – If True, a displacement signal will also be returned. Default is False

  • return_srs (bool, optional) – If True, the SRS of the generated signal will also be returned

  • return_sine_table (bool, optional) – If True, a sine table will also be returned

  • ignore_compensation_pulse (bool, optional) – If True, the compensation pulse will not be used. Default is False.

  • verbose (True, optional) – If True, additional diagnostics will be printed to the console.

Returns

  • acceleration (TimeHistoryArray) – A TimeHistoryArray object containing an acceleration response that satisfies the SRS

  • velocity (TimeHistoryArray) – A TimeHistoryArray object containing the velocity corresponding to acceleration. Only returned if return_velocity is True.

  • displacement (TimeHistoryArray) – A TimeHistoryArray object containing the displacement corresponding to acceleration. Only returned if return_displacement is True.

  • srs (TimeHistoryArray) – A ShockResponseSpectrumArray containing the SRS of acceleration. This can be used to check against the original signal to identify how good the match is. Only returned if return_srs is True.

  • sine_table (DecayedSineTable) – A DecayedSineTable object containing the frequency, amplitude, delay, and decay parameters that are used to generate acceleration.