Code documentation
The FRF
class
- class pyFRF.FRF(sampling_freq, exc=None, resp=None, exc_type='f', resp_type='a', window='none', resp_delay=0.0, weighting='linear', fft_len=None, nperseg=None, noverlap=None, archive_time_data=False, frf_type='H1', copy=True, **kwargs)[source]
Perform Dual Channel Spectral Analysis
- __init__(sampling_freq, exc=None, resp=None, exc_type='f', resp_type='a', window='none', resp_delay=0.0, weighting='linear', fft_len=None, nperseg=None, noverlap=None, archive_time_data=False, frf_type='H1', copy=True, **kwargs)[source]
Initiates the Data class:
- Parameters:
sampling_freq (int, tuple(int), list[int]) – Sampling frequency of excitation and response signals. int - same sampling frequency for both excitation and response signals. tuple, list - different sampling frequencies for excitation and reponse signals. First element represents excitation, second element represents response sampling frequency.
exc (ndarray) – Excitation array. A 3D, 2D or 1D ndarray: 3D (general shape, allows multiple inputs (MIMO, MISO)): (number_of_measurements, excitation_DOFs, time_series). 2D (multiple measurements, single input): (number_of_measurements, time_series). 1D (single measurement, single input): (time_series).
resp (ndarray) – Response array. A 3D, 2D or 1D ndarray: 3D (general shape, allows, multiple outputs): (number_of_measurements, response_DOFs, time_series). 2D (multiple measurements, single output): (number_of_measurements, time_series). 1D (single measurement, single output): (time_series).
exc_type (str) – Excitation type, see _EXC_TYPES.
resp_type (str) – Response type, see _RESP_TYPES.
window (str, tuple(str), list[str]) – Scipy window used for cross power spectral desnity computation or excitation and reponse signals. see _WINDOWS. str - used for csd. tuple, list - first element is excitation signal window, second element is response signal window
resp_delay (float) – Response time delay (in seconds) with regards to the excitation.
weighting (str) – weighting type used for averaging with continous measurements - see _WGH_TYPES. If exponential weighting is used, specify the number of averages - example: ‘exponential:5’
fft_len (int) – The length of the FFT (zero-padding if longer than length of data), If None, freq length matches time length.
nperseg (int) – Optional segment length, by default one segment (data length) is analyzed.
noverlap (int) – Optional segment overlap, by default
noverlap = nperseg // 2
.archive_time_data (bool) – Archive the time data (this can consume a lot of memory).
frf_type (str) – Default frf type returned at self.get_frf(), see _FRF_TYPES.
copy (bool) – If true the excitation and response arrays are copied (if data is not copied the applied window affects the source arrays).
- add_data(exc, resp)[source]
Adds new data - called at object creation if excitation and response signals are given. Used also for continous data adding.
- Parameters:
exc – Excitation array.
resp – Response array.
- Returns:
True if data is added.
- is_data_ok(exc, resp, overflow_samples=3, double_impact_limit=0.001, verbose=0)[source]
Checks the data for overflow and double-impacts.
- Parameters:
exc – Excitation array.
resp – Response array.
overflow_samples (int) – Number of samples that need to be equal to max for overflow identification.
double_impact_limit (float) – Ratio of freqency content of the double vs single hit. Smaller number means more sensitivity
verbose (int) – Prints overflow and double impact status. 0 or 1.
- Returns:
True if data is ok, False if there is overflow or double impact present.
- Return type:
bool
- get_w_axis()[source]
Get angular freqency series.
- Returns:
Frequency ndarray in rad/s.
- Return type:
ndarray
- get_ods_frf()[source]
Operational deflection shape averaged estimator.
Numerical implementation of Equation (6) in [1].
- Literature:
- [1] Schwarz, Brian, and Mark Richardson. Measurements required for displaying
operating deflection shapes. Presented at IMAC XXII January 26 (2004): 29.
- Returns:
ODS FRF estimator.
- Return type:
ndarray
- get_resp_spectrum(amplitude_spectrum=True)[source]
Get response amplitude/power spectrum.
- Parameters:
amplitude_spectrum – True - get amplitude spectrum, False - power spectrum.
- Returns:
Response spectrum.
- Return type:
ndarray
- get_exc_spectrum(amplitude_spectrum=True)[source]
Get excitation amplitude/power spectrum.
- Parameters:
amplitude_spectrum – True - get amplitude spectrum, False - power spectrum.
- Returns:
Excitation spectrum.
- Return type:
ndarray
- get_H1()[source]
Get H1 FRF averaged estimator (receptance), preferable call via get_FRF().
- Returns:
H1 FRF estimator matrix (ndarray) of shape (response DOF, excitation DOF, freqency points).
- Return type:
ndarray
- get_H2()[source]
H2 FRF averaged estimator (receptance), preferable call via get_FRF().
- Returns:
H2 FRF estimator matrix (ndarray) of shape (response DOF, excitation DOF, freqency points).
- Return type:
ndarray
- get_Hv()[source]
Get Hv FRF averaged estimator (receptance), preferable call via get_FRF().
- Literature:
- [1] Kihong and Hammond: Fundamentals of Signal Processing for
Sound and Vibration Engineers, page 293.
- Returns:
Hv FRF estimator matrix (ndarray).
- Return type:
ndarray
- get_FRF(type='default', form='receptance')[source]
Returns the default FRF function set at init.
- Parameters:
type (str) – Choose default (as set at init) or H1, H2, Hv or ODS.
form (str) – Choose receptance, mobility, accelerance.
- Returns:
FRF estimator matrix (ndarray).
- Return type:
ndarray