endaq.batch
¶
- class endaq.batch.GetDataBuilder(*, preferred_chs=[], accel_highpass_cutoff, accel_start_time=None, accel_end_time=None, accel_start_margin=None, accel_end_margin=None, accel_integral_tukey_percent=0, accel_integral_zero='start')¶
The main interface for calculations in
endaq.batch
.This object has two types of functions:
configuration functions - these determine what calculations will be performed on IDE recordings, and pass in any requisite parameters for said calculations. This includes the following functions:
execution functions - these functions take recording files as parameters, perform the configured calculations on the data therein, and return the calculated data as a
OutputStruct
object that wraps pandas objects.This includes the functions
_get_data()
&aggregate_data()
, which operates on one & multiple file(s), respectively.
A typical use case will look something like this:
filenames = [...] calc_output = ( GetDataBuilder(accel_highpass_cutoff=1) .add_psd(freq_bin_width=1) .add_pvss(init_freq=1, bins_per_octave=12) .add_pvss_halfsine_envelope() .add_metrics() .add_peaks(margin_len=100) .add_vc_curves(init_freq=1, bins_per_octave=3) .aggregate_data(filenames) ) file_data = calc_output.dataframes
- Parameters:
preferred_chs – a sequence of channels; each channel listed is prioritized over others of the same type of physical measurement (e.g., acceleration, temperature, pressure, etc.)
accel_highpass_cutoff – the cutoff frequency used when pre-filtering acceleration data
accel_start_time – the relative timestamp before which to reject recording data; cannot be used in conjunction with accel_start_margin
accel_end_time – the relative timestamp after which to reject recording data; cannot be used in conjunction with accel_end_margin
accel_start_margin – the number of samples before which to reject recording data; cannot be used in conjunction with accel_start_time
accel_end_margin – the number of samples after which to reject recording data; cannot be used in conjunction with accel_end_time
accel_integral_tukey_percent – the alpha parameter of a Tukey window applied to the acceleration before integrating into velocity & displacement; see the tukey_percent parameter in
endaq.calc.integrate.integrals()
for detailsaccel_integral_zero – the output quantity driven to zero when integrating the acceleration into velocity & displacement; see the zero parameter in
endaq.calc.integrate.integrals()
for details
- add_metrics(include=[], exclude=[])¶
Add broad channel metrics to the calculation queue.
The output units for each metric are listed below:
RMS Acceleration:
RMS Velocity:
RMS Displacement:
Peak Absolute Acceleration:
Peak Pseudo Velocity Shock Spectrum:
GPS Position:
GPS Speed:
RMS Angular Velocity:
RMS Microphone:
Average Temperature:
Average Pressure:
Average Relative Humidity:
where G is the acceleration of gravity
- add_peaks(margin_len=1000)¶
Add windows about the acceleration’s peak value to the calculation queue.
calculation output units:
, where G is the acceleration of gravity- Parameters:
margin_len (int) – the number of samples on each side of a peak to include in the windows
- add_psd(freq_bin_width=None, freq_start_octave=None, bins_per_octave=None, window=None)¶
Add the acceleration PSD to the calculation queue.
calculation output units:
, where G is the acceleration of gravity- Parameters:
freq_bin_width (float | None) – the desired spacing between adjacent PSD samples; a default is provided only if bins_per_octave is used, otherwise this parameter is required
freq_start_octave (float | None) – the first frequency to use in octave-spacing; this is only used if bins_per_octave is set
bins_per_octave (float | None) – the number of frequency bins per octave in a log-spaced PSD; if not set, the PSD will be linearly-spaced as specified by freq_bin_width
window (str | None) – the window type used in the PSD calculation; see the documentation for
scipy.signal.welch
for details
- add_pvss(init_freq=1.0, bins_per_octave=3.0)¶
Add the acceleration PVSS (Pseudo Velocity Shock Spectrum) to the calculation queue.
calculation output units:
- Parameters:
init_freq (float) – the first frequency sample in the spectrum
bins_per_octave (float) – the number of samples per frequency octave
- add_pvss_halfsine_envelope(tstart=None, tstop=None, dt=None, tpulse=None)¶
Add the half-sine envelope for the acceleration’s PVSS (Pseudo Velocity Shock Spectrum) to the calculation queue.
calculation output units:
- add_vc_curves(init_freq=1.0, bins_per_octave=3.0)¶
Add Vibration Criteria (VC) Curves to the calculation queue.
calculation output units:
- Parameters:
init_freq (float) – the first frequency
bins_per_octave (float) – the number of samples per frequency octave
- aggregate_data(filenames)¶
Compile configured data from the given files into a dataframe.
- Parameters:
filenames – a sequence of paths of recording files to process
- class endaq.batch.core.OutputStruct(data)¶
A data wrapper class with methods for common export operations.
Objects of this class are generated by
GetDataBuilder.aggregate_data()
. This class is not intended be instantiated manually.- dataframes¶
- to_csv_folder(folder_path)¶
Write data to a folder as CSV’s.
- Parameters:
folder_path – the output directory path for .CSV files
- to_html_plots(folder_path=None, show=False, theme='endaq')¶
Generate plots in HTML.
- Parameters:
folder_path – The output directory for saving .HTML plots. If None (default), plots are not saved.
show (bool) – Whether to open plots after generation. Defaults to False.
theme (Literal[None, 'endaq', 'endaq_light', 'endaq_arial', 'endaq_light_arial']) – The enDAQ plotly theme to use; see
endaq.plot.utilities.set_theme()
for details on the supported options. Defaults to “endaq”. If None, the default Plotly theme is used.