Read/write parsers
This page documents the full at_py.readwrite package: binary and ASCII parsers,
format writers, and MAT helpers re-exported from submodules. It complements the
API reference page, which focuses on the client, runner, and core types.
- class at_py.readwrite.AltimetryRead(interp_type: str, range_m: ndarray, depth_m: ndarray, tangent_u: ndarray, normal_u: ndarray, segment_length_m: ndarray, segment_curvature: ndarray, tangent_node_u: ndarray | None, normal_node_u: ndarray | None)[source]
Bases:
object2D sea-surface altimetry from an
.atifile (ranges in m after km→m).
- class at_py.readwrite.BathymetryRead(interp_type: str, range_m: ndarray, depth_m: ndarray, tangent_u: ndarray, normal_u: ndarray, segment_length_m: ndarray, segment_curvature: ndarray, tangent_node_u: ndarray | None, normal_node_u: ndarray | None)[source]
Bases:
object2D bathymetry from a
.btyfile (ranges in m after km→m).
- class at_py.readwrite.Bdry3DRead(interp_type: str, x_km: ndarray, y_km: ndarray, z_km: ndarray)[source]
Bases:
object3D grid:
x_km,y_km, depthsz_kmshaped(n_y, n_x)(readbdry3d).
- class at_py.readwrite.BeamPatternRead(n_points: int, angle_deg: ndarray, power_linear: ndarray)[source]
Bases:
objectpower_linearis10 ** (dB / 20)per Matlabreadpat.
- class at_py.readwrite.Bellhop3DEnvTail(source_x_m: ndarray, source_y_m: ndarray, source_z_m: ndarray, receiver_z_m: ndarray, receiver_range_km: ndarray, receiver_theta_deg: ndarray, beam: BellhopBeamParams)[source]
Bases:
objectBellhop3D tail:
readsxsy,readszrz,readr,readtheta,read_bell.- beam: BellhopBeamParams
- class at_py.readwrite.BellhopBeamParams(run_type: str, nbeams: int, ibeam: int | None, alpha_deg: ndarray, nbeta: int | None, beta_deg: ndarray | None, deltas_m: float, box_z_m: float, box_r_km: float | None, box_x_km: float | None, box_y_km: float | None, beam_type_ms: str | None, epmult: float | None, r_loop: float | None, n_image: int | None, ib_win: int | None)[source]
Bases:
objectBellhop control block from
read_bell.m(partial — omits unused globals).
- class at_py.readwrite.BellhopEnvTail(source_z_m: ndarray, receiver_z_m: ndarray, receiver_range_km: ndarray, beam: BellhopBeamParams)[source]
Bases:
objectPost-core Bellhop 2D:
readszrz+readr+read_bell.- beam: BellhopBeamParams
- class at_py.readwrite.BioLayer(z1: float, z2: float, f0: float, q: float, a0: float)[source]
Bases:
objectBiological layer for Fortran
AttenModvolumeB(dB/km resonance parameters).
- class at_py.readwrite.EnvCore(title: str, freq_hz: float, ssp: SSP, bdry: Bdry)[source]
Bases:
objectCommon
.envheader: title, frequency, and full SSP plus boundary section.- bdry: Bdry
- ssp: SSP
- class at_py.readwrite.FieldFlp3DResult(title: str, opt: str, component: str, m_limit: int, source_x_m: ndarray, source_y_m: ndarray, n_sx: int, n_sy: int, source_z_m: ndarray, receiver_z_m: ndarray, receiver_range_m: ndarray, r_min_m: float, r_max_m: float, theta_deg: ndarray, node_x_m: ndarray, node_y_m: ndarray, mode_file_names: tuple[str, ...], elt_nodes: ndarray)[source]
Bases:
objectIn-memory
field3ddriver parameters from a.flpfile (read_flp3d.m).
- class at_py.readwrite.FieldFlpResult(title: str, opt: str, component: str, m_limit: int, r_prof_km: ndarray, n_prof: int, receiver_range_m: ndarray, source_z_m: ndarray, receiver_z_m: ndarray, range_offset_m: ndarray, n_range_offset: int)[source]
Bases:
objectIn-memory
fielddriver parameters from a.flpfile.
- class at_py.readwrite.KrakenEnvTail(c_low: float, c_high: float, r_max_km: float, source_z: ndarray, receiver_z: ndarray)[source]
Bases:
objectOptions after
read_env_corefor KRAKEN/SCOOTER/SPARC/BOUNCE (Matlabread_env.m).
- class at_py.readwrite.MatBundle(variables: dict[str, Any], source_format: Literal['mat_classic', 'mat_v7_3'], raw_backend: str, scipy_meta: dict[str, Any] | None = None)[source]
Bases:
objectNormalized top-level MATLAB variables.
- class at_py.readwrite.ModeHalfspace(bc: str, cp: complex128, cs: complex128, rho: float32, depth: float32)[source]
Bases:
objectTop/bottom acoustic half-space coefficients from binary
.mod(MatlabTop/Bot).- cp: complex128
- cs: complex128
- depth: float32
- rho: float32
- class at_py.readwrite.ModesAscReadResult(lrecl: int, title: str, freq: float, nmedia: int, ntot: int, nmat: int, num_modes: int, z: ndarray, k: ndarray, phi: ndarray)[source]
Bases:
objectParsed ASCII
.mod(Matlabread_modes_asc).
- class at_py.readwrite.ModesReadResult(title: str, nfreq: int, nmedia: int, ntot: int, nmat: int, n_per_medium: ndarray, mater: list[bytes], depth: ndarray, rho: ndarray, freq_vec: ndarray, z: ndarray, num_modes: int, top: ModeHalfspace, bot: ModeHalfspace, phi: ndarray, k: ndarray)[source]
Bases:
objectParsed
.modcontents for one frequency block.- bot: ModeHalfspace
- top: ModeHalfspace
- class at_py.readwrite.ParsedEnvBellhop(core: EnvCore, tail: BellhopEnvTail)[source]
Bases:
objectFull 2D Bellhop
.env: SSP/core plus Bellhop tail (sources, receivers, beam block).- tail: BellhopEnvTail
- class at_py.readwrite.ParsedEnvBellhop3D(core: EnvCore, tail: Bellhop3DEnvTail)[source]
Bases:
objectFull Bellhop3D
.env: core plus 3D source/receiver grids and beam block.- tail: Bellhop3DEnvTail
- class at_py.readwrite.ParsedEnvKraken(core: EnvCore, tail: KrakenEnvTail)[source]
Bases:
objectFull
.envparse for the KRAKEN-family tail section.- tail: KrakenEnvTail
- class at_py.readwrite.ParsedEnvRAM(title: str, freq_hz: float, zs_m: float, zr_m: float, rmax_m: float, dr: float, ndr: int, zmax: float, dz: float, ndz: int, zmplt: float, c0: float, n_pade: int, n_starter: int, rs: float, bathy_r_m: ndarray, bathy_z_m: ndarray, segments: tuple[RamSegment, ...])[source]
Bases:
objectParsed RAM
ram.in(inverse of Matlabwrite_env_RAM.mfor canonical output).- segments: tuple[RamSegment, ...]
- class at_py.readwrite.RamSegment(rp_m: float | None, z_m: ndarray, c_m: ndarray, sediment_cp: float, rho: float, attn_z_m: ndarray, attn_alpha: ndarray)[source]
Bases:
objectOne range-dependent SSP block (Matlab
write_env_RAMinner loop).
- class at_py.readwrite.RamTlGridPos(s_z: float, r_z: ndarray, r_r: ndarray)[source]
Bases:
objectVertical source depth and receiver depth/range grids for RAM
tl.grid(meters).
- class at_py.readwrite.RamTlGridResult(plot_title: str, plot_type: str, freq: float, atten: float, pos: RamTlGridPos, tl_db: ndarray, pressure_amp: ndarray)[source]
Bases:
objectRAM transmission-loss grid: TL (dB) and derived linear amplitude on a 2-D grid.
- pos: RamTlGridPos
- class at_py.readwrite.ReflectionCoeffRead(n_points: int, theta: ndarray, r: ndarray, phi_rad: ndarray)[source]
Bases:
objectAngles in radians (
phiconverted from degrees as in Matlab).
- class at_py.readwrite.SSP2DRead(n_prof: int, nssp: int, r_prof_km: ndarray, cmat: ndarray)[source]
Bases:
object2D sound-speed field:
cmatis(NSSP, NProf);r_prof_kmhas lengthNProf.
- class at_py.readwrite.SSP3DRead(nx: int, ny: int, nz: int, segx_km: ndarray, segy_km: ndarray, segz_km: ndarray, cmat: ndarray)[source]
Bases:
object3D SSP cube
cmatshape(Nz, Ny, Nx)(Matlabcmat(iz,:,:)isNy``×``Nx).
- class at_py.readwrite.ShdAscResult(plot_title: str, plot_type: str, freq_vec: ndarray, freq0: float, atten: float, theta: ndarray, source_z: ndarray, receiver_z: ndarray, receiver_r: ndarray, pressure: ndarray)[source]
Bases:
objectASCII shade file (port of Matlab
read_shd_asc.m).
- class at_py.readwrite.ShdPos(theta: ndarray, s: ShdPosS, r: ShdPosR, nsx: int, nsy: int, nsz: int, nrz: int, nrr: int, ntheta: int, nfreq: int)[source]
Bases:
objectAxes and counts for binary
.shd/read_shd_bingeometry (see MatlabPos).- r: ShdPosR
- s: ShdPosS
- class at_py.readwrite.ShdReadResult(title: str, plot_type: str, freq_vec: ndarray, freq0: float, atten: float, pos: ShdPos, pressure: ndarray)[source]
Bases:
objectBinary shade file payload: metadata, grids in
pos, and complex pressure field.
- class at_py.readwrite.TsPos(r: TsPosR)[source]
Bases:
objectNested position struct matching Matlab
Pos(here only receiver depths).
- class at_py.readwrite.TsPosR(z: ndarray)[source]
Bases:
objectReceiver depth vector for time-series output (meters, float64).
- class at_py.readwrite.TsReadResult(plot_title: str, pos: TsPos, tout: ndarray, rts: ndarray)[source]
Bases:
objectASCII time-series file: title, receiver depths, time vector, and RTS matrix.
- at_py.readwrite.format_ati(interp_type: str, range_km: ndarray, depth_m: ndarray) str[source]
Format a 2D Bellhop
.atifile (inverse ofparse_ati()for tabulated nodes).range_kmanddepth_mare internal file points only (km / meters), not the synthetic ±1e50 endpoints appended on read.
- at_py.readwrite.format_ati_bytes(interp_type: str, range_km: ndarray, depth_m: ndarray, *, encoding: str = 'utf-8') bytes[source]
UTF-8 (or other) bytes for
format_ati().
- at_py.readwrite.format_ati_from_read(a: AltimetryRead) str[source]
Serialize altimetry using internal nodes from
AltimetryRead(round-trip helper).
- at_py.readwrite.format_bdry3d(b: Bdry3DRead) str[source]
Format a Bellhop3D 3D boundary file (inverse of
parse_bdry3d()).
- at_py.readwrite.format_bdry3d_bytes(b: Bdry3DRead, *, encoding: str = 'utf-8') bytes[source]
Like
format_bdry3d()encoded to bytes.
- at_py.readwrite.format_bty(interp_type: str, range_km: ndarray, depth_m: ndarray) str[source]
Format a 2D Bellhop
.btyfile (inverse ofparse_bty()for tabulated nodes).range_kmanddepth_mare the internal file points only (km horizontal, depth positive down in meters), not the synthetic ±1e50 endpoints thatparse_bty()appends when reading.interp_typeis'L'(piecewise linear) or'C'(curvilinear).
- at_py.readwrite.format_bty_bytes(interp_type: str, range_km: ndarray, depth_m: ndarray, *, encoding: str = 'utf-8') bytes[source]
UTF-8 (or other) bytes for
format_bty().
- at_py.readwrite.format_bty_from_read(b: BathymetryRead) str[source]
Serialize bathymetry from
BathymetryReadinternal nodes (round-trip helper).
- at_py.readwrite.format_env_bellhop(p: ParsedEnvBellhop) str[source]
Format a 2D Bellhop
.env(inverse ofparse_env_bellhop()).
- at_py.readwrite.format_env_bellhop3d(p: ParsedEnvBellhop3D) str[source]
Format a Bellhop3D
.env(inverse ofparse_env_bellhop3d()).
- at_py.readwrite.format_env_bellhop3d_bytes(p: ParsedEnvBellhop3D, *, encoding: str = 'utf-8') bytes[source]
Like
format_env_bellhop3d()encoded to bytes.
- at_py.readwrite.format_env_bellhop_bytes(p: ParsedEnvBellhop, *, encoding: str = 'utf-8') bytes[source]
Like
format_env_bellhop()encoded to bytes.
- at_py.readwrite.format_env_core(core: EnvCore) str[source]
Format the core
.envblock (Matlabwrite_env/writesspcore section).
- at_py.readwrite.format_env_core_bytes(core: EnvCore, *, encoding: str = 'utf-8') bytes[source]
Like
format_env_core()encoded to bytes.
- at_py.readwrite.format_env_kraken(p: ParsedEnvKraken) str[source]
Format a KRAKEN-family
.env(inverse ofat_py.readwrite.env.parse_env_kraken()).
- at_py.readwrite.format_env_kraken_bytes(p: ParsedEnvKraken, *, encoding: str = 'utf-8') bytes[source]
Like
format_env_kraken()encoded to bytes.
- at_py.readwrite.format_env_ram(p: ParsedEnvRAM) str[source]
Serialize RAM
ram.in(inverse ofparse_env_ram()for canonical Matlab layout).
- at_py.readwrite.format_env_ram_bytes(p: ParsedEnvRAM, *, encoding: str = 'utf-8') bytes[source]
Like
format_env_ram()encoded to bytes.
- at_py.readwrite.format_field_flp(r: FieldFlpResult) str[source]
Format a FIELD 2D
.flpfile (inverse ofparse_field_flp()).Receiver range offsets must be zero (same restriction as the reader).
- at_py.readwrite.format_field_flp3d(r: FieldFlp3DResult) str[source]
Format a FIELD3D
.flpfile (inverse ofparse_field_flp3d()).
- at_py.readwrite.format_field_flp3d_bytes(r: FieldFlp3DResult, *, encoding: str = 'utf-8') bytes[source]
UTF-8 (or other) bytes for
format_field_flp3d().
- at_py.readwrite.format_field_flp_bytes(r: FieldFlpResult, *, encoding: str = 'utf-8') bytes[source]
UTF-8 (or other) bytes for
format_field_flp().
- at_py.readwrite.format_fields_flp(receiver_range_km: ndarray | Sequence[float]) str[source]
Minimal Scooter-style FIELD
.flptext (Matlabwrite_fieldsflp.m).Emits the
'RP'option and one line withrMin,rMax(km), andNRrfrommin(Pos.r.r),max(Pos.r.r), andlength(Pos.r.r). This is not the full FIELD driver fromread_flp/write_fieldflp.m; useformat_field_flp()for that.
- at_py.readwrite.format_fields_flp_bytes(receiver_range_km: ndarray | Sequence[float], *, encoding: str = 'utf-8') bytes[source]
UTF-8 (or other) bytes for
format_fields_flp().
- at_py.readwrite.format_fortran_vector_data_line(nx: int, x: ndarray | Sequence[float]) str[source]
Emit one data line for a readvector block (inverse of
read_fortran_vector()).
- at_py.readwrite.format_parsed_env(parsed: ParsedEnvKraken | ParsedEnvBellhop | ParsedEnvBellhop3D | ParsedEnvRAM) str[source]
Serialize a full
.envfromparse_read_env().
- at_py.readwrite.format_parsed_env_bytes(parsed: ParsedEnvKraken | ParsedEnvBellhop | ParsedEnvBellhop3D | ParsedEnvRAM, *, encoding: str = 'utf-8') bytes[source]
UTF-8 (or other) bytes for
format_parsed_env().
- at_py.readwrite.format_readvector_block(nx: int, x: ndarray | Sequence[float]) tuple[str, str][source]
Emit count line and data line for a Matlab
readvectorblock.
- at_py.readwrite.format_readvector_lines(nx: int, x: ndarray | Sequence[float]) str[source]
Two-line
readvectorsection (count, then data), newline-separated.
- at_py.readwrite.format_ssp2d(s: SSP2DRead) str[source]
Format a 2D SSPFIL text (inverse of
parse_ssp2d()).Emits
NProf, profile ranges (km), then sound speeds in the same flat order the parser expects (column-major block then transpose tocmat).
- at_py.readwrite.format_ssp3d(s: SSP3DRead) str[source]
Format a 3D SSPFIL text (inverse of
parse_ssp3d()).
- at_py.readwrite.load_mat_normalized(data: bytes) MatBundle[source]
Load
.matbytes and return a normalizedMatBundle.Raises
ImportErrorwith install instructions if optional dependencies for the detected format are missing.
- at_py.readwrite.load_mat_normalized_path(path: str | bytes | PathLike[str]) MatBundle[source]
Load a
.matfile from disk (convenience; reads entire file into memory).
- at_py.readwrite.merge_shd_mat_bytes(mats: list[bytes]) bytes[source]
Merge several broadband SHD
.matbuffers into one (Matlabmerge_shd_files).Input buffers must each contain the variables
PlotTitle,atten,Pos,freq0,freqVec,pressure, andPlotType(as produced by Acoustics Toolbox).atten,Pos, andPlotTypemust match across inputs; receiver grid dimensions (allpressureaxes except frequency) must agree.Frequencies from all inputs are concatenated, checked for duplicates, then sorted ascending with
pressurerows permuted to match (same as Matlab).Output format: SciPy
savematformat 5 (MATLAB v7 compatible), not HDF5 v7.3—Matlab’smerge_shd_filesuses-v7.3for large files; use this merged file withread_shd_from_mat/load_mat_normalizedthe same way as classic MAT.Requires optional dependency SciPy (
pip install 'oalib-at-py[mat]').
- at_py.readwrite.omni_beam_pattern() BeamPatternRead[source]
Omni-directional default when Matlab
SBP ~= '*'(two endpoints, 0 dB).
- at_py.readwrite.parse_ati(text: str, *, min_depth_m: float | None = None) AltimetryRead[source]
Parse a 2D Bellhop
.atifile (Matlabreadati).Ranges in the file are km; returned
range_mis in m. Endpoints use ±1e50 m as in Matlab.If
min_depth_mis set (e.g. depth of the first tabulated SSP point), any altimetry shallower than that raisesValueError(Matlab: altimetry above first SSP).
- at_py.readwrite.parse_ati_bytes(data: bytes, *, encoding: str = 'utf-8', min_depth_m: float | None = None) AltimetryRead[source]
Like
parse_ati()after decodingdatawithencoding.
- at_py.readwrite.parse_bdry3d(text: str) Bdry3DRead[source]
Parse a Bellhop3D 3D boundary file (Matlab
readbdry3d).
- at_py.readwrite.parse_bdry3d_bytes(data: bytes) Bdry3DRead[source]
Parse 3D boundary from UTF-8 text bytes.
- at_py.readwrite.parse_bty(text: str, *, max_depth_m: float | None = None) BathymetryRead[source]
Parse a 2D Bellhop
.btyfile (Matlabreadbty).Ranges in the file are km; returned
range_muses m (×1000), matchingreadbty. Endpoints at ±1e50 m are appended as in Matlab.If
max_depth_mis set (e.g. last SSP depth), bathymetry deeper than that raisesValueError, matchingreadbty.
- at_py.readwrite.parse_bty_bytes(data: bytes, *, encoding: str = 'utf-8', max_depth_m: float | None = None) BathymetryRead[source]
Like
parse_bty()after decodingdatawithencoding.
- at_py.readwrite.parse_env_bellhop(text: str) ParsedEnvBellhop[source]
Parse a 2D Bellhop
.env(Matlabread_envwithmodel='BELLHOP').
- at_py.readwrite.parse_env_bellhop3d(text: str) ParsedEnvBellhop3D[source]
Parse a Bellhop3D
.env(Matlabread_envwithmodel='BELLHOP3D').
- at_py.readwrite.parse_env_bellhop3d_bytes(data: bytes, *, encoding: str = 'utf-8') ParsedEnvBellhop3D[source]
Like
parse_env_bellhop3d()after decodingdatawithencoding.
- at_py.readwrite.parse_env_bellhop_bytes(data: bytes, *, encoding: str = 'utf-8') ParsedEnvBellhop[source]
Like
parse_env_bellhop()after decodingdatawithencoding.
- at_py.readwrite.parse_env_core(text: str) EnvCore[source]
Parse the core .env structure (port of Matlab read_env_core.m).
This is intended as a faithful, filesystem-free parser. It is line-oriented, matching Matlab’s fscanf + fgetl pattern.
Lines after the core block (e.g. KRAKEN
CMIN/CMAX,RMAX, source/receiver depths) are ignored. Useparse_env_kraken()to read those.
- at_py.readwrite.parse_env_core_bytes(data: bytes, *, encoding: str = 'utf-8') EnvCore[source]
Like
parse_env_core()after decodingdatawithencoding.
- at_py.readwrite.parse_env_kraken(text: str) ParsedEnvKraken[source]
Parse a full
.envincluding the KRAKEN-family tail (Matlabread_env).After
read_env_core()Matlab readscInt(CMIN/CMAX),RMax, thenat_py.readwrite.vector.parse_readvector_lines()twice for source and receiver depths (readszrz).Applies to models using that block:
KRAKEN,SCOOTER,SPARC,BOUNCE, etc. (see Matlabread_env.m).
- at_py.readwrite.parse_env_kraken_bytes(data: bytes, *, encoding: str = 'utf-8') ParsedEnvKraken[source]
Like
parse_env_kraken()after decodingdatawithencoding.
- at_py.readwrite.parse_env_ram(text: str) ParsedEnvRAM[source]
Parse RAM
ram.in(canonical Matlabwrite_env_RAMlayout with!comments).
- at_py.readwrite.parse_env_ram_bytes(data: bytes, *, encoding: str = 'utf-8') ParsedEnvRAM[source]
Like
parse_env_ram()but decodesdatafirst.
- at_py.readwrite.parse_field_flp(text: str) FieldFlpResult[source]
Parse FIELD
.flptext (Matlabread_flp.m).Receiver ranges in the file are km; results use meters for ranges (
read_flp×1000). Profile rangesr_prof_kmstay in km as in the file.
- at_py.readwrite.parse_field_flp3d(text: str) FieldFlp3DResult[source]
Parse FIELD3D
.flptext (Matlabread_flp3d.m).Horizontal coordinates and receiver ranges in the file are km; results use meters. Trailing lines after the triangular mesh block are ignored (extended FIELD3D inputs).
- at_py.readwrite.parse_field_flp3d_bytes(data: bytes, *, encoding: str = 'utf-8') FieldFlp3DResult[source]
Like
parse_field_flp3d()after decodingdatawithencoding.
- at_py.readwrite.parse_field_flp_bytes(data: bytes, *, encoding: str = 'utf-8') FieldFlpResult[source]
Like
parse_field_flp()after decodingdatawithencoding.
- at_py.readwrite.parse_read_env(text: str, model: str) ParsedEnvKraken | ParsedEnvBellhop | ParsedEnvBellhop3D | ParsedEnvRAM[source]
Parse a full environmental file for the given AT model (Matlab
read_env).Dispatches to
parse_env_kraken(),parse_env_bellhop(),parse_env_bellhop3d(), orparse_env_ram()according tomodel(case-insensitive), matching the branches inread_env.mplus RAMram.in.
- at_py.readwrite.parse_read_env_bytes(data: bytes, model: str, *, encoding: str = 'utf-8') ParsedEnvKraken | ParsedEnvBellhop | ParsedEnvBellhop3D | ParsedEnvRAM[source]
Like
parse_read_env()but decodesdatawithencodingfirst.
- at_py.readwrite.parse_readvector_lines(lines: list[str], i: int) tuple[ndarray, int, int][source]
Port of Matlab
readvector.musing pre-split lines.The count is taken from
lines[i](first integer), data fromlines[i+1].- Returns:
length-
Nxvectornx: requested count (matchesx.size)i_next: index of first line after the readvector block- Return type:
x
- at_py.readwrite.parse_ssp2d(text: str) SSP2DRead[source]
Parse a 2D SSPFIL (Matlab
readssp2d).Layout: integer
NProf,NProfrange values (km), then a flat block ofNProf * NSSPsound speeds read into[NProf, NSSP]column-wise and transposed to[NSSP, NProf].
- at_py.readwrite.parse_ssp2d_bytes(data: bytes) SSP2DRead[source]
Parse 2D SSPFIL from UTF-8 text bytes.
- at_py.readwrite.parse_ssp3d(text: str) SSP3DRead[source]
Parse a 3D SSPFIL (Matlab
readssp3d).For each depth index
iz, oneNx``×``Nyblock is read column-wise (Matlabfscanf(..., [Nx, Ny])), then transposed intocmat(iz, :, :).
- at_py.readwrite.parse_ssp3d_bytes(data: bytes) SSP3DRead[source]
Parse 3D SSPFIL from UTF-8 text bytes.
- at_py.readwrite.read_arrivals(data: bytes | str, *, file_type: Literal['bin', 'asc'] | None = None, encoding: str = 'utf-8') Arrivals2D | Arrivals3D[source]
Dispatch arrivals parsing (binary vs ASCII) for in-memory payloads.
- at_py.readwrite.read_arrivals_asc(data: str | bytes, *, encoding: str = 'utf-8') Arrivals2D | Arrivals3D[source]
Parse Bellhop/Bellhop3D ASCII arrivals (port of
read_arrivals_asc.m).
- at_py.readwrite.read_arrivals_asc_bytes(data: bytes, *, encoding: str = 'utf-8') Arrivals2D | Arrivals3D[source]
Like
read_arrivals_asc()for UTF-8 (or other) encoded bytes.
- at_py.readwrite.read_arrivals_bin(data: bytes) Arrivals2D | Arrivals3D[source]
Parse Bellhop/Bellhop3D binary arrivals file bytes (port of read_arrivals_bin.m).
- at_py.readwrite.read_arrivals_bytes(data: bytes, *, file_type: Literal['bin', 'asc'] | None = None, encoding: str = 'utf-8') Arrivals2D | Arrivals3D[source]
Like
read_arrivals()forbytesinput only.
- at_py.readwrite.read_beam_pattern_bytes(data: bytes) BeamPatternRead[source]
Parse
.sbpbytes: countN, thenNrows ofangle_deg,power_dB.
- at_py.readwrite.read_fortran_vector(nx: int, spec_line: str) ndarray[source]
Parse one line after the count (
Nx), emulatingreadvector.m.Supports
/termination:Nx > 2with two valuesa b /→linspace(a, b, Nx)Nx > 2with one valuea /→full(Nx, a)Nx <= 2or explicit list →Nxfloats from the line
- at_py.readwrite.read_modes(data: bytes | str, *, freq: float = 0.0, modes: list[int] | None = None, file_type: Literal['mod', 'moa'] | None = None, encoding: str = 'utf-8') ModesReadResult | ModesAscReadResult[source]
Dispatch mode parsing like Matlab
read_modes.mfor in-memory payloads.file_type='mod': binaryread_modes_binfile_type='moa': ASCIIread_modes_ascfile_type=None: infer from payload type/content (bytes->binary first, str->ASCII).
- at_py.readwrite.read_modes_asc(data: str | bytes, *, modes: list[int] | None = None, encoding: str = 'utf-8') ModesAscReadResult[source]
Parse Kraken ASCII mode file text (Matlab
read_modes_asc.m).modeslists 1-based mode indices to keep (default: all modes in the file).
- at_py.readwrite.read_modes_asc_bytes(data: bytes, *, modes: list[int] | None = None, encoding: str = 'utf-8') ModesAscReadResult[source]
Like
read_modes_asc()for encoded bytes.
- at_py.readwrite.read_modes_bin(data: bytes, freq: float, *, modes: list[int] | None = None) ModesReadResult[source]
Parse Kraken binary mode file bytes (port of Matlab
read_modes_bin).modesuses 1-based mode indices, matching Matlab (e.g.[1, 2, 3]). If omitted, all modes at the selected frequency are returned.Use
freq=0when the file contains a single frequency (Matlab convention).
- at_py.readwrite.read_modes_bytes(data: bytes, *, freq: float = 0.0, modes: list[int] | None = None, file_type: Literal['mod', 'moa'] | None = None, encoding: str = 'utf-8') ModesReadResult | ModesAscReadResult[source]
Like
read_modes()forbytesinput only.
- at_py.readwrite.read_modes_from_mat(data: bytes, freq: float, *, modes: list[int] | None = None) ModesReadResult[source]
Port of Matlab
read_modes.mfor.mod.mat(loadprovidesModes).Expects a variable
Modesmatching Kraken/Krakel-style saves (seekrakelM.m):title,Nfreq,Nmedia,N,depth,Mater,rho,freqVec,z,M,Top,Bot,k,phi.modesuses 1-based indices likeread_modes_bin().Multi-frequency
.mod.matfiles must store eigenvectors and wavenumbers in a stacked layout so the nearest frequency tofreqcan be selected (same idea as Matlabread_modes_bin):phiwith shape(nmat, M, Nfreq)kwith shape(M, Nfreq)or(Nfreq, M)
Modes.Mmay be a scalar (same M at every frequency) or a vector of lengthNfreq(mode count per frequency). Single-frequency files keep the Krakel-style 2-Dphiand 1-Dk.
- at_py.readwrite.read_ram_tlgrid(data: bytes) RamTlGridResult[source]
Parse RAM binary
tl.gridbytes (Matlabread_ram_tlgrid).
- at_py.readwrite.read_ram_tlgrid_bytes(data: bytes) RamTlGridResult[source]
Alias of
read_ram_tlgrid()(symmetry with other*_bytesAPIs).
- at_py.readwrite.read_rc_brc_bytes(data: bytes) ReflectionCoeffRead[source]
Alias for a bottom
.brcfile (same parser asread_rc_bytes()).
- at_py.readwrite.read_rc_bytes(data: bytes) ReflectionCoeffRead[source]
Parse one top (
.trc) or bottom (.brc) reflection coefficient file.Format: integer
N, thenNlines oftheta,R,phiwithphiin degrees (converted to radians like Matlabreadrc).
- at_py.readwrite.read_rc_trc_bytes(data: bytes) ReflectionCoeffRead[source]
Alias for a top
.trcfile (same parser asread_rc_bytes()).
- at_py.readwrite.read_shd(data: bytes | str, *, freq: float | None = None, xs_km: float | None = None, ys_km: float | None = None, file_type: Literal['shd', 'asc', 'ram'] | None = None, encoding: str = 'utf-8') ShdReadResult | ShdAscResult | RamTlGridResult[source]
Dispatch shade parsing like Matlab
read_shd.mfor in-memory payloads.file_type='shd': binaryread_shd_binfile_type='asc': ASCIIread_shd_ascfile_type='ram': RAMtl.gridviaread_ram_tlgridfile_type=None:str-> ASCII;bytes-> try binary, then ASCII decode
- at_py.readwrite.read_shd_asc(data: str | bytes, *, encoding: str = 'utf-8') ShdAscResult[source]
Parse ASCII shade file text (port of Matlab
read_shd_asc.m).Matlab reads a single source-depth slab (
isd = 1in the original); this port reads allNsdslabs sequentially ifNsd > 1, stacking an extra dimension sopressurehas shape(nsd, nrd, nrr).For the common
Nsd == 1case, shape is(1, nrd, nrr).
- at_py.readwrite.read_shd_bin(data: bytes, *, freq: float | None = None, xs_km: float | None = None, ys_km: float | None = None) ShdReadResult[source]
Parse AT binary .shd/.grn bytes (ported from Matlab read_shd_bin.m).
This function is intentionally bytes-in / objects-out (no filesystem).
freq: select nearest frequency (defaults to first frequency)
xs_km / ys_km: select nearest source x/y in km (defaults to first x/y)
- at_py.readwrite.read_shd_bytes(data: bytes, *, freq: float | None = None, xs_km: float | None = None, ys_km: float | None = None, file_type: Literal['shd', 'asc', 'ram'] | None = None, encoding: str = 'utf-8') ShdReadResult | ShdAscResult | RamTlGridResult[source]
Like
read_shd()forbytesinput only.
- at_py.readwrite.read_shd_from_mat(data: bytes, *, freq: float | None = None, xs_km: float | None = None, ys_km: float | None = None, greens_function: bool = False) ShdReadResult[source]
Port of Matlab
read_shd.mbranchesshdmat/grnmat.Required variables (as loaded by Matlab
load):PlotTitle,PlotType,freqVec,freq0,atten,Pos,pressure.greens_function=TrueappliesPos.r.r = Pos.r.r.'likegrnmat.freqselects the nearest entry infreqVec(default: first index), matching the binary reader whenfreqis omitted.xs_km/ys_kmselect nearest source grid point in meters viaabs(Pos.s.x - xs*1000)/abs(Pos.s.y - ys*1000)whenpressurehas leading source axes(Nsx, Nsy, ...).
- at_py.readwrite.read_ts(data: str | bytes, *, encoding: str = 'utf-8') TsReadResult[source]
Parse ASCII time-series data (Matlab
read_ts.mnon-.matpath).
- at_py.readwrite.read_ts_bytes(data: bytes, *, encoding: str = 'utf-8') TsReadResult[source]
Like
read_ts()for UTF-8 (or other) encoded bytes.
- at_py.readwrite.read_ts_from_mat(data: bytes) TsReadResult[source]
Port of Matlab
read_ts.mfor.mat(loadsPlotTitle,Pos,tout,RTS).Applies the same
RTS = RTS.'transpose as the Matlab branch.
- class at_py.readwrite.fortran_records.FortranRecordReader(data: memoryview, marker_len: int, offset: int = 0)[source]
Bases:
objectReader for Fortran unformatted sequential records over a bytes buffer.
- data: memoryview