layout: default title: applySectBP parent: OMG Tools nav_order: 78 —
applySectBP
Description
applySectBP is a utility designed to apply sector-specific beam pattern (BP) corrections directly to sidescan (SS) trace data or reflectivity values within OMG-HDCS merged files. This tool acts as an intermediary processing step, allowing the removal of angular response effects (either Sonar Relative Angle (SRA) or Vertically Referenced Angle (VRA)) before other processing steps, thereby “de-corrupting” the SS data.
It reads beam patterns from files generated by newGetBP (single or multi-sector) and applies them as a gain correction to each sidescan sample or reflectivity value. The corrected data is then written to a new .ss_data_deSRA or .ss_data_deVRA file, or it updates the reflectivity field in the merged file.
Usage
applySectBP <input_omg_file(.merged)> [OPTIONS]
Arguments
| Option | Description | |
|---|---|---|
<input_omg_file(.merged)> | Required. The path to the input OMG-HDCS merged file. | |
-v | Enable verbose output. | |
-AUV_draft | Use AUV draft calculation (may override WLZ-Zloc draft). | |
-draft <val> | Specifies the draft (in meters) to use for launch angle calculations. | Auto-calculated from .param. |
-ymount <val> | Specifies the Y-mount offset (in meters) to use for launch angle calculations. | Auto-calculated from .param. |
-SRA | Apply corrections based on Sonar Relative Angle (SRA). This implies -sonar_relative. | |
-VRA | Apply corrections based on Vertically Referenced Angle (VRA). | |
-apply_to_REFL | Apply the BP correction directly to the reflectivity field of the beams in the merged file, instead of writing a new .ss_data file. | |
-use_deTVG | Indicates that the input sidescan file is already de-TVG corrected (e.g., .ss_data_deTVG). | |
-sonar_relative | Forces sonar-relative angle calculation (redundant if -SRA is used). | |
-multi_sector_bp <filename> | Specifies a multi-sector beam pattern file (output from newGetBP) to use for corrections. | |
-Apply_ACROSS_track_RBP_before_making_ss <filename> | Specifies a file for applying across-track Receiver Beam Pattern (RBP) corrections. | |
-Apply_ALONG_track_RBP_before_making_ss <filename> | Specifies a file for applying along-track Receiver Beam Pattern (RBP) corrections. | |
-SR_ATBP_ignore_within <deg> | Ignores the RBP correction within a specified sonar-relative incidence angle range (e.g., to ignore nadir). | |
-DN_offset <val> | Applies a constant Digital Number (DN) offset to the sidescan values after BP correction. |
Beam Pattern Source
| Option | Description | |—|—| | -beam_patt <filename> | Specifies a single beam pattern file to apply (used if multi_sector_bp is not used). |
How It Works
- Initialization & Argument Parsing: Sets up various flags and parameters for angle calculation, BP source, and output type.
- File Setup:
- Opens the input merged file (
.merged). - Reads
sonar_settingsand.paramfiles to get sonar configuration,draft_to_use, andyoffset_to_use. - Opens the
.sectorsfile to read transmit sector definitions. - Opens the
.orientationfile to get attitude information for SRA/VRA calculations. - Loads the beam pattern(s) (
EM1000_Beam_Pattern,The_Sector_Beam_Pattern,The_Sector_Beam_Pattern_Across_SRBP,The_Sector_Beam_Pattern_Along_SRBP) based on chosen options (-beam_patt,-multi_sector_bp,-Apply_ACROSS_track_RBP_before_making_ss, etc.).
- Opens the input merged file (
- Output File Configuration:
- If
-apply_to_REFLis not used, it opens the input.ss_datafile (or.ss_data_deTVGif-use_deTVG) for reading and creates a new output.ss_data_deSRAor.ss_data_deVRAfile for writing corrected sidescan traces.
- If
- Profile Iteration: Loops through each profile (ping) in the merged file:
- Reads the current profile header and raw beams.
- Draft/Y-offset Update: Updates
draft_to_useifGA_AUV_draftis active. - Attitude Time Synchronization: Syncs the current ping’s time with attitude records from the
.orientationfile for SRA/VRA calculations if necessary. - Loads transmit sector definitions for the current ping.
- Beam Iteration: For each beam within the current ping:
- Launch Angle Calculation: Calculates the
launch_angle(either SRA or VRA) usingsimple_get_launch_anglebased on sonar parameters, draft, y-offset, and attitude. - Beam Pattern Gain Retrieval: Retrieves the
BP_gainfrom the loaded beam pattern(s) based on the calculatedlaunch_angle. If multi-sector BP is used, it determines the correct sector’s BP to apply. - Apply Correction:
- If
-apply_to_REFLis used, it updates thebeams[k].calibratedBackscatterby addingBP_gainandDN_offset. - Otherwise, it reads the raw sidescan trace for the beam from the input
.ss_datafile, appliesBP_gainandDN_offsetto each sample, and writes the modified trace to the output.ss_data_deSRAor.ss_data_deVRAfile.
- If
- Launch Angle Calculation: Calculates the
- In-Place Modification (for
-apply_to_REFL) or New File Creation:- If
-apply_to_REFLis used, the merged file is modified in place. - Otherwise, a new sidescan data file is created with the corrected traces.
- If
Output Files
- The input merged file may be modified in-place if
-apply_to_REFLis used. - A new sidescan data file:
<input_omg_file_prefix>.ss_data_deSRAor<input_omg_file_prefix>.ss_data_deVRA.
Dependencies
OMG_HDCS_jversion.h: For OMG-HDCS data structures.support.h: For general utility functions and error handling.j_proj.h: For coordinate projection functions.j_generic_beam_pattern.h: For beam pattern structures and loading.j_get_launch_angle.h: For launch angle calculation.
Notes
This tool is crucial for achieving accurate and consistent backscatter data by removing the sonar’s intrinsic angular response. The choice between SRA and VRA correction depends on the sonar system and the specific goals of the backscatter processing. Careful selection of beam pattern files (e.g., from newGetBP) is essential for effective correction.
How It Works
- Initialization & Argument Parsing: Sets up various flags and parameters for angle calculation, BP source, and output type.
- File Setup:
- Opens the input merged file (
.merged). - Reads
sonar_settingsand.paramfiles to get sonar configuration,draft_to_use, andyoffset_to_use. - Opens the
.sectorsfile to read transmit sector definitions. - Opens the
.orientationfile to get attitude information for SRA/VRA calculations. - Loads the beam pattern(s) (
EM1000_Beam_Pattern,The_Sector_Beam_Pattern,The_Sector_Beam_Pattern_Across_SRBP,The_Sector_Beam_Pattern_Along_SRBP) based on chosen options (-beam_patt,-multi_sector_bp,-Apply_ACROSS_track_RBP_before_making_ss, etc.).
- Opens the input merged file (
- Output File Configuration:
- If
-apply_to_REFLis not used, it opens the input.ss_datafile (or.ss_data_deTVGif-use_deTVG) for reading and creates a new output.ss_data_deSRAor.ss_data_deVRAfile for writing corrected sidescan traces.
- If
- Profile Iteration: Loops through each profile (ping) in the merged file:
- Reads the current profile header and raw beams.
- Draft/Y-offset Update: Updates
draft_to_useifGA_AUV_draftis active. - Attitude Time Synchronization: Syncs the current ping’s time with attitude records from the
.orientationfile for SRA/VRA calculations if necessary. - Loads transmit sector definitions for the current ping.
- Beam Iteration: For each beam within the current ping:
- Launch Angle Calculation: Calculates the
launch_angle(either SRA or VRA) usingsimple_get_launch_anglebased on sonar parameters, draft, y-offset, and attitude. - Beam Pattern Gain Retrieval: Retrieves the
BP_gainfrom the loaded beam pattern(s) based on the calculatedlaunch_angle. If multi-sector patterns are used, it determines the correct sector’s BP to apply. - Apply Correction:
- If
-apply_to_REFLis used, it updates thebeams[k].calibratedBackscatterby addingBP_gainandDN_offset. - Otherwise, it reads the raw sidescan trace for the beam from the input
.ss_datafile, appliesBP_gainandDN_offsetto each sample, and writes the modified trace to the output.ss_data_deSRAor.ss_data_deVRAfile.
- If
- Launch Angle Calculation: Calculates the
- In-Place Modification (for
-apply_to_REFL) or New File Creation:- If
-apply_to_REFLis used, the merged file is modified in place. - Otherwise, a new sidescan data file is created with the corrected traces.
- If
- Cleanup: Closes all open files.