# 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)
.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 details

• accel_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

The output units for each metric are listed below:

 RMS Acceleration: $$\text{G}$$ RMS Velocity: $$\frac{\text{mm}}{\text{sec}}$$ RMS Displacement: $$\text{mm}$$ Peak Absolute Acceleration: $$\text{G}$$ Peak Pseudo Velocity Shock Spectrum: $$\frac{\text{mm}}{\text{sec}}$$ GPS Position: $$\text{degrees}$$ GPS Speed: $$\frac{\text{km}}{\text{hr}}$$ RMS Angular Velocity: $$\frac{\text{degrees}}{\text{sec}}$$ RMS Microphone: $$\text{Pascals}$$ Average Temperature: $${}^{\circ} \text{C}$$ Average Pressure: $$\text{Pascals}$$ Average Relative Humidity: $$\text{%}$$

where G is the acceleration of gravity $$\left( 1 \text{G} \approx 9.80665 \frac{ \text{m} }{ \text{sec}^2 } \right)$$

calculation output units: $$\text{G}$$, where G is the acceleration of gravity $$\left( 1 \text{G} \approx 9.80665 \frac{ \text{m} }{ \text{sec}^2 } \right)$$

Parameters

margin_len (int) – the number of samples on each side of a peak to include in the windows

Add the acceleration PSD to the calculation queue.

calculation output units: $$\frac{\text{G}^2}{\text{Hz}}$$, where G is the acceleration of gravity $$\left( 1 \text{G} \approx 9.80665 \frac{ \text{m} }{ \text{sec}^2 } \right)$$

Parameters
• freq_bin_width (Optional[float]) – 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 (Optional[float]) – the first frequency to use in octave-spacing; this is only used if bins_per_octave is set

• bins_per_octave (Optional[float]) – 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 (Optional[str]) – the window type used in the PSD calculation; see the documentation for scipy.signal.welch for details

Add the acceleration PVSS (Pseudo Velocity Shock Spectrum) to the calculation queue.

calculation output units: $$\frac{\text{mm}}{\text{sec}}$$

Parameters
• init_freq (float) – the first frequency sample in the spectrum

• bins_per_octave (float) – the number of samples per frequency octave

Add the half-sine envelope for the acceleration’s PVSS (Pseudo Velocity Shock Spectrum) to the calculation queue.

calculation output units: $$\frac{\text{mm}}{\text{sec}}$$

Add Vibration Criteria (VC) Curves to the calculation queue.

calculation output units: $$\frac{\text{μm}}{\text{sec}}$$

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.