Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.tools.io.seisio.seisio

SeisIO file format reader.

Classes

DataProxy

class DataProxy(builtins.object):
    def __init__(
        self,
        extents: typing.List[Extent],
        header_dtype: np.dtype,
        compression: TraceCompression,
    ): ...

Memory mapped data proxy.

Parameters
  • extents typing.List[Extent] — The extents for the file.
  • header_dtype np.dtype — The header type as a structured numpy dtype.
  • compression TraceCompression — The compression settings.
Methods
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
  • idx salvus._core.types.int_ — The global index.
Returns typing.Tuple[int, int]
get_header()
def get_header(self, idx: salvus._core.types.int_) -> npt.NDArray: ...

Get a header.

Parameters
  • idx salvus._core.types.int_ — The index of the header/trace.
Returns npt.NDArray
get_header_for_slice()
def get_header_for_slice(self, val: slice) -> np.ndarray: ...

Get a header.

Parameters
  • val slice — The slice object.
Returns np.ndarray
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_idx salvus._core.types.int_ — The index of the extent.
Returns np.memmap | None
get_trace()
def get_trace(self, idx: salvus._core.types.int_) -> npt.NDArray: ...

Get a trace.

Parameters
  • idx salvus._core.types.int_ — The index of the trace.
Returns npt.NDArray
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_idx salvus._core.types.int_ — The index of the extent.
Returns np.memmap

Endianness

class Endianness(enum.Enum):
    def __init__(self): ...

The byte order of the file.

Extent

class 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
  • db pathlib.Path — Path to the .db? file.
  • hd pathlib.Path | None — Path to the .hd? file. Can be None in which case that extent has no headers.
  • tr pathlib.Path — Path to the .tr.? file.
  • tr_size typing.Optional[salvus._core.types.int_] — Optional file size.
  • hd_size typing.Optional[salvus._core.types.int_] — Optional file size.
  • db_size typing.Optional[salvus._core.types.int_] — Optional file size.
  • number_of_traces typing.Optional[int] — Total number of traces.
  • trace_mmap typing.Optional[np.memmap] — Memory map to the trace file.
  • header_mmap typing.Optional[np.memmap] — Memory map to the header file.

HeaderProxy

class 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

class 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
  • filename typing.Union[str, pathlib.Path] — The path to the .seis file.
  • root_path typing.Union[str, pathlib.Path] — Root project directory for the SeisIO format - path the `${project} refers to in the JSON files.
Attributes
header HeaderProxy

Quick access to all headers.

number_of_traces int

Total number of traces.

sampling_rate_in_hertz float

The sampling rate in Hz.

start_time_in_seconds float

Time of the first sample.

total_header_file_size int

Total size in bytes of the header files.

total_trace_file_size int

Total size in bytes of the trace files.

Methods
get_header()
def get_header(self, idx: salvus._core.types.int_) -> npt.NDArray: ...

Get a header.

Parameters
  • idx salvus._core.types.int_ — Index of the header.
Returns npt.NDArray
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_idx salvus._core.types.int_ — The index of the extent.
Returns np.memmap | None
get_trace()
def get_trace(self, idx: salvus._core.types.int_) -> npt.NDArray: ...

Get a trace.

Parameters
  • idx salvus._core.types.int_ — Index of the trace.
Returns npt.NDArray