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_upsampled
np.ndarray Functional timeseries average upsampled at the frequency of the regressor of interest.
- petco2hrf
np.ndarray Regressor of interest
- freq
str,int, orfloat Sample frequency of petco2hrf
- outprefix
listorpath Path to output directory for regressors.
- trial_len
strorint, 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_trials
strorint, optional Number of trials in the task. Default: None
- abs_xcorr
bool, 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.
- func_upsampled
- Returns:
- optshift
int The index of optimal shifting computed via Xcorr
- optshift