tables

Interfaces for pytables and hdf5 generally

Classes:

H5F_Node

Base class for H5F Nodes

H5F_Group

Description of a pytables group and its location

H5F_Table

Tables_Interface

Functions:

model_to_description(table)

Make a table description from the type annotations in a model

description_to_model(description, cls)

Make a pydantic modeling.base.Table from a tables.IsDescription

pydantic model H5F_Node[source]

Bases: autopilot.data.modeling.base.Node

Base class for H5F Nodes

Show JSON schema
{
   "title": "H5F_Node",
   "description": "Base class for H5F Nodes",
   "type": "object",
   "properties": {
      "path": {
         "title": "Path",
         "type": "string"
      },
      "title": {
         "title": "Title",
         "default": "",
         "type": "string"
      },
      "filters": {
         "title": "Filters"
      },
      "attrs": {
         "title": "Attrs",
         "type": "object"
      }
   },
   "required": [
      "path"
   ]
}

Config
  • arbitrary_types_allowed: bool = True

Fields
field path: str [Required]
field title: Optional[str] = ''
field filters: Optional[tables.filters.Filters] = None
field attrs: Optional[dict] = None
property parent: str

The parent node under which this node hangs.

Eg. if self.path is /this/is/my/path, then parent will be /this/is/my

Returns

str

property name: str

Our path without parent

Returns

str

abstract make(h5f: tables.file.File)[source]

Abstract method to make whatever this node is

pydantic model H5F_Group[source]

Bases: autopilot.data.interfaces.tables.H5F_Node

Description of a pytables group and its location

Show JSON schema
{
   "title": "H5F_Group",
   "description": "Description of a pytables group and its location",
   "type": "object",
   "properties": {
      "path": {
         "title": "Path",
         "type": "string"
      },
      "title": {
         "title": "Title",
         "default": "",
         "type": "string"
      },
      "filters": {
         "title": "Filters"
      },
      "attrs": {
         "title": "Attrs",
         "type": "object"
      },
      "children": {
         "title": "Children"
      }
   },
   "required": [
      "path"
   ]
}

Config
  • arbitrary_types_allowed: bool = True

Fields
field children: Optional[List[Union[autopilot.data.interfaces.tables.H5F_Node, H5F_Group]]] = None
make(h5f: tables.file.File)[source]

Make the group, if it doesn’t already exist.

If it exists, do nothing

Parameters

h5f (tables.file.File) – The file to create the table in

pydantic model H5F_Table[source]

Bases: autopilot.data.interfaces.tables.H5F_Node

Show JSON schema
{
   "title": "H5F_Table",
   "description": "Base class for H5F Nodes",
   "type": "object",
   "properties": {
      "path": {
         "title": "Path",
         "type": "string"
      },
      "title": {
         "title": "Title",
         "default": "",
         "type": "string"
      },
      "filters": {
         "title": "Filters"
      },
      "attrs": {
         "title": "Attrs",
         "type": "object"
      },
      "description": {
         "title": "Description"
      },
      "expectedrows": {
         "title": "Expectedrows",
         "default": 10000,
         "type": "integer"
      }
   },
   "required": [
      "path"
   ]
}

Config
  • fields: dict = {‘description’: {‘exclude’: True}}

Fields
field description: tables.description.MetaIsDescription [Required]
field expectedrows: int = 10000
make(h5f: tables.file.File)[source]

Make this table according to its description

Parameters

h5f (tables.file.File) – The file to create the table in

pydantic model Tables_Interface[source]

Bases: autopilot.data.interfaces.base.Interface

Show JSON schema
{
   "title": "Tables_Interface",
   "description": "Create a representation of a given Schema",
   "type": "object",
   "properties": {
      "map": {
         "title": "Map"
      },
      "schema": {
         "$ref": "#/definitions/Schema"
      }
   },
   "required": [
      "schema"
   ],
   "definitions": {
      "Schema": {
         "title": "Schema",
         "description": "A special type of type intended to be a representation of an\nabstract structure/schema of data, rather than a live container of\ndata objects themselves. This class is used for constructing data containers,\ntranslating between formats, etc. rather than momentary data handling",
         "type": "object",
         "properties": {}
      }
   }
}

Fields
field map: autopilot.data.interfaces.base.Interface_Mapset = Interface_Mapset(bool=<class 'tables.description.Col._subclass_from_prefix.<locals>.NewCol'>, int=<class 'tables.description.Col._subclass_from_prefix.<locals>.NewCol'>, float=<class 'tables.description.Col._subclass_from_prefix.<locals>.NewCol'>, str=Interface_Map(equals=<class 'tables.description.Col._subclass_from_prefix.<locals>.NewCol'>, args=[1024], kwargs=None, conversion=None), bytes=Interface_Map(equals=<class 'tables.description.Col._subclass_from_prefix.<locals>.NewCol'>, args=[1024], kwargs=None, conversion=None), datetime=Interface_Map(equals=<class 'tables.description.Col._subclass_from_prefix.<locals>.NewCol'>, args=[1024], kwargs=None, conversion=<function <lambda> at 0x7efe6a595160>), group=<class 'autopilot.data.interfaces.tables.H5F_Group'>, node=None)
make(h5f: tables.file.File) bool[source]

Make a given schema using the interface mapping given.

Returns

True if successful

Return type

bool

field schema_: autopilot.data.modeling.base.Schema [Required] (alias 'schema')
model_to_description(table: Type[Table]) Type[tables.description.IsDescription][source]

Make a table description from the type annotations in a model

Parameters

table (modeling.base.Table) – Table description

Returns

tables.IsDescription

description_to_model(description: Type[tables.description.IsDescription], cls: Type[Table]) Table[source]

Make a pydantic modeling.base.Table from a tables.IsDescription

Parameters
  • description (tables.IsDescription) – to convert

  • cls (modeling.base.Table) – Subclass of Table to make

Returns

Subclass of Table