herostools.actor.archiver.array¶
Classes¶
HERODataArchiver that saves numpy arrays as |
Module Contents¶
- class herostools.actor.archiver.array.ArrayArchiver(save_template: str, split_data_array: bool = False, *args, **kwargs)[source]¶
Bases:
herostools.actor.archiver.base.HERODataArchiverHERODataArchiver that saves numpy arrays as
.npyfiles.- Parameters:
object_selector – Zenoh object selector for the devices to subscribe to.
event_name – Name of the event.
save_template – Jinja2 template used to generate the output file path from the payload metadata.
split_data_array – When
True, each row of a 2-D array is saved as a separate file. Use{{ _split_index }}insave_templateto embed the row index in the filename.default_metadata – Default metadata available to the filename template.
max_retries – Number of times to retry a failed store before dropping the item.
Example
BOSS json configuration:
{ "_id": "my-camera-capturer", "classname": "herostools.archiver.ArrayArchiver", "arguments": { "object_selector": "my-camera", "event_name": "acquisition_data", "default_metadata": { "file_path": "/mnt/mystorage/images" }, "save_template": "{{ file_path }}/testimg-{{ '%04d' % ( frame / 2 ) |round(0, 'floor') }}-{{ frame % 2 }}.npy" } }
Generates paths such as:
/mnt/mystorage/images/testimg-0000-0.npy /mnt/mystorage/images/testimg-0000-1.npy
- name_template¶
- split_data_array = False¶