phys2cvr.regressors.compute_bulk_shift

phys2cvr.regressors.compute_bulk_shift(func_upsampled, petco2hrf, freq, outprefix, trial_len=None, n_trials=None, abs_xcorr=False)[source]

Compute (initial) bulk shift of regressor.

Parameters:
func_upsamplednp.ndarray

Functional timeseries average upsampled at the frequency of the regressor of interest.

petco2hrfnp.ndarray

Regressor of interest

freqstr, int, or float

Sample frequency of petco2hrf

outprefixlist or path

Path to output directory for regressors.

trial_lenstr or int, optional

Length of each single trial for tasks that have more than one (E.g. BreathHold, CO2 challenges, …) Used to improve cross correlation estimation. Default: None

n_trialsstr or int, optional

Number of trials in the task. Default: None

abs_xcorrbool, optional

If True, the cross correlation will consider the maximum absolute correlation, i.e. if a negative correlation is higher than the highest positive, the negative correlation will be chosen instead.

Returns:
optshiftint

The index of optimal shifting computed via Xcorr