physiopy / phys2denoise

A toolbox and collection of scripts to prepare physiology data for fMRI denoise
https://phys2denoise.readthedocs.io/
Apache License 2.0
9 stars 19 forks source link

Number of time points in metrics returned don't match the number of scans #66

Open m-miedema opened 1 month ago

m-miedema commented 1 month ago

Expected Behavior

If one provides the CLI with an -nscans value, one would expect the (convolved) metric to have one value corresponding to each scan.

Actual Behavior

The exported metric (respiratory variance, in this case) contains slightly more values than the number of scans (e.g. -nscans 400, but the _resampled_convolved.1D and _resampled_raw.1D files contain 410 values).

Steps to Reproduce the Problem

1. Run the phys2denoise CLI on a physio object with peaks and troughs
2. Calculate some metrics.
3. Check the number of lines in the output metric files.

Specifications

- Python version: 3.11.4
- phys2denoise version: under development
- Platform: Windows/VSCode

Possible solution

Check how the number of scans are being used in the code during resampling! Where are windows centred? Is the issue coming from the window size? I don't think it's simply the convolution, as the issue is present even in the raw resampled metric. Does the issue change with the number of lags provided?