Loading sails/periodogram.py +15 −12 Original line number Diff line number Diff line Loading @@ -418,6 +418,16 @@ def _set_scaling(scaling, fs, win): return scale def _set_heinzel_scaling(fs, win, input_length): # https://holometer.fnal.gov/GH_FFT.pdf s1 = win.sum() s2 = (win*win).sum() nenbw = len(win) * (s2 / s1**2) enbw = fs * (s2 / s1**2) def _set_detrend(detrend, axis): """Set a detrending function to be applied to STFT windows prior to FFT.""" # Handle detrending and window functions Loading Loading @@ -871,8 +881,8 @@ def _process_regressor(Y, config, mode='confound', prepend_dim=True): if Y.ndim == 1 and prepend_dim: Y = Y[np.newaxis, :] windowed = apply_delay_embedding(Y, config['nperseg'], config['noverlap'], window=config['win'], padded=config['padded']) windowed = apply_delay_embedding(Y, config.nperseg, config.noverlap, window=config.window, padded=config.padded) y = np.nansum(windowed, axis=-1) Loading Loading @@ -1091,14 +1101,11 @@ def psd_glm(X, covariates=None, confounds=None, fit_method='pinv', nperseg=nperseg, noverlap=noverlap, nfft=nfft, detrend=detrend, return_onesided=return_onesided, scaling=scaling, axis=axis, mode=mode) scaling=scaling, axis=axis, mode=mode, output_axis='glm') # Compute STFT f, t, p = compute_stft(X, config, output_axis='auto') # Prepare data orig_shape = p.shape p = _flatten(p) f, t, p = compute_stft(X, **config.stft_args) # Compute model extras = None Loading @@ -1120,8 +1127,4 @@ def psd_glm(X, covariates=None, confounds=None, fit_method='pinv', else: raise ValueError('fit_method not recognised') # Preserve original input shape copes = _unflatten(copes, orig_shape) varcopes = _unflatten(varcopes, orig_shape) return f, copes, varcopes, extras Loading
sails/periodogram.py +15 −12 Original line number Diff line number Diff line Loading @@ -418,6 +418,16 @@ def _set_scaling(scaling, fs, win): return scale def _set_heinzel_scaling(fs, win, input_length): # https://holometer.fnal.gov/GH_FFT.pdf s1 = win.sum() s2 = (win*win).sum() nenbw = len(win) * (s2 / s1**2) enbw = fs * (s2 / s1**2) def _set_detrend(detrend, axis): """Set a detrending function to be applied to STFT windows prior to FFT.""" # Handle detrending and window functions Loading Loading @@ -871,8 +881,8 @@ def _process_regressor(Y, config, mode='confound', prepend_dim=True): if Y.ndim == 1 and prepend_dim: Y = Y[np.newaxis, :] windowed = apply_delay_embedding(Y, config['nperseg'], config['noverlap'], window=config['win'], padded=config['padded']) windowed = apply_delay_embedding(Y, config.nperseg, config.noverlap, window=config.window, padded=config.padded) y = np.nansum(windowed, axis=-1) Loading Loading @@ -1091,14 +1101,11 @@ def psd_glm(X, covariates=None, confounds=None, fit_method='pinv', nperseg=nperseg, noverlap=noverlap, nfft=nfft, detrend=detrend, return_onesided=return_onesided, scaling=scaling, axis=axis, mode=mode) scaling=scaling, axis=axis, mode=mode, output_axis='glm') # Compute STFT f, t, p = compute_stft(X, config, output_axis='auto') # Prepare data orig_shape = p.shape p = _flatten(p) f, t, p = compute_stft(X, **config.stft_args) # Compute model extras = None Loading @@ -1120,8 +1127,4 @@ def psd_glm(X, covariates=None, confounds=None, fit_method='pinv', else: raise ValueError('fit_method not recognised') # Preserve original input shape copes = _unflatten(copes, orig_shape) varcopes = _unflatten(varcopes, orig_shape) return f, copes, varcopes, extras