from_columns

method of dascore.core.lazy_array.LazyArray source

from_columns(
    path: str | ArrayLike[str, ArrayLike] ,
    shape: ArrayLike ,
    format: str | ArrayLike[str, ArrayLike] ,
    version: str | ArrayLike[str, ArrayLike] ,
    source_dtype: DTypeLike | ArrayLike[DTypeLike, ArrayLike] ,
    key: str | ArrayLike[str, ArrayLike] = ““,
    origin_id: str | ArrayLike[str, ArrayLike] =”“,
    start: ArrayLike | None[ArrayLike, None] = None,
    extent: ArrayLike | None[ArrayLike, None] = None,
    axis: int = 0,
    base_uri: str =”“,
    dtype: DTypeLike | None[DTypeLike, None] = None,
    cast_via: DTypeLike | ArrayLike | None[DTypeLike, ArrayLike, None] = None,
)-> ‘LazyArray’

Return an array which reads one member per row, laid end to end.

The array and data_id from_sources builds from the equivalent sources, with no object made per member. axis, base_uri and dtype are single values; every other argument is one per member, or one all share. The member count is the length of any per member argument, else the rows of shape.

Parameters

Parameter Description
path Where each member is stored.
shape Each member’s window lengths as an (n, ndim) array. A flat
shape is one shape every member shares, so the lengths of 1-D
members are given as (n, 1).
format, version The FiberIO which reads the members, and its version.
source_dtype The dtype the members are stored at.
key, origin_id Which array of each resource, and its id; see ArraySource.
start, extent Where each window starts, and the shape of the whole stored
array; zeros and shape by default.
axis, base_uri, dtype, cast_via As from_sources takes them.

Examples

import numpy as np
from dascore.core.lazy_array import LazyArray

paths = np.array(["/data/f0.h5", "/data/f1.h5", "/data/f2.h5"])
array = LazyArray.from_columns(
    paths, (100, 10), format="DASDAE", version="1", source_dtype="f4"
)
assert array.shape == (300, 10) and len(array) == 3