Understanding hmrIntensity2OD - when is data set to NaN?
When I read in my NIRS data into MATLAB I can see data in all channels, but when I use the function "hmrIntensity2OD.m" whole channels are set to NaN.
Could someone help me understand why I loose them in the conversion from raw data to "dod"?
Thank you in advance,
this happens because some channels are negative and converting to OD requires taking log() of the data divided by the mean and log of a negative number is NaN. Also, this will happen when some of the data points are NaN as taking the mean of a time series where some time points are NaN results in the mean being NaN. This has been discussed in this forum and solutions exist for this. Please search the forum for those posts.
Hey, I have a similar problem (have 3 NaN's in a column which lead to NaN's for the whole channel after conversion). I have looked through the forum with the key words:
dod; hmrIntensity2OD; OD; optical density; Intensity2OD, conversion to dod; NaN and some others
Sadly the only discussion I found that was related, was in regard to negative data. Maybe you can tell me another keyword to look for or help me with my problem? Should the NaN's just be excluded cellwise? Is there a best practice for that?
Thanks for the effort!
All the best,
@coco, you can use hmrR_PreprocessIntensity_Negative function to add a dc level to the raw signal to remove negative numbers, then the conversion should not create NaNs anymore. Please use the development version which includes some fixes.
@le_rah, you can use hmrR_PreprocessIntensity_NAN function to remove NaN values in the raw signal.
Please let me know how it goes.
Hey Meryem Yücel,
sadly I didn't manage to make the function work, although it seams like it is exactly what I would be needing.
I always get the error Message
"Dot indexing is not supported for variables of this type.
Error in hmrR_PreprocessIntensity_NAN (line 24)
d = intensity(ii).GetDataTimeSeries(); "
I have tried to find some debugging or help.. but haven't found anything. I am right with the understanding that d is the raw intensity data. And d is also the matrix I want to clean off NaN's.
Maybe you can help?
All the best and thanks for all the effort and time,