phys2cvr.regressors.create_physio_regressor

phys2cvr.regressors.create_physio_regressor(func_avg, petco2hrf, tr, freq, outprefix, lag_max=None, lag_min=None, trial_len=None, n_trials=None, ext='.1D', lagged_regression=True, legacy=False, abs_xcorr=False, skip_xcorr=False)[source]

Create regressor(s) of interest for nifti GLM.

Parameters:
func_avgnp.ndarray

Average functional timeseries (1D)

petco2hrfnp.ndarray

Regressor of interest (e.g., CO2 regressor)

trstr, int, or float

Repetition time (TR) of timeseries

freqstr, int, or float

Sample frequency of petco2hrf

outprefixlist or path

Path to output directory for computed regressors.

lag_maxint, float, or None, optional

Upper limit of the temporal area to explore, expressed in seconds. Caution: this is not a pythonic range, but a real range, i.e. the upper limit is included. Default: None

lag_minint, float, or None, optional

Lower limit of the temporal area to explore, expressed in seconds. If set to None, and lag_max is not None and is positive, lag_min defaults to -lag_max (symmetric range). Default: None

trial_lenstr or int, optional

Length of each individual trial for timeseries which include more than one trial (e.g., multiple BreathHold trials, trials within CO2 challenges, …) Used to improve cross correlation estimation. Default: None

n_trialsstr or int, optional

Number of trials within the timeseries. Default: None

extstr, optional

Extension to be used for the exported regressors (e.g., .txt, .csv)

lagged_regressionbool, optional

Estimate regressors for each possible lag of petco2hrf.

legacybool, optional

If True, exclude the upper (positive) lag limit from the regression estimation, i.e., the maximum number of regressors will be (freq*lag_max*2) If False, the maximum number of regressors will be (freq*lag_max*2)+1

abs_xcorrbool, optional

If True, the cross correlation will consider the maximum absolute correlation, i.e., if a negative correlation is stronger than the strongest positive, the negative correlation will be used.

skip_xcorrbool, optional

If True, skip the cross correlation step.

Returns:
petco2hrf_demeannp.ndarray

The demeaned petco2hrf regressor, central in time (not shifted).

petco2hrf_laggednp.ndarray

The other shifted versions of the regressor.