Homer3 icon indicating copy to clipboard operation
Homer3 copied to clipboard

[BUG]: hmrR_MotionCorrectSpline throws an error when nirs/datax/dataTimeSeries or nirs/datax/time is stored as 32bit

Open kdarti opened this issue 1 year ago • 1 comments

Version of Homer3 you are using

1.80.2

Your environment (MATLAB environment and OS)

2017b runtime

Description of the issue

image

Given the error I figured it was due to 32bit data in dataTimeSeries / time and indeed, resampling the data to 64bit and the error is gone. I've attached the original, and the resampled file in the next section.

Steps to reproduce:

8001_00_24217_resampled.zip 8001_00_24217_original.zip

Expected behavior:

hmrR_MotionCorrectSpline shouldn't throw an error becuase dataTimeSeries is stored as 32bit, I validated the file with pysnirf2, and the snirf spec doesn't enforce 64bit storage:

image

Actual behavior: Error if dataTimeSeries is in 32 bit format

kdarti avatar Dec 15 '23 10:12 kdarti

Note that this is enough enough to fix by casting t and dod to double, but not sure how you prefer to solve it.

Also, the issue is with csaps on this line: https://github.com/BUNPC/Homer3/blob/666ab6d0b054e9b2eb829d62736aaa2148638f67/FuncRegistry/UserFunctions/hmrR_MotionCorrectSpline.m#L124

kdarti avatar Dec 15 '23 11:12 kdarti