salvus.project.tools.io.seisio.seisio
SeisIO file format reader.
Classes
DataProxy
DataProxyclass DataProxy(builtins.object):
def __init__(
self,
extents: typing.List[Extent],
header_dtype: np.dtype,
compression: TraceCompression,
): ...Memory mapped data proxy.
Parameters
extentstyping.List[Extent] — The extents for the file.header_dtypenp.dtype — The header type as a structured numpy dtype.compressionTraceCompression — The compression settings.
Methods
find_extent_for_index()
find_extent_for_index()def find_extent_for_index(
self, idx: salvus._core.types.int_
) -> typing.Tuple[int, int]: ...Find the index of the corresponding extent and the internal index in each extent.
Parameters
idxsalvus._core.types.int_ — The global index.
Returns typing.Tuple[int, int]
get_header()
get_header()def get_header(self, idx: salvus._core.types.int_) -> npt.NDArray: ...Get a header.
Parameters
idxsalvus._core.types.int_ — The index of the header/trace.
Returns npt.NDArray
get_header_for_slice()
get_header_for_slice()def get_header_for_slice(self, val: slice) -> np.ndarray: ...Get a header.
Parameters
valslice — The slice object.
Returns np.ndarray
get_header_mmap()
get_header_mmap()def get_header_mmap(
self, extent_idx: salvus._core.types.int_
) -> np.memmap | None: ...Get the memory map for a header file.
Parameters
extent_idxsalvus._core.types.int_ — The index of the extent.
Returns np.memmap | None
get_trace()
get_trace()def get_trace(self, idx: salvus._core.types.int_) -> npt.NDArray: ...Get a trace.
Parameters
idxsalvus._core.types.int_ — The index of the trace.
Returns npt.NDArray
get_trace_mmap()
get_trace_mmap()def get_trace_mmap(self, extent_idx: salvus._core.types.int_) -> np.memmap: ...Get the memory map for a trace file.
Parameters
extent_idxsalvus._core.types.int_ — The index of the extent.
Returns np.memmap
Endianness
Endiannessclass Endianness(enum.Enum):
def __init__(self): ...The byte order of the file.
Extent
Extentclass Extent(builtins.object):
def __init__(
self,
db: pathlib.Path,
hd: pathlib.Path | None,
tr: pathlib.Path,
tr_size: typing.Optional[salvus._core.types.int_] = None,
hd_size: typing.Optional[salvus._core.types.int_] = None,
db_size: typing.Optional[salvus._core.types.int_] = None,
number_of_traces: typing.Optional[int] = None,
trace_mmap: typing.Optional[np.memmap] = None,
header_mmap: typing.Optional[np.memmap] = None,
) -> None: ...Represent a single extent.
Parameters
dbpathlib.Path — Path to the .db? file.hdpathlib.Path | None — Path to the .hd? file. Can be None in which case that extent has no headers.trpathlib.Path — Path to the .tr.? file.tr_sizetyping.Optional[salvus._core.types.int_] — Optional file size.hd_sizetyping.Optional[salvus._core.types.int_] — Optional file size.db_sizetyping.Optional[salvus._core.types.int_] — Optional file size.number_of_tracestyping.Optional[int] — Total number of traces.trace_mmaptyping.Optional[np.memmap] — Memory map to the trace file.header_mmaptyping.Optional[np.memmap] — Memory map to the header file.
HeaderProxy
HeaderProxyclass HeaderProxy(builtins.object):
def __init__(self, data_proxy: "DataProxy"): ...Proxy object to ease header access across extents.
Parameters
data_proxy'DataProxy' — The data proxy of the file.
SeisIO
SeisIOclass SeisIO(builtins.object):
def __init__(
self,
filename: typing.Union[str, pathlib.Path],
root_path: typing.Union[str, pathlib.Path],
): ...Object accessing a SeisIO file.
Parameters
filenametyping.Union[str, pathlib.Path] — The path to the .seis file.root_pathtyping.Union[str, pathlib.Path] — Root project directory for the SeisIO format - path the `${project} refers to in the JSON files.
Attributes
header HeaderProxy
header HeaderProxyQuick access to all headers.
number_of_traces int
number_of_traces intTotal number of traces.
sampling_rate_in_hertz float
sampling_rate_in_hertz floatThe sampling rate in Hz.
start_time_in_seconds float
start_time_in_seconds floatTime of the first sample.
total_header_file_size int
total_header_file_size intTotal size in bytes of the header files.
total_trace_file_size int
total_trace_file_size intTotal size in bytes of the trace files.
Methods
get_header()
get_header()def get_header(self, idx: salvus._core.types.int_) -> npt.NDArray: ...Get a header.
Parameters
idxsalvus._core.types.int_ — Index of the header.
Returns npt.NDArray
get_header_mmap()
get_header_mmap()def get_header_mmap(
self, extent_idx: salvus._core.types.int_
) -> np.memmap | None: ...Get the memory mapped full header array for a given extent.
Parameters
extent_idxsalvus._core.types.int_ — The index of the extent.
Returns np.memmap | None
get_trace()
get_trace()def get_trace(self, idx: salvus._core.types.int_) -> npt.NDArray: ...Get a trace.
Parameters
idxsalvus._core.types.int_ — Index of the trace.
Returns npt.NDArray