Skip to content

Analysis Module

Analysis functions for frequency domain analysis, transfer functions, and modal analysis.

FFT Analysis

calculate_fft

calculate_fft(time_data, time_range=None, window=None)

Parameters:

  • time_data (<TimeData> object) –

    time series data

  • time_range (list or ndarray, default: None ) –

    2x1 numpy array to specify data segment to use

  • window (str, default: None ) –

    window function name (e.g., 'hann', 'hamming', 'blackman'), or None for rectangular (boxcar) window

Transfer Functions

calculate_tf

calculate_tf(time_data, ch_in=0, time_range=None, window=None, N_frames=1, overlap=0.5)

Parameters:

  • time_data (<TimeData> object) –

    time series data

  • ch_in (int, default: 0 ) –

    index of input channel

  • time_range (list or ndarray, default: None ) –

    2x1 numpy array to specify data segment to use

  • window (None or str, default: None ) –

    apply filter to data before fft or not

  • N_frames (int, default: 1 ) –

    number of frames to average over

  • overlap (float, default: 0.5 ) –

    frame overlap fraction between 0 and 1

calculate_tf_averaged

calculate_tf_averaged(time_data_list, ch_in=0, time_range=None, window=None)

Calculates transfer function averaged across ensemble of timedata. Note that this expects a Python list of timedata objects.

Takes each time series as an independent measurement.

Intended for averaged transfer functions from separate measurements, e.g. impulse hammer tests.

Does not average data across sub-frames.

Parameters:

  • time_data_list (<TimeDataList> object) –

    a list of time series data

  • ch_in (int, default: 0 ) –

    index of input channel

  • time_range (list or ndarray, default: None ) –

    2x1 numpy array to specify data segment to use

  • window (None or str, default: None ) –

    type of window to use, default is None.

Cross-Spectrum Analysis

calculate_cross_spectrum_matrix

calculate_cross_spectrum_matrix(time_data, time_range=None, window=None, N_frames=1, overlap=0.5)

Compute the full cross-spectrum matrix and coherence matrix of a multi-channel TimeData block using Welch's method.

Equivalent to looping scipy.signal.csd (with scaling='spectrum') and scipy.signal.coherence over every channel pair, but vectorised: each segment is FFT'd once across all channels, and the cross-spectrum matrix is formed as a tensor outer product conj(X[:,f,i]) * X[:,f,j] averaged over segments. Output is byte-equivalent to the scipy reference to within FFT round-off.

Parameters:

  • time_data (<TimeData> object) –

    time series data

  • time_range (list or ndarray, default: None ) –

    2x1 numpy array to specify data segment to use

  • window (None or str, default: None ) –

    window function name; None defaults to 'boxcar'

  • N_frames (int, default: 1 ) –

    number of frames to average over

  • overlap (float, default: 0.5 ) –

    frame overlap fraction between 0 and 1

calculate_cross_spectra_averaged

calculate_cross_spectra_averaged(time_data_list, time_range=None, window=None)

Calculates cross spectra averaged across ensemble of time_data_list. Note that this expects a of objects.

Takes each time series as an independent measurement.

Intended for averaged transfer functions from separate measurements, e.g. impulse hammer tests.

Does not average data across sub-frames.

Parameters:

  • time_data_list (<TimeDataList> object) –

    a list of time series data

  • time_range (list or ndarray, default: None ) –

    2x1 numpy array to specify data segment to use

  • window (None or str, default: None ) –

    type of window to use, default is None.

Time-Frequency Analysis

calculate_sonogram

calculate_sonogram(time_data, nperseg=None, noverlap=None)

calculate_damping_from_sono

calculate_damping_from_sono(time_data, n_chan=1, nperseg=None, start_time=None)

Calculate damping from sonogram data.

Parameters:

  • time_data (<TimeData> object) –

    time series data

  • n_chan (int, default: 1 ) –

    channel index to analyze, default is 1

  • nperseg (int, default: None ) –

    number of samples per segment for spectrogram

  • start_time (float, default: None ) –

    start time for analysis

Returns:

  • fn ( ndarray ) –

    array of natural frequencies (Hz)

  • Qn ( ndarray ) –

    array of Q factors (1/(2*zeta))

  • fit_data ( dict ) –

    dict containing data needed for plotting the fits: - 't': time axis - 'fits': list of dicts, each with keys: - 't_fit': time values for the fit region - 'real_fit': fitted real part values - 'real_data': actual real part data values - 'f_peak': peak frequency (Hz) - 'Qn': Q factor for this mode

Signal Processing

multiply_by_power_of_iw

multiply_by_power_of_iw(data, power, channel_list)

clean_impulse

clean_impulse(time_data, ch_impulse=0)

Sets all data outside of impulse to zero.

Pulse width is estimated by assuming half cosine impulse, using width of half peak amplitude.

Data before peak is unchanged. Data after estimated end of impulse is ramped to zero using half cosine pulse of width 10x estimated pulse width.

best_match

best_match(tf_data_list, freq_range=None, set_ref=0, ch_ref=0)

Parameters:

  • tf_data_list (<TfDataList> object) –

    transfer function data

  • freq_range (list or ndarray, default: None ) –

    2x1 numpy array to specify data segment to use

  • set_ref (int, default: 0 ) –

    reference set index, default is 0

  • ch_ref (int, default: 0 ) –

    reference channel index, default is 0

Helper Functions

func_real

func_real(t, A, B, N)

func_imag

func_imag(t, W, C)