This folder contains four Python scripts for analyzing vibration data from PCE-VDL 24L 3-axis sensor.
Quick guide:
gui_vibro.pyfor interactive file pick + time window + plots + metrics.gui_vibro_log.pyfor GUI analysis plus ArduPilot log overlay + G clip.analyze_vibro.pyfor batch spectra/spectrograms with automatic segmentation.interactive_spectrogram.pyfor interactive spectrograms in HTML.quantify_vibro.pyto compare vibration metrics across tests.
- Python 3.10+
- Packages:
numpy,scipy,matplotlib - Optional (for interactive HTML):
plotly
Install dependencies:
python -m pip install numpy scipy matplotlib plotlyBatch analysis: spectra + spectrograms + automatic segmentation.
Basic usage:
python analyze_vibro.py vibro_sens_long.csvOutputs are written to:
analysis_outputs/<file-base>/
Energy-based segmentation (adaptive threshold):
python analyze_vibro.py vibro_sens_long.csv \
--segment-mode energy \
--energy-k 6 \
--min-segment-sec 10 \
--min-gap-sec 10Manual time window (seconds from start):
python analyze_vibro.py vibro_sens_long.csv \
--segment-mode manual \
--segment-start 12.5 \
--segment-end 38.0Key options:
--segment-mode gap|energy|manual(default: gap)--segment-start/--segment-end(manual window in seconds)--energy-k(MAD multiplier for energy thresholding)--min-segment-sec(minimum flight duration)--min-gap-sec(minimum gap between flights)--energy-window-sec(RMS smoothing window)--clip-g(cap acceleration values to +/- this threshold in g)--output-dir(custom output folder)
Outputs include:
*_segmentN_spectrum.png*_segmentN_spectrogram.png*_combined_spectrogram.png*_summary.txt
Interactive spectrogram viewer. Works in headless mode via Plotly HTML.
Single axis (combined magnitude):
python interactive_spectrogram.py vibro_sens_long.csv --axis mag --plotly-out vibro_mag.htmlAll axes stacked:
python interactive_spectrogram.py vibro_sens_long.csv --axis all --plotly-out vibro_all_axes.htmlUseful options:
--axis ax|ay|az|mag|all--fmax 300(limit max frequency shown)--max-samples 300000(downsample for speed)--nperseg 2048 --noverlap 1536(STFT windowing)
Interactive time-range selection (Matplotlib GUI):
- Press
sto set range start at the cursor time. - Press
eto set range end at the cursor time. - Press
cto clear the selection. - When both are set, peak frequencies for the selected window are printed.
- The Matplotlib GUI backend does not work in headless environments. Use
--plotly-outto create an interactive HTML you can open in a browser.
Quantify vibration metrics to compare test setups.
Compare multiple files (ranked by RMS magnitude by default):
python quantify_vibro.py Test_1.csv Test_2.csv Test_3.csvPer-file time windows (place --start/--end after each file or folder):
python quantify_vibro.py Test_1.csv --start 10 --end 60 Test_2.csv --start 5 --end 40Sort by a different metric and save a summary CSV:
python quantify_vibro.py data\ --sort-by p95_mag --out-csv vibration_summary.csvCap acceleration values before metrics:
python quantify_vibro.py Test_1.csv Test_2.csv --clip-g 0.2Available metrics for sorting:
rms_mag(default)p95_magpeak_magcrest_factorduration_ssamples
GUI for selecting a CSV, choosing a time window, and generating spectra, spectrograms, and metrics.
Run:
python gui_vibro.pyFeatures:
- File picker + start/end input
- Preview magnitude vs time with hover readout
- Axis plots (spectrum + spectrogram) with hover readout
- Output images + summary metrics file
GUI for vibro analysis with an optional ArduPilot log overlay and G clipping.
Run:
python gui_vibro_log.pyExtra features:
- Optional ArduPilot CSV/BIN overlay (PWM/RPM on secondary axis) with time offset.
- Offset controls: entry + coarse/fine +/- buttons (clamped to +/- 360s).
- Separate PWM/RPM plot window.
- Overlay auto-starts at the first PWM change away from ~1100 (idle) to make alignment easier.
- Warning message when log time does not overlap vibro time (adjust offset).
- G clip (abs) [g] to cap values above a threshold for plots and metrics.
ArduPilot .bin support:
- Requires
pymavlink(python -m pip install pymavlink).
Existing examples:
- Combined spectrogram:
media/combined_spectrogram.png - Manual window outputs:
media/combined_spectrogram_manual_60_258.png,media/segment1_spectrum_manual_60_258.png,media/segment1_spectrogram_manual_60_258.png - Interactive stacked axes:
media/interactive_all_axes.png





