read_array

function of dascore.io.core source

read_array(
    path: str | pathlib._local.Path | upath.core.UPath | dascore.utils.io.IOResourceManager[str, Path, UPath, IOResourceManager] ,
    windows: collections.abc.Sequence[collections.abc.Sequence[Any], <class ’slice] = (),
    key: str = ““,
    file_format: str | None[str, None] = None,
    file_version: str | None[str, None] = None,
)-> ‘np.ndarray’

Read an array, or part of one, out of a fiber file.

Parameters

Parameter Description
path A path to the file to read.
windows A half-open (start, stop) sample range, a slice, or None for
a whole axis, one per axis of the array in order; trailing axes left
out are read whole. A bare slice is the first axis’s window. A slice
may step, in which case the enclosing contiguous range is read and
strided afterwards.
key Which array to read: the logical patch of a multi-patch resource, or
an absolute path (“/…”) to an array stored in an HDF5 file.
file_format A string indicating the file format. If not provided dascore will
try to estimate the format.
file_version An optional string indicating the format version.
Note

The array has the axis order, shape and dtype scan reports; dimension names play no part here.

An absolute HDF5 dataset path returns the stored values as they are: no reader runs, so nothing is scaled, reshaped or trimmed. OptoDAS then gives unscaled int16, and Terra15 includes its unwritten trailing rows. A single-patch format ignores a key which is not such a path.

Examples

import dascore as dc

array = dc.read_array("examples://terra15_das_1_trimmed.hdf5")
window = dc.read_array("examples://terra15_das_1_trimmed.hdf5", ((0, 10),))
window.shape == (10, array.shape[1])
True