rail.core.data module
Rail-specific data management
- class rail.core.data.DataHandle(tag, data=None, path=None, creator=None)[source]
Bases:
object
Class to act as a handle for a bit of data. Associating it with a file and providing tools to read & write it to that file
- Parameters:
tag (str) – The tag under which this data handle can be found in the store
data (any or None) – The associated data
path (str or None) – The path to the associated file
creator (str or None) – The name of the stage that created this data handle
- property has_data
Return true if the data for this handle are loaded
- property has_path
Return true if the path for the associated file is defined
- property is_written
Return true if the associated file has been written
- open(**kwargs)[source]
Open and return the associated file
Notes
This will simply open the file and return a file-like object to the caller. It will not read or cache the data
- suffix = ''
- class rail.core.data.DataStore(**kwargs)[source]
Bases:
dict
Class to provide a transient data store
This class: 1) associates data products with keys 2) provides functions to read and write the various data produces to associated files
- add_data(key, data, handle_class, path=None, creator='DataStore')[source]
Create a handle for some data, and insert it into the DataStore
- allow_overwrite = True
- class rail.core.data.FitsHandle(tag, data=None, path=None, creator=None)[source]
Bases:
TableHandle
DataHandle for a table written to fits
- suffix = 'fits'
- class rail.core.data.FlowDict[source]
Bases:
dict
A specialized dict to keep track of individual flow objects: this is just a dict these additional features
Keys are paths
Values are flow objects, this is checked at runtime.
There is a read(path, force=False) method that reads a flow object and inserts it into the dictionary
There is a single static instance of this class
- class rail.core.data.FlowHandle(tag, data=None, path=None, creator=None)[source]
Bases:
ModelHandle
A wrapper around a file that describes a PZFlow object
- flow_factory = {}
- suffix = 'pkl'
- class rail.core.data.Hdf5Handle(tag, data=None, path=None, creator=None)[source]
Bases:
TableHandle
DataHandle for a table written to HDF5
- suffix = 'hdf5'
- class rail.core.data.ModelDict[source]
Bases:
dict
A specialized dict to keep track of individual estimation models objects: this is just a dict these additional features
Keys are paths
There is a read(path, force=False) method that reads a model object and inserts it into the dictionary
There is a single static instance of this class
- class rail.core.data.ModelHandle(tag, data=None, path=None, creator=None)[source]
Bases:
DataHandle
DataHandle for machine learning models
- model_factory = {}
- suffix = 'pkl'
- class rail.core.data.PqHandle(tag, data=None, path=None, creator=None)[source]
Bases:
TableHandle
DataHandle for a parquet table
- suffix = 'pq'
- class rail.core.data.QPHandle(tag, data=None, path=None, creator=None)[source]
Bases:
DataHandle
DataHandle for qp ensembles
- suffix = 'hdf5'
- class rail.core.data.TableHandle(tag, data=None, path=None, creator=None)[source]
Bases:
DataHandle
DataHandle for single tables of data
- suffix = None