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: List[salvus.project.tools.io.seisio.seisio.Extent],
        header_dtype: numpy.dtype,
        compression: salvus.project.tools.io.seisio.compression.TraceCompression,
    ):
        ...

Memory mapped data proxy.

Parameters
  • extents List[salvus.project.tools.io.seisio.seisio.Extent] — The extents for the file.
  • header_dtype numpy.dtype — The header type as a structured numpy dtype.
  • compression salvus.project.tools.io.seisio.compression.TraceCompression — The compression settings.
Methods
find_extent_for_index()
def find_extent_for_index(self, idx: int) -> Tuple[int, int]:
    ...

Find the index of the corresponding extent and the internal index in each extent.

Parameters
  • idx int — The global index.
Returns Tuple[int, int]
get_header()
def get_header(self, idx: int) -> numpy.ndarray:
    ...

Get a header.

Parameters
  • idx int — The index of the header/trace.
Returns numpy.ndarray
get_header_for_slice()
def get_header_for_slice(self, val: builtins.slice) -> numpy.ndarray:
    ...

Get a header.

Parameters
  • val builtins.slice — The slice object.
Returns numpy.ndarray
get_header_mmap()
def get_header_mmap(self, extent_idx: int) -> numpy.memmap:
    ...

Get the memory map for a header file.

Parameters
  • extent_idx int — The index of the extent.
Returns numpy.memmap
get_trace()
def get_trace(self, idx: int) -> numpy.ndarray:
    ...

Get a trace.

Parameters
  • idx int — The index of the trace.
Returns numpy.ndarray
get_trace_mmap()
def get_trace_mmap(self, extent_idx: int) -> numpy.memmap:
    ...

Get the memory map for a trace file.

Parameters
  • extent_idx int — The index of the extent.
Returns numpy.memmap

Endianness

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

The byte order of the file.

Initialize self. See help(type(self)) for accurate signature.

Extent

class Extent(builtins.object):
    def __init__(
        self,
        db: pathlib.Path,
        hd: pathlib.Path,
        tr: pathlib.Path,
        tr_size: Optional[int] = None,
        hd_size: Optional[int] = None,
        db_size: Optional[int] = None,
        number_of_traces: Optional[int] = None,
        trace_mmap: Optional[numpy.memmap] = None,
        header_mmap: Optional[numpy.memmap] = None,
    ) -> None:
        ...

Represent a single extent.

Parameters
  • db pathlib.Path — Path to the .db? file.
  • hd pathlib.Path — Path to the .hd? file.
  • tr pathlib.Path — Path to the .tr.? file.
  • tr_size Optional[int] — Optional file size.
  • hd_size Optional[int] — Optional file size.
  • db_size Optional[int] — Optional file size.
  • number_of_traces Optional[int] — Total number of traces.
  • trace_mmap Optional[numpy.memmap] — Memory map to the trace file.
  • header_mmap Optional[numpy.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: Union[str, pathlib.Path],
        root_path: Union[str, pathlib.Path],
    ):
        ...

Object accessing a SeisIO file.

Parameters
  • filename Union[str, pathlib.Path] — The path to the .seis file.
  • root_path Union[str, pathlib.Path] — Root project directory for the SeisIO format - path the `${project} refers to in the JSON files.
Attributes
header salvus.project.tools.io.seisio.seisio.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: int) -> numpy.ndarray:
    ...

Get a header.

Parameters
  • idx int — Index of the header.
Returns numpy.ndarray
get_header_mmap()
def get_header_mmap(self, extent_idx: int) -> numpy.memmap:
    ...

Get the memory mapped full header array for a given extent.

Parameters
  • extent_idx int — The index of the extent.
Returns numpy.memmap
get_trace()
def get_trace(self, idx: int) -> numpy.ndarray:
    ...

Get a trace.

Parameters
  • idx int — Index of the trace.
Returns numpy.ndarray