slycat.hdf5

class slycat.hdf5.ArraySet(file)[source]

Bases: object

Wraps an instance of h5py.File to implement a Slycat arrayset.

array_count()[source]

Note: this assumes that array indices are contiguous, which we don’t explicitly enforce.

keys()[source]
start_array(array_index, dimensions, attributes)[source]

Add an uninitialized darray to the arrayset.

An existing array with the same index will be overwritten.

Parameters:
  • array_index (integer, required.) – Zero-based index of the array to create.
  • dimensions (list of dicts, required.) – Description of the new array dimensions.
  • attributes (list of dicts, required.) – Description of the new array attributes.
Returns:

array

Return type:

slycat.hdf5.DArray

store_array(array_index, array)[source]

Store a slycat.darray.Prototype in the arrayset.

An existing array with the same index will be overwritten.

Parameters:
  • array_index (integer, required.) – The index of the array to be created / overwritten.
  • array (slycat.darray.Prototype, required.) – Existing darray to be stored.
Returns:

array

Return type:

slycat.hdf5.DArray

class slycat.hdf5.DArray(storage)[source]

Bases: slycat.darray.Prototype

Slycat darray implementation that stores data in an HDF5 file.

attributes

Return metadata describing the darray attributes.

Returns:attributes
Return type:list of dicts
dimensions

Return metadata describing the darray dimensions.

Returns:dimensions
Return type:list of dicts
get_data(attribute)[source]

Return a reference to the data storage for a darray attribute.

Parameters:attribute (integer, optional) – The integer index of the attribute data to retrieve.
Returns:data – An object implementing a subset of the numpy.ndarray interface that contains the attribute data. Note that the returned object only references the underlying data - data is not retrieved from the file until you access it using the [] operator.
Return type:reference to a numpy-array-like object.
get_statistics(attribute)[source]
get_unique(attribute, hyperslice)[source]
ndim

Return the number of dimensions in the darray.

Returns:ndim – The number of dimensions in the darray.
Return type:integer
set_data(attribute, hyperslice, data)[source]

Overwrite the contents of a darray attribute.

Parameters:
  • attribute (integer) – The zero-based integer index of the attribute to be overwritten.
  • hyperslice (integer, slice, Ellipsis, or tuple containing one or more integer, slice, and Ellipsis instances.) – Defines the attribute region to be overwritten.
  • data (numpy.ndarray) – Data to be written to the attribute.
shape

Return the darray shape (its size along each dimension).

Returns:shape – The size of the darray along each dimension.
Return type:tuple of integers
size

Return the darray size (total number of elements stored in the darray).

Returns:size – The total number of elements stored in the darray.
Return type:integer
slycat.hdf5.dtype(type)[source]

Convert a string attribute type into a dtype suitable for use with h5py.

slycat.hdf5.path(array, directory)[source]
slycat.hdf5.start_arrayset(file)[source]

Create a new array set using an open hdf5 file.

Parameters:file (h5py.File, required.) – An hdf5 file open for writing.
Returns:arrayset
Return type:slycat.hdf5.ArraySet