From 81c6bd2f307d731880e90e605c2dd01fca23434f Mon Sep 17 00:00:00 2001 From: Samuel Powell Date: Wed, 16 Nov 2022 12:12:59 +0000 Subject: [PATCH] Make saturation flags SNIRF spec compliant (#42) * SNIRF spec compliance on aux data types (floating) * Update version --- +lumofile/write_SNIRF.m | 10 +++++++--- +lumomat/ver.m | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/+lumofile/write_SNIRF.m b/+lumofile/write_SNIRF.m index 80e1fd8..82673e1 100644 --- a/+lumofile/write_SNIRF.m +++ b/+lumofile/write_SNIRF.m @@ -94,7 +94,7 @@ % Write format version % -snirf.formatVersion = write_var_string(fid, '/formatVersion', '1.0'); +snirf.formatVersion = write_var_string(fid, '/formatVersion', '1.1'); % Over each group % @@ -294,8 +294,7 @@ nirs_aux_sat = create_group(nirs_group, ['aux' num2str(auxi)]); snirf.nirs(gidx).aux(auxi).name = write_var_string(nirs_aux_sat, 'name', 'saturationFlags'); snirf.nirs(gidx).aux(auxi).time = write_double(nirs_aux_sat, 'time', [0 data(gidx).chn_dt]); - snirf.nirs(gidx).aux(auxi).dataTimeSeries = write_int32_compressed(nirs_aux_sat, 'dataTimeSeries', data(gidx).chn_sat.'); - + snirf.nirs(gidx).aux(auxi).dataTimeSeries = write_single_compressed(nirs_aux_sat, 'dataTimeSeries', data(gidx).chn_sat.'); H5G.close(nirs_aux_sat); auxi = auxi+1; end @@ -629,6 +628,11 @@ write_core(base, path, single(val), tp, false, false); end +function val = write_single_compressed(base, path, val) +tp = H5T.copy('H5T_IEEE_F32LE'); +write_core(base, path, single(val), tp, false, true); +end + function write_core(base, path, val, tp, fix_shape, compress) % Dataspace diff --git a/+lumomat/ver.m b/+lumomat/ver.m index 354adc2..6aebff3 100644 --- a/+lumomat/ver.m +++ b/+lumomat/ver.m @@ -1,5 +1,5 @@ function [ver] = ver() %LMVER Return the hard coded version of the package -ver = '1.5.0-dev'; +ver = '1.5.0'; end