HDF5 IO

The CUDS to HDF5 file adapters.

Classes

h5_cuds.H5CUDS
DataContainerTable(root[, name, record]) A proxy class to an HDF5 group node with serialised DataContainers.
IndexedDataContainerTable(root[, name, ...]) A proxy class to an HDF5 group node with serialised DataContainers.
h5_particles.H5Particles
h5_lattice.H5Lattice
h5_mesh.H5Mesh
H5CUDSItems(root, record[, name]) A proxy class to an HDF5 group node with serialised CUDS items.

Table descriptions

simphony.io.data_container_description.create_data_table(class_name, supported_cuba=<enum 'CUBA'>)[source]

Create tables.IsDescription class dynamically given a set of supported CUBA IntEnum

Parameters:
  • class_name (str) – Name of the created class
  • supported_cuba (iterable) – Supported CUBA IntEnum
Returns:

type

Return type:

tables.IsDescription

Data
Record
NoUIDRecord

Implementation

class simphony.io.h5_cuds_items.H5CUDSItems(root, record, name='items')[source]

Bases: _abcoll.MutableMapping

A proxy class to an HDF5 group node with serialised CUDS items.

The class implements the Mutable-Mapping api where each item instance is mapped to uuid.

__delitem__(uid)[source]

Delete the row.

__getitem__(uid)[source]

Return the Particle with the provided id.

__iter__()[source]

Iterate over all the rows

__len__()[source]

The number of rows in the table.

A runtime error is raised when the number of rows in the items and data tables is not equal.

__setitem__(uid, item)[source]

Set the particle in row with item.

  • If the uid does not exist in the Table a new row will be appended.
  • If the item.uid is None then item.uid = uid.
add_safe(item)[source]

Add item while checking for a unique uid.

Note

The item is expected to already have a uid set.

add_unsafe(item)[source]

Add item without checking for a unique uid.

Note

The item is expected to already have a uid set.

itersequence(sequence)[source]

Iterate over a sequence of row ids.

update_existing(item)[source]

Update an item if it already exists.

valid

A PyTables table is opened/created and the object is valid.

class simphony.io.data_container_table.DataContainerTable(root, name='data_containers', record=None)[source]

Bases: _abcoll.MutableMapping

A proxy class to an HDF5 group node with serialised DataContainers.

The class implements the Mutable-Mapping api where each DataContainer instance is mapped to uuid.

__delitem__(uid)[source]

Delete the row.

__getitem__(uid)[source]

Return the DataContainer in row.

__iter__()[source]

Iterate over all the rows

__len__()[source]

The number of rows in the table.

__setitem__(uid, data)[source]

Set the data in row from the DataContainer.

append(data)[source]

Append the data to the end of the table.

Parameters:data (DataContainer) – The DataContainer instance to save.
Returns:uid – The index of the saved row.
Return type:uuid.UUID
itersequence(sequence)[source]

Iterate over a sequence of row ids.

valid

A PyTables table is opened/created and the object is valid.

class simphony.io.indexed_data_container_table.IndexedDataContainerTable(root, name='data_containers', record=None, expected_number=None)[source]

Bases: _abcoll.Sequence

A proxy class to an HDF5 group node with serialised DataContainers.

The class implements the Sequence api where each DataContainer instance is mapped to the row. In addition the class implements update (i.e. __setitem__) and append.

__getitem__(index)[source]

Return the DataContainer in index.

__iter__()[source]

Iterate over all the rows

__len__()[source]

The number of rows in the table.

__setitem__(index, data)[source]

Update the data in index.

append(data)[source]

Append the data to the end of the table.

Parameters:data (DataContainer) – The DataContainer instance to save.
Returns:index – The index of the saved row.
Return type:int
valid
simphony.io.data_container_description.create_data_table(class_name, supported_cuba=<enum 'CUBA'>)[source]

Create tables.IsDescription class dynamically given a set of supported CUBA IntEnum

Parameters:
  • class_name (str) – Name of the created class
  • supported_cuba (iterable) – Supported CUBA IntEnum
Returns:

type

Return type:

tables.IsDescription