Internal constants

Internal constants

class bellhop.constants._File_Ext[source]

Strings to define file extensions.

Using this class avoids typos in the source. It is also used to loop through files to delete them when needed before/after Bellhop execution.

arr = '.arr'
ati = '.ati'
bty = '.bty'
log = '.log'
sbp = '.sbp'
shd = '.shd'
prt = '.prt'
ray = '.ray'
env = '.env'
ssp = '.ssp'
brc = '.brc'
trc = '.trc'
class bellhop.constants._Strings(*values)[source]

String definitions to avoid hard-coding magic strings in the source code

This helps prevent typos and permits autocomplete (if your editor is smart enough).

exe = 'bellhop.exe'
default = 'default'
none = 'none'
linear = 'linear'
spline = 'spline'
pchip = 'pchip'
nlinear = 'nlinear'
quadrilateral = 'quadrilateral'
hexahedral = 'hexahedral'
curvilinear = 'curvilinear'
vacuum = 'vacuum'
acousto_elastic = 'acousto-elastic'
rigid = 'rigid'
from_file = 'from-file'
flat = 'flat'
line = 'line'
point = 'point'
hat_cartesian = 'hat-cartesian'
hat_ray = 'hat-ray'
gaussian_cartesian = 'gaussian-cartesian'
gaussian_ray = 'gaussian-ray'
omnidirectional = 'omnidirectional'
single_beam = 'single beam'
rectilinear = 'rectilinear'
irregular = 'irregular'
thorp = 'thorp'
francois_garrison = 'francois-garrison'
biological = 'biological'
nepers_per_meter = 'nepers per meter'
frequency_dependent = 'frequency dependent'
db_per_meter = 'dB per meter'
db_per_wavelength = 'dB per wavelength'
quality_factor = 'quality factor'
loss_parameter = 'loss parameter'
rays = 'rays'
eigenrays = 'eigenrays'
arrivals = 'arrivals'
coherent = 'coherent'
incoherent = 'incoherent'
semicoherent = 'semicoherent'
amplitude = 'amplitude'
amplitude_b = 'amplitude-binary'
class bellhop.constants._Maps[source]

Mappings from Bellhop single-char input file options to readable Python options

These are also defined with reverse mappings in the form:

>>> _Maps.soundspeed_interp["S"]
"spline"
>>> _Maps.soundspeed_interp_rev["spline"]
"S"
soundspeed_interp = {' ': _Strings.default, 'C': _Strings.linear, 'H': _Strings.hexahedral, 'N': _Strings.nlinear, 'P': _Strings.pchip, 'Q': _Strings.quadrilateral, 'S': _Strings.spline}
depth_interp = {'C': _Strings.curvilinear, 'L': _Strings.linear}
surface_interp = {'C': _Strings.curvilinear, 'L': _Strings.linear}
bottom_boundary_condition = {' ': _Strings.default, 'A': _Strings.acousto_elastic, 'F': _Strings.from_file, 'R': _Strings.rigid, 'V': _Strings.vacuum}
surface_boundary_condition = {' ': _Strings.default, 'A': _Strings.acousto_elastic, 'F': _Strings.from_file, 'R': _Strings.rigid, 'V': _Strings.vacuum}
attenuation_units = {' ': _Strings.default, 'F': _Strings.frequency_dependent, 'L': _Strings.loss_parameter, 'M': _Strings.db_per_meter, 'N': _Strings.nepers_per_meter, 'Q': _Strings.quality_factor, 'W': _Strings.db_per_wavelength}
volume_attenuation = {' ': _Strings.none, 'B': _Strings.biological, 'F': _Strings.francois_garrison, 'T': _Strings.thorp}
_bathymetry = {' ': _Strings.default, '*': _Strings.from_file, '_': _Strings.flat, '~': _Strings.from_file}
_altimetry = {' ': _Strings.default, '*': _Strings.from_file, '_': _Strings.flat, '~': _Strings.from_file}
source_type = {' ': _Strings.default, 'R': _Strings.point, 'X': _Strings.line}
_sbp_file = {' ': _Strings.default, '*': _Strings.from_file, 'O': _Strings.omnidirectional}
grid_type = {' ': _Strings.default, 'I': _Strings.irregular, 'R': _Strings.rectilinear}
beam_type = {' ': _Strings.default, 'B': _Strings.gaussian_cartesian, 'G': _Strings.hat_cartesian, '^': _Strings.hat_cartesian, 'b': _Strings.gaussian_ray, 'g': _Strings.hat_ray}
_single_beam = {' ': _Strings.default, 'I': _Strings.single_beam}
task = {'A': _Strings.amplitude, 'C': _Strings.coherent, 'E': _Strings.eigenrays, 'I': _Strings.incoherent, 'R': _Strings.rays, 'S': _Strings.semicoherent, 'a': _Strings.amplitude_b}
mode = {'C': _Strings.coherent, 'I': _Strings.incoherent, 'S': _Strings.semicoherent}
soundspeed_interp_rev = {_Strings.default: ' ', _Strings.hexahedral: 'H', _Strings.linear: 'C', _Strings.nlinear: 'N', _Strings.pchip: 'P', _Strings.quadrilateral: 'Q', _Strings.spline: 'S'}
depth_interp_rev = {_Strings.curvilinear: 'C', _Strings.linear: 'L'}
surface_interp_rev = {_Strings.curvilinear: 'C', _Strings.linear: 'L'}
bottom_boundary_condition_rev = {_Strings.acousto_elastic: 'A', _Strings.default: ' ', _Strings.from_file: 'F', _Strings.rigid: 'R', _Strings.vacuum: 'V'}
surface_boundary_condition_rev = {_Strings.acousto_elastic: 'A', _Strings.default: ' ', _Strings.from_file: 'F', _Strings.rigid: 'R', _Strings.vacuum: 'V'}
attenuation_units_rev = {_Strings.db_per_meter: 'M', _Strings.db_per_wavelength: 'W', _Strings.default: ' ', _Strings.frequency_dependent: 'F', _Strings.loss_parameter: 'L', _Strings.nepers_per_meter: 'N', _Strings.quality_factor: 'Q'}
volume_attenuation_rev = {_Strings.biological: 'B', _Strings.francois_garrison: 'F', _Strings.none: ' ', _Strings.thorp: 'T'}
_bathymetry_rev = {_Strings.default: ' ', _Strings.flat: '_', _Strings.from_file: '*'}
_altimetry_rev = {_Strings.default: ' ', _Strings.flat: '_', _Strings.from_file: '*'}
source_type_rev = {_Strings.default: ' ', _Strings.line: 'X', _Strings.point: 'R'}
grid_type_rev = {_Strings.default: ' ', _Strings.irregular: 'I', _Strings.rectilinear: 'R'}
beam_type_rev = {_Strings.default: ' ', _Strings.gaussian_cartesian: 'B', _Strings.gaussian_ray: 'b', _Strings.hat_cartesian: '^', _Strings.hat_ray: 'g'}
_single_beam_rev = {_Strings.default: ' ', _Strings.single_beam: 'I'}
task_rev = {_Strings.amplitude: 'A', _Strings.amplitude_b: 'a', _Strings.coherent: 'C', _Strings.eigenrays: 'E', _Strings.incoherent: 'I', _Strings.rays: 'R', _Strings.semicoherent: 'S'}
mode_rev = {_Strings.coherent: 'C', _Strings.incoherent: 'I', _Strings.semicoherent: 'S'}
class bellhop.constants.Defaults(model_name: str = 'bellhop', exe: str = 'bellhop.exe', beam_angle_halfspace: float = 90.0, beam_angle_fullspace: float = 180.0, env_comment_pad: int = 50, interference_mode: str = _Strings.coherent)[source]

Dataclass of hard-coded defaults used throughout the Bellhop interface.

model_name: str = 'bellhop'
exe: str = 'bellhop.exe'
beam_angle_halfspace: float = 90.0
beam_angle_fullspace: float = 180.0
env_comment_pad: int = 50
interference_mode: str = 'coherent'