Skip to content

Commit

Permalink
Merge pull request #169 from pfizer-opensource/development
Browse files Browse the repository at this point in the history
Version 0.16.6.post1
  • Loading branch information
LukasAdamowicz authored Jul 29, 2024
2 parents 12ff328 + c3422ec commit b4f2831
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'scikit-digital-health',
'c',
version: '0.16.6',
version: '0.16.6.post1',
license: 'MIT',
meson_version: '>=1.1',
)
Expand Down
20 changes: 16 additions & 4 deletions src/skdh/io/empatica.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ def get_accel(self, raw_accel_dict, results_dict, key):
) + phys_min

# create the timestamp array using ts_start, fs, and the number of samples
time = arange(ts_start, ts_start + accel.shape[0] / fs, 1 / fs)
time = arange(ts_start, ts_start + accel.shape[0] / fs, 1 / fs)[:accel.shape[0]]

if time.size != accel.shape[0]:
raise ValueError("Time does not have enough samples for accel array")

# use special names here so we can just update dictionary later for returning
results_dict[key] = {self._time: time, "fs": fs, self._acc: accel}
Expand Down Expand Up @@ -112,7 +115,10 @@ def get_gyroscope(self, raw_gyro_dict, results_dict, key):
gyro = (gyro - dig_min) / (dig_max - dig_min) * (phys_max - phys_min) + phys_min

# create the timestamp array using ts_start, fs, and the number of samples
time = arange(ts_start, ts_start + gyro.shape[0] / fs, 1 / fs)
time = arange(ts_start, ts_start + gyro.shape[0] / fs, 1 / fs)[:gyro.shape[0]]

if time.size != gyro.shape[0]:
raise ValueError("Time does not have enough samples for gyro array")

results_dict[key] = {self._time: time, "fs": fs, "values": gyro}

Expand Down Expand Up @@ -141,7 +147,10 @@ def get_values_1d(self, raw_dict, results_dict, key):
values = ascontiguousarray(raw_dict["values"])

# timestamp array
time = arange(ts_start, ts_start + values.size / fs, 1 / fs)
time = arange(ts_start, ts_start + values.size / fs, 1 / fs)[:values.shape[0]]

if time.size != values.shape[0]:
raise ValueError(f"Time does not have enough samples for {key} array")

results_dict[key] = {self._time: time, "fs": fs, "values": values}

Expand Down Expand Up @@ -194,7 +203,10 @@ def get_steps(self, raw_dict, results_dict, key):
steps = ascontiguousarray(raw_dict["values"])

# timestamp array
time = arange(ts_start, ts_start + steps.size / fs, 1 / fs)
time = arange(ts_start, ts_start + steps.size / fs, 1 / fs)[:steps.size]

if time.size != steps.size:
raise ValueError("Time does not have enough samples for steps array")

results_dict[key] = {self._time: time, "fs": fs, "values": steps}

Expand Down

0 comments on commit b4f2831

Please sign in to comment.