Appearance
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
Matrix quickstart
Write a .cpk file and read a NumPy selection.
Matrix access
Select, reorder, convert and reuse output buffers.
Gene alignment
Define source and output identities across different panels.
Training batches
Deliver dictionaries of CPU or CUDA Tensors.
Process functions
Create tokens, values, targets and model-specific fields.
Native loading
Control NumPy outputs and bounded ring ownership directly.
Planning and diagnostics
Inspect cache plans, reservations and run statistics.
AnnData and H5CP
Use lazy matrices while preserving annotations.
Shared loading
Share one CPU producer across ranks on one host.
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 next | Result |
|---|---|---|
| One selected matrix | Matrix access | An owned dense or CSR array |
| Several datasets with different column orders | Gene alignment | One explicit vocabulary and output panel |
| Training iteration | DataLoader | A dictionary of Tensor fields per batch |
| Direct native integration | Native loader | NumPy views with an explicit slot lease |
| A custom encoded container | Codec components | Encoded 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.
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.