Loading sails/stft.py +10 −8 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ from scipy import fft as sp_fft from scipy import signal, stats from scipy.signal import signaltools from scipy.signal.windows import dpss from scipy.signal.spectral import _triage_segments logging.basicConfig(level=logging.DEBUG) Loading Loading @@ -736,6 +737,8 @@ def _set_heinzel_scaling(fs, win, input_length): nenbw = len(win) * (s2 / s1**2) enbw = fs * (s2 / s1**2) return nenbw, enbw def _set_detrend(detrend, axis): """Set a detrending function to be applied to STFT windows prior to FFT. Loading Loading @@ -879,7 +882,7 @@ class STFTConfig: # Set a rectangular boxcar of 1s as the window if None is requested # - keeps following code cleaner. self.window_type = 'boxcar' self.window, self.nperseg = signal.spectral._triage_segments(self.window_type, self.nperseg, input_length=self.input_len) self.window, self.nperseg = _triage_segments(self.window_type, self.nperseg, input_length=self.input_len) self.nfft = _set_nfft(self.nfft, self.nperseg) self.noverlap = _set_noverlap(self.noverlap, self.nperseg) self.nstep = self.nperseg - self.noverlap Loading Loading @@ -1282,7 +1285,7 @@ def periodogram(x, average='mean', p = np.nanmean(p, axis=0).real elif config.average == 'median': p = np.nanmedian(p, axis=0).real elif config.average == None: elif config.average is None: pass else: msg = "'average' value of '{0}' not recognised - please use 'mean' or 'median'" Loading Loading @@ -1653,7 +1656,7 @@ def _process_input_covariate(cov, input_len): msg = "Regressor '{0}' shape ({1}) not matched to input data length ({2})" raise ValueError(msg.format(key, len(cov[key]), input_len)) ret = cov # pass back out elif cov == None: elif cov is None: ret = {} # No regressors defined else: # Check array_like inputs Loading Loading @@ -1824,7 +1827,6 @@ def _glm_fit_sklearn_estimator(pxx, covariates, confounds, config, fit_method, f else: # Sometimes this is stored in a sub model... betas = fit_method.estimator_.coef_.T extras = (fit_method) # Compute COPES and VARCOPES copes = contrasts.dot(betas) Loading Loading
sails/stft.py +10 −8 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ from scipy import fft as sp_fft from scipy import signal, stats from scipy.signal import signaltools from scipy.signal.windows import dpss from scipy.signal.spectral import _triage_segments logging.basicConfig(level=logging.DEBUG) Loading Loading @@ -736,6 +737,8 @@ def _set_heinzel_scaling(fs, win, input_length): nenbw = len(win) * (s2 / s1**2) enbw = fs * (s2 / s1**2) return nenbw, enbw def _set_detrend(detrend, axis): """Set a detrending function to be applied to STFT windows prior to FFT. Loading Loading @@ -879,7 +882,7 @@ class STFTConfig: # Set a rectangular boxcar of 1s as the window if None is requested # - keeps following code cleaner. self.window_type = 'boxcar' self.window, self.nperseg = signal.spectral._triage_segments(self.window_type, self.nperseg, input_length=self.input_len) self.window, self.nperseg = _triage_segments(self.window_type, self.nperseg, input_length=self.input_len) self.nfft = _set_nfft(self.nfft, self.nperseg) self.noverlap = _set_noverlap(self.noverlap, self.nperseg) self.nstep = self.nperseg - self.noverlap Loading Loading @@ -1282,7 +1285,7 @@ def periodogram(x, average='mean', p = np.nanmean(p, axis=0).real elif config.average == 'median': p = np.nanmedian(p, axis=0).real elif config.average == None: elif config.average is None: pass else: msg = "'average' value of '{0}' not recognised - please use 'mean' or 'median'" Loading Loading @@ -1653,7 +1656,7 @@ def _process_input_covariate(cov, input_len): msg = "Regressor '{0}' shape ({1}) not matched to input data length ({2})" raise ValueError(msg.format(key, len(cov[key]), input_len)) ret = cov # pass back out elif cov == None: elif cov is None: ret = {} # No regressors defined else: # Check array_like inputs Loading Loading @@ -1824,7 +1827,6 @@ def _glm_fit_sklearn_estimator(pxx, covariates, confounds, config, fit_method, f else: # Sometimes this is stored in a sub model... betas = fit_method.estimator_.coef_.T extras = (fit_method) # Compute COPES and VARCOPES copes = contrasts.dot(betas) Loading