graph_noise

Overview

graph_noise converts binary stacked floating-point noise files generated by mr1_noise (containing 20,000-sample port and starboard amplitude and phase arrays) into formatted ASCII plot files or 2-column ASCII tables (-list) with spike interpolation.

Usage

graph_noise (-verbose) (-len 12) (-port | -stbd | -both | -list) (-phase) (-packet) \
            bin_noise_filename ASCII_filename

CLI Options

Flag Arguments Default Description
<bin_noise_filename> <path> required First positional argument: input binary stacked noise file from mr1_noise.
<ASCII_filename> <path> required Second positional argument: output ASCII plot or list file.
-both none default Output a 2-parameter plot file (20000 points of sample_index port_ampl stbd_ampl).
-port none 0 Output a 10-panel stacked plot of port array noise (10 segments of 1833 samples each).
-stbd none 0 Output a 10-panel stacked plot of starboard array noise (10 segments of 2000 samples each).
-list none 0 Output a 2-column integer table (port_ampl stbd_ampl) of tot_samples rows after interpolating out-of-range spikes (< 0 or > 999) from neighboring samples.
-len <seconds> 20 (20000 samples) Ping listen length in seconds (tot_samples = seconds * 1000 at 1 kHz sample rate).
-phase none 0 (amplitude) Read the second pair of tot_samples float arrays in the noise file (port and starboard phase in [-180, 180] degrees) instead of amplitude.
-packet none 0 Insert synthetic tick marks (1 and 649) every 64 samples (i % 64 == 0) to mark MR1 64-sample telemetry packet boundaries.
-verbose none 0 Enable verbose flag.

How It Works

  1. Binary Array Reading: Reads tot_samples * sizeof(float) bytes for port_ampl and stbd_ampl from <bin_noise_filename>. If -phase is specified, reads a second pair of tot_samples float arrays to overwrite port_ampl and stbd_ampl with the stacked phase arrays.
  2. Packet Boundary Marking & Spike Despiking: If -packet is set, marks every 64th sample. In -list mode, replaces any sample outside [0, 999] with the average of its immediate neighbors (x[i-1] + x[i+1]) / 2 (or i-2 and i+2) before writing port_ampl stbd_ampl.
  3. Plot Formatting: In -both, -port, or -stbd modes, writes page dimensions (22.0 29.0), parameter counts, X/Y axis limits, and multi-column sample rows for plotting.

Practical Examples

Export a cleaned 12-second port/starboard noise table for plotmr1 -load

graph_noise -len 12 -list noise_data.file noise_12s.txt