RetroTS.py error

Hi all,

I am using RetroTS.py in a bash terminal to turn respiratory and cardiac tsv.gz files into regressors for 1st level analysis.
I kept getting this error and any suggestion is greatly appreciated!

RetroTS.py
-phys_file sub-test_ses-test_task-reward_recording-cardiac_physio.tsv.gz
-phys_json sub-test_ses-test_task-reward_recording-cardiac_physio.json
-v 2
-n 72
-prefix physio_card_regressors.1D

#output
Traceback (most recent call last):
File “/Users/xiy/abin/RetroTS.py”, line 687, in
retro_ts(
File “/Users/xiy/abin/RetroTS.py”, line 279, in retro_ts
cardiac_peak, error = peak_finder(cardiac_info,v=phys_dat[k])
File “/Users/xiy/abin/lib_RetroTS/PeakFinder.py”, line 517, in peak_finder
r[“p_trace_r”] = interp1d(
File “/Users/xiy/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/interpolate.py”, line 467, in init
self._y = self._reshape_yi(self.y)
File “/Users/xiy/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/polyint.py”, line 110, in _reshape_yi
** return yi.reshape((yi.shape[0], -1))**
ValueError: cannot reshape array of size 0 into shape (0,newaxis)

I am following the suggestions from this post: https://neurostars.org/t/so-what-are-people-using-to-process-their-bids-physio-files-in-to-regressors-for-fitlins/6698
Same error with respiratory files. Specifying p instead of json file yielded the same error.
Upon inspection, physio files look normal (two columns: timepoints, amplitude).
Please find the linked de-identified physio and json files for error replication.
https://uoregon-my.sharepoint.com/:f:/g/personal/xiy_uoregon_edu/Eu7UYtpzEZxCo8PQpn4g6QYBlYIQxwkbTLz-Qb3Rh-aYrQ?e=uTmkmr
Thank you all!

Looks like you have some NAN values in your physio file. Interpolating those took care of the first issue for me. But another error is caused due to having a trigger column but no cardiac column in your json/tsv.gz files.

Hi Peter,

Thank you so much for pointing out the problems!
Following your suggestions, I generated one respiratory 1D regressor.

RetroTS.py
-r sub-test_ses-test_task-reward_recording-respiratory_physio_intp.tsv
-phys_json sub-test_ses-test_task-reward_recording-respiratory_physio.json
-v 2
-p 50
-n 72
-respiration_out 1 -cardiac_out 0
-prefix physio_resp_regressors.1D

One regressor for the cardiac data.
RetroTS.py
-c sub-test_ses-test_task-reward_recording-cardiac_physio_intp.tsv
-phys_json sub-test_ses-test_task-reward_recording-cardiac_physio.json
-v 2
-p 250
-n 72
-prefix physio_card_regressors.1D
-respiration_out 0
-cardiac_out 1
-rvt_out 0

Do the 1D regressors under Corrected files look normal to you?
https://uoregon-my.sharepoint.com/:f:/r/personal/xiy_uoregon_edu/Documents/afni_de-identified_test_files?csf=1&web=1&e=wsm8PN
Thank you so much. :slight_smile: