Make HDF datasets always be float64 unless they are PCAP.BITS
Closed this issue · 0 comments
At the moment in SCALED mode the datasets are always the native type, double. In RAW mode this doesn't work as they are transported as int32
then multiplied by scale and offset. The code at the moment turns it into double
sometimes:
PandABlocks-client/src/pandablocks/hdf.py
Line 97 in 9c01c18
However this makes it difficult to handle downstream as changing an offset might change the datatype of the field.
Agreed we should always write double, except for the PCAP.BITS fields. Fortunately we can detect those by the lack of scale and offset and units in the header, so we can set them as None
here:
PandABlocks-client/src/pandablocks/connections.py
Lines 312 to 314 in 9c01c18
which needs a typing change to add Optional
here:
PandABlocks-client/src/pandablocks/responses.py
Lines 238 to 240 in 9c01c18
then we can check for them to be not None
here:
PandABlocks-client/src/pandablocks/hdf.py
Line 97 in 9c01c18
I don't know what the datatypes in the unit tests are, so those might need changing too...