NBCLab / power-replication

A replication and extension of Power et al. (2018)
https://www.overleaf.com/read/swgjxcjqytxg
Apache License 2.0
2 stars 0 forks source link

Review physio processing code #10

Closed tsalo closed 2 years ago

tsalo commented 3 years ago

@62442katieb would you mind reviewing the processing code I have for the physio data? Below are the links to the two relevant functions:

https://github.com/NBCLab/power-replication/blob/059a3300da37f573461c82c06e6616d5274b91d3/processing/05_generate_single-echo_confounds.py#L535

https://github.com/NBCLab/power-replication/blob/059a3300da37f573461c82c06e6616d5274b91d3/processing/05_generate_single-echo_confounds.py#L147

tsalo commented 2 years ago

Three elements in the peak detection and physio metric calculation steps that I'd love your input on are:

  1. Settings for filter_physio. I used a cutoffs of 1.0, based on the example, in the current processing code, but in the notebook I used 1.0 for the respiratory data and 3.0 for the cardiac data.
  2. Settings for peakfind_physio. The example uses a threshold of 0.1, while the default value is 0.2. In the current processing code, I used 0.1 for both cardiac and respiratory data. In the notebook, I used 0.2 for the respiratory data. I also didn't require a minimum distance between peaks in the notebook, but I'm thinking that's a mistake...
  3. The instantaneous heart rate calculation in https://github.com/tsalo/misc-notebooks/blob/main/peakdet_sandbox_for_power_replication.ipynb.

Of course any other feedback you can provide would be much appreciated.

62442katieb commented 2 years ago

I've reviewed run_peakdet() and compile_physio_regressors(), they look good to me. Taking a look at https://github.com/tsalo/misc-notebooks/blob/main/peakdet_sandbox_for_power_replication.ipynb now.

62442katieb commented 2 years ago

Settings for peakfind_physio. The example uses a threshold of 0.1, while the default value is 0.2. In the current processing code, I used 0.1 for both cardiac and respiratory data. In the notebook, I used 0.2 for the respiratory data. I also didn't require a minimum distance between peaks in the notebook, but I'm thinking that's a mistake...

It looks like after filtering the cardiac data is smooth enough that you might not need to specify a minimum distance between peaks? But on the other hand, cardiac data is predictable enough that a minimum distance would be easy enough to calculate and include. I know that's not super helpful, but I feel it could go either way.

62442katieb commented 2 years ago

The instantaneous heart rate calculation in https://github.com/tsalo/misc-notebooks/blob/main/peakdet_sandbox_for_power_replication.ipynb.

Assuming peak1 and peak2 are indices in the cardiac timeseries, then you're calculating the R-R interval first in timeseries time, then converting to actual time (i.e., bpm) and including conditionals for the first and last peaks. LGTM!

tsalo commented 2 years ago

Thanks Katie! Closing now.