sidescanpy.io.xtf.subset#

Cut a run of pings out of an XTF file, byte for byte.

write_subset() copies the file header and every packet from the first kept sonar ping up to (not including) the sonar ping after the last kept one, unchanged. Non-sonar packets inside that span (navigation, attitude, notes) are kept; those before or after it are not. Used to make small test fixtures from public recordings.

2026 rshomberg@uri.edu

Contents

write_subset

Write sonar pings start_ping to start_ping + n_pings of src to dst.

sidescanpy.io.xtf.subset.write_subset(src, dst, *, n_pings, start_ping=0)#

Write sonar pings start_ping to start_ping + n_pings of src to dst.

Parameters:
src, dststr or Path

Source XTF file and output file (overwritten).

n_pingsint

Sonar packets (pings) to keep.

start_pingint, default 0

Index of the first sonar packet kept.

Returns:
int

Number of sonar pings written (fewer than n_pings if the file ends first).