core.eval:loadmatrix()

Open matrix ascii data as well as hdf5 files generated by matrix.

Usage

Source

core.eval:loadmatrix(
    filename,
    structured=True,
    print_header=False,
    replace_None=False,
    *,
    to_polars=False,
)

Returns all header information as well as data as numpy.ndarray. Data fields should be addressed by column name (structured=True, default) or by index (structured=False).

Parameters

filename: str or pathlib.Path

path to file

structured: bool = True

controls whether a structured or a plain numpy array is returned

print_header: bool = False

if true, prints the column names read from the file together with their index

replace_None: boolean = False

%deprecated: raises a NotImplementedError.

to_polars: bool = False
if true, the data of text files is returned as a native polars DataFrame instead of numpy. This option is not supported for HDF5 files and raises NotImplementedError.

Returns

header: HeaderDict

Dictionary containing the header information with core typed fields

data: np.ndarray | pl.DataFrame | dict[str, np.ndarray]
Data array, polars DataFrame, or dict for unequal length arrays

Warns

FutureWarning
If a text file is loaded without to_polars=True, as the numpy return is deprecated and will be removed in a future release.