BUNPC / Homer3

MATLAB application for fNIRS data processing and visualization
91 stars 54 forks source link

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

Open kdarti opened 10 months ago

kdarti commented 10 months ago

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 commented 10 months ago

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