plotAng2
Description
plotAng2 is a specialized plotting utility designed to visualize angular response data from multibeam sonars. It reads ASCII data files, typically generated by tools like jackTool or swathed, which contain angle and corresponding backscatter strength values. The tool then generates a PostScript plot of these angular responses.
It allows for plotting multiple datasets, defining custom plot ranges, and provides basic visualization for comparing angular response curves.
Usage
plotAng2 <infile(s)> [-outfile <filename.meta>] [-size <dx> <dy>] [-yrange <min> <max>] [OPTIONS]
Arguments
| Option | Description | |
|---|---|---|
<infile(s)> | Required. One or more paths to input ASCII files containing angular response data. | |
-outfile <filename.meta> | Specifies the output PostScript metafile name. | plot.meta |
-size <dx> <dy> | Specifies the total plot size in centimeters (X and Y dimensions). | 15.0 22.0 |
-yrange <min> <max> | Sets the Y-axis range (backscatter strength in dB). | -50.0 to 0.0 |
File Format Selection (Choose one)
| Option | Description | |—|—| | -jackTool | Interprets the input file as being from jackTool. | | -swathed | Interprets the input file as being from swathed. | | -delayed | (Present in USAGE but not implemented). |
Plot Customization
| Option | Description | |—|—| | -together | Plots multiple datasets on the same graph, overlapping. | | -sparse | (Not fully implemented) Intended for sparse plotting. | | -tit1 <string> / -tit2 <string> | Sets titles for the plot. | | -v | Enable verbose output (not explicitly used in provided code). | |
Input File Formats
JACKTOOLformat:- 8 header lines (read into
Stuff[]). - Then, for each of
NOVALSpoints:angle both rough(double, double, double).angle: Angle in degrees.both: Combined angular response.rough: Roughness.
- 8 header lines (read into
SWATHEDformat:- Various header lines (skipped by
fscanf). - Then, for each of
90points:angle both(double, double). This is read for both positive and negative angles.
- Various header lines (skipped by
How It Works
- Initialization: Parses command-line arguments to set plotting options, file formats, and ranges. Initializes a
plotlibPostScript output (plot.meta). - Plot Area Setup: Sets up the overall plot dimensions (
xlength,ylength,xoff,yoff). Draws the main plot border. - Title and Labels: If titles are provided, they are added to the plot.
- File Reading Loop: Loops through each input file specified:
- Opens the input ASCII file.
- Data Loading: Based on
file_format:- If
JACKTOOL: Reads 8 header lines and thenNOVALS(100) data points, each withangle,both, andrough. Convertsangleto relative to vertical (-90 to 90). - If
SWATHED: Reads several header lines, then90data points for positive angles (angle,both), and then mirrors them for negative angles.
- If
- Closes the input file.
- Plot Generation (using
plotliblibrary):- Draws the main plot border.
- If
file_format == JACKTOOLand notsparse_flag, it prints header information to the plot. - Axis and Labels: Draws X and Y axes with labels for “Backscatter Strength (dB)” and “Grazing Angle (degrees)”.
- Data Plotting:
- Iterates through the
NOVALSdata points. - If
together_flagis not set, it plots all data from the current file. Iftogether_flagis set, it only plots positive angles. - Plots
xval(angle) vs.yval(backscatter strength), drawing lines between valid data points. - For
SWATHEDformat, it plots points as diamonds. - For
JACKTOOLformat, it also plotsroughdata if applicable.
- Iterates through the
- Cleanup: Calls
plot_closeto finalize the PostScript output.
Output Files
<outfile.meta>: A PostScript metafile (.meta) containing plots of angular response curves.
Dependencies
plotlib.h: Forplotlibfunctions.support.h: For general utility functions.math.h: For mathematical functions.
Notes
This tool is effective for comparing the angular response of different sonar systems or of the same system under different environmental conditions. The ability to plot multiple curves on a single graph allows for easy visual comparison of different datasets. The --delayed option is present in usage but not implemented.