Skip to content

Using PyCellPack ​

PyCellPack stores numeric matrices in compressed CellPack streams and reads selected rows with native worker threads. Use it to prepare a matrix once, align datasets to a common gene vocabulary, and deliver ordered training batches.

Choose your path ​

Choose your Python workflow

Read installation, then run the matrix quickstart in a writable directory. It writes two rows and checks a reordered selection, so you can establish storage correctness before adding sampling or a training runtime.

You need…Read nextResult
One selected matrixMatrix accessAn owned dense or CSR array
Several datasets with different column ordersGene alignmentOne explicit vocabulary and output panel
Training iterationDataLoaderA dictionary of Tensor fields per batch
Direct native integrationNative loaderNumPy views with an explicit slot lease
A custom encoded containerCodec componentsEncoded chunks and records in explicit buffers

The API reference answers parameter, return and lifetime questions. The Training section supplies larger integration programs with their runtime requirements stated up front.

Choose the ownership model you need
Training CPU Tensors

ScDataLoader clones packed slots into independent Tensor storage. Returned CPU batches may be retained.

Native NumPy views

Batch arrays, slices and Tensors made from them retain slot leases. Copy long-lived output to allow ring reuse.

For manual asynchronous H2D, retain host arrays and host Tensors until the copy completes. Releasing the Batch alone does not release exported views.

Objects you will use ​

File identifies an encoded stream. Store describes an immutable, lazy matrix view over it. A read decodes that view into an array; indexing alone does not decode values.

For training, wrap a file-backed Store in ScDataset, describe sample order with corpus Accesses, and iterate ScDataLoader. For direct NumPy delivery, register files in DataSource, describe outputs with OutputSchema, and start a Loader run.

PyCellPack does not infer gene identity from column positions or choose epoch sampling policy. Supply both explicitly. Streams store matrix values and positional metadata; names belong in your own metadata or AnnData.