phys2cvr.stats.x_corr¶
- phys2cvr.stats.x_corr(func, co2, n_shifts=None, offset=0, abs_xcorr=False)[source]¶
Compute cross correlation between func and co2.
- Parameters:
- func
np.ndarray Timeseries of functional data. Must be no longer than co2.
- co2
np.ndarray Timeseries of CO2 (or physiological) data, can be longer than func.
- n_shifts
intorNone, optional Number of shifts to test. One shift equals one step. If None, use all possible shifts. Default is None.
- offset
int, optional Number of initial co2 samples to skip. Default is 0.
- abs_xcorr
bool, optional If True, return max absolute correlation. Otherwise return max correlation. Default is False.
- func
- Returns:
floatStrongest cross correlation.
intIndex of strongest correlation.
np.ndarrayFull correlation array.
- Raises:
NotImplementedErrorIf offset < 0. If co2 length is smaller than func length.
ValueErrorIf offset is higher than the difference between the length of co2 and func.