Converts a Sense HAT recording to CSV format, for the purposes of debugging or analysis.
sense_csv [-h] [--version] [-q] [-v] [-l FILE] [-P] [--timestamp-format TIMESTAMP_FORMAT] [--header] input output
show this help message and exit
show this program’s version number and exit
produce less console output
produce more console output
log messages to the specified file
run under PDB (debug mode)
the format to use when outputting the record timestamp (default: ISO8601 format, which is “%Y-%m-%dT%H:%M:%S.%f”; see strftime(3) for information on valid format parameters)
if specified, output column headers at the start of the output
To convert a recording to CSV, simply run sense_csv with the recorded file as the first filename, and the output CSV file as the second:
$ sense_csv experiment.hat experiment.csv
By default, only the data is output, with the columns defined as follows:
- Timestamp - the moment in time at which the readings were taken (note that as the Pi lacks a real-time clock, this is likely to be inaccurate unless the clock has been set with NTP).
- Pressure - the reading from the pressure sensor in hectopascals (hPa).
- Temperature - the temperature reading from the pressure sensor in degrees celsius (°C).
- Humidity - the reading from the humidity sensor in % humidity.
- Temperature - the temperature reading from the humidity sensor in degrees celsius (°C).
- Accelerometer X-axis - the acceleration reading along the X-axis of the HAT in g.
- Accelerometer Y-axis.
- Accelerometer Z-axis.
- Gyroscope X-axis - the angular rate of change around the X-axis of the HAT in degrees per second.
- Gyroscope Y-axis.
- Gyroscope Z-axis.
- Compass X-axis - the magnetometer reading along the X-axis in micro-teslas.
- Compass Y-axis.
- Compass Z-axis.
- Orientation X-axis - the computed orientation of the HAT as radians rotation (-π to +π) about the X-axis.
- Orientation Y-axis.
- Orientation Z-axis.
If you wish to include column headers as the first row of data, simply
$ sense_csv --header experiment.hat experiment.csv
- is specified for either filename, sense_csv will read
from stdin, or write to stdout. This can be used in conjunction with other
standard command line utilities for all sorts of effects. For example, to
produce a CSV file containing only the timestamps, humidity, and accelerometer
$ sense_csv --header experiment.hat - | cut -d, -f1,4,6-8 > experiment.csv