[docs]defread_compressed_sparse_matrix(path:str,metadata:Dict[str,Any],**kwargs)->ReloadedArray:""" Read a compressed sparse matrix from its on-disk representation. In general, this function should not be called directly but instead be dispatched via :py:meth:`~dolomite_base.read_object.read_object`. Args: path: Path to the directory containing the object. metadata: Metadata for this object. kwargs: Further arguments, ignored. Returns: A :py:class:`~dolomite_matrix.ReloadedArray.ReloadedArray` containing a HDF5-backed compressed sparse matrix as a seed. """fpath=os.path.join(path,"matrix.h5")name="compressed_sparse_matrix"withh5py.File(fpath,"r")ashandle:ghandle=handle[name]dhandle=ghandle["data"]tt=ghandle.attrs["type"]dtype=Noneiftt=="boolean":dtype=numpy.dtype("bool")eliftt=="float":ifnotnumpy.issubdtype(dhandle.dtype,numpy.floating):dtype=numpy.dtype("float64")layout=ghandle.attrs["layout"]ifnotisinstance(layout,str):layout=layout.decode("UTF8")shape=(*[int(y)foryinghandle["shape"]],)placeholder=Noneif"missing-value-placeholder"indhandle.attrs:placeholder=dhandle.attrs["missing-value-placeholder"]bycol=(layout=="CSC")ifplaceholderisNone:seed=Hdf5CompressedSparseMatrixSeed(fpath,name,shape=shape,by_column=bycol,dtype=dtype)else:core=Hdf5CompressedSparseMatrixSeed(fpath,name,shape=shape,by_column=bycol)seed=DelayedMask(core,placeholder=placeholder,dtype=dtype)returnReloadedArray(seed,path)