overthesun / simoc-sam

Live backend for SAM at Biosphere 2
2 stars 1 forks source link

implement csv-logger from generic sioclient #42

Closed granawkins closed 2 years ago

granawkins commented 2 years ago

Fork of the default sioclient.py file which logs all readings to a .csv file in the base directory.

Expected behavior is:

  1. Launch with python3 -m simoc_sam.csv_logger
  2. Setup the socketio connection and begin receiving step-batch emits
  3. Initialize a logfile as simoc_log_11-22-22_12-07-56.csv
  4. For each batch, compile the list of fieldnames. Includes the timestamp and, for each field of each sensor, <sensor_id>_<field> (e.g. '6LC832_co2'). These correspond to 'columns' in the .csv.
  5. If the logfile doesn't include all the fieldnames (i.e. sensors were refreshed), add new columns.
  6. Write the batch to the .csv

Notes:

granawkins commented 2 years ago

Could do. I was thinking it's useful to keep the vanilla sioclient.py as a template for future add-ons, but maybe that's not necessary.