photons.io module
Custom file writer.
- class photons.io.PhotonWriter(file, *, log_size=None)[source]
Bases:
JSONWriterA custom file writer.
- Parameters:
file (
str) – The path of the file to create.log_size (
int) – The initial size ofDatasetLogging. If None or 0 then do not include log messages in the writer.
- add_equipment(*records)[source]
Add equipment records to an ‘equipment’
Group.Automatically creates the ‘equipment’ Group if it does not already exist.
- Return type:
- initialize(*header, microseconds=False, name='dataset', size=100, types=None, **metadata)[source]
Initialize a dataset.
- Parameters:
*header (
str) – The names of the header fields. The first field name istimestampand it is automatically created.microseconds (
bool) – Whether to include microseconds in thetimestamp.name (
str) – The name of the dataset to initialize. Can contain/to specify a subgroup (relative to the root Group).size (
int) – The initial size of the dataset. The dataset will automatically increase in size when it needs to.types (
list[type]) – The data types of each header field. If not specified then uses float for each field.**metadata – The metadata to associate with the dataset.
- Return type: