TableSpec#
- class caput.containers.TableSpec(*args: tuple, **kwargs: dict)[source]#
Bases:
ContainerPrototypeA base class for containers holding tables of data.
Similar to the
ContainerPrototypeclass, a container is defined through a dictionary given as a_table_specclass attribute when subclassing this base class. The container may also hold generic datasets by specifying_dataset_specas withContainerPrototype. See Notes for details.Optional Parameters#
- kwargsdict
Should contain definitions for all other table axes.
Notes
A
_table_specconsists of a dictionary mapping table names into a description of the table. That description is another dictionary containing several entries.columns: the set of columns in the table. Given as a list of (name, dtype) pairs.axis: an optional name for the rows of the table. This is automatically generated as<tablename>_indexif not explicitly set. This corresponds to an index_map entry on the container.initialise: whether to create the table by default.distributed: whether the table is distributed, or common across all MPI ranks.
An example _table_spec entry is:
_table_spec = { 'quasars': { 'columns': [ ['ra': np.float64], ['dec': np.float64], ['z': np.float64] ], 'distributed': False, 'axis': 'quasar_id' } 'quasar_mask': { 'columns': [ ['mask', bool] ], 'axis': 'quasar_id' } }