Serializable schema using traits
Project description
Create serializable, type-checked schema using traits and Numpy. A typical use case involves saving several Numpy arrays of varying shape and type.
Defining schema
In order to be able to properly serialize data, non-scalar traits should be declared as a traits.api.Array type. Example:
import numpy as np
from traits.api import Array, String
from traitschema import Schema
class NamedMatrix(Schema):
name = String()
data = Array(dtype=np.float64)
matrix = NamedMatrix(name="name", data=np.random.random((8, 8)))
Saving and loading
Data can be stored in the following formats:
HDF5 via h5py
JSON via the standard library json module
Numpy npz format
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for traitschema-1.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c959eb4e288679d8855b43b668a7331f76fa6d0ebd1f05187226fd768f235f |
|
MD5 | 41941207b9394026746bc54d0ef153e7 |
|
BLAKE2b-256 | 4054172211bc75a2bff5334263d3a84df1dfeb1be2349e5456bbed545754298f |