Skip to content

Commit

Permalink
[MAINT] Modernise super method calls (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsbinns committed Jun 18, 2024
1 parent 5a4a56f commit 57afdcc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
16 changes: 8 additions & 8 deletions mne_connectivity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ def __init__(
n_epochs_used=None,
**kwargs,
):
super(SpectralConnectivity, self).__init__(
super().__init__(
data,
names=names,
method=method,
Expand Down Expand Up @@ -980,7 +980,7 @@ def __init__(
n_epochs_used=None,
**kwargs,
):
super(TemporalConnectivity, self).__init__(
super().__init__(
data,
names=names,
method=method,
Expand Down Expand Up @@ -1031,7 +1031,7 @@ def __init__(
n_epochs_used=None,
**kwargs,
):
super(SpectroTemporalConnectivity, self).__init__(
super().__init__(
data,
names=names,
method=method,
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def __init__(
spec_method=None,
**kwargs,
):
super(EpochSpectralConnectivity, self).__init__(
super().__init__(
data,
freqs=freqs,
names=names,
Expand Down Expand Up @@ -1116,7 +1116,7 @@ class EpochTemporalConnectivity(TemporalConnectivity):
def __init__(
self, data, times, n_nodes, names=None, indices="all", method=None, **kwargs
):
super(EpochTemporalConnectivity, self).__init__(
super().__init__(
data,
times=times,
names=names,
Expand Down Expand Up @@ -1163,7 +1163,7 @@ def __init__(
spec_method=None,
**kwargs,
):
super(EpochSpectroTemporalConnectivity, self).__init__(
super().__init__(
data,
names=names,
freqs=freqs,
Expand Down Expand Up @@ -1210,7 +1210,7 @@ def __init__(
n_epochs_used=None,
**kwargs,
):
super(Connectivity, self).__init__(
super().__init__(
data,
names=names,
method=method,
Expand Down Expand Up @@ -1258,7 +1258,7 @@ def __init__(
n_epochs_used=None,
**kwargs,
):
super(EpochConnectivity, self).__init__(
super().__init__(
data,
names=names,
method=method,
Expand Down
2 changes: 1 addition & 1 deletion mne_connectivity/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def matplotlib_config():

class CallbackRegistryReraise(orig):
def __init__(self, exception_handler=None, signals=None):
super(CallbackRegistryReraise, self).__init__(exception_handler)
super().__init__(exception_handler)

cbook.CallbackRegistry = CallbackRegistryReraise

Expand Down
16 changes: 8 additions & 8 deletions mne_connectivity/spectral/epochs_bivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _CohEstBase(_EpochMeanConEstBase):
accumulate_psd = True

def __init__(self, n_cons, n_freqs, n_times):
super(_CohEstBase, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# allocate space for accumulation of CSD
self._acc = np.zeros(self.csd_shape, dtype=np.complex128)
Expand Down Expand Up @@ -114,7 +114,7 @@ class _PLVEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_PLVEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# allocate accumulator
self._acc = np.zeros(self.csd_shape, dtype=np.complex128)
Expand All @@ -138,7 +138,7 @@ class _ciPLVEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_ciPLVEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# allocate accumulator
self._acc = np.zeros(self.csd_shape, dtype=np.complex128)
Expand Down Expand Up @@ -167,7 +167,7 @@ class _PLIEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_PLIEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# allocate accumulator
self._acc = np.zeros(self.csd_shape)
Expand Down Expand Up @@ -209,7 +209,7 @@ class _DPLIEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_DPLIEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# allocate accumulator
self._acc = np.zeros(self.csd_shape)
Expand All @@ -235,7 +235,7 @@ class _WPLIEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_WPLIEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# store both imag(csd) and abs(imag(csd))
acc_shape = (2,) + self.csd_shape
Expand Down Expand Up @@ -274,7 +274,7 @@ class _WPLIDebiasedEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_WPLIDebiasedEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)
# store imag(csd), abs(imag(csd)), imag(csd)^2
acc_shape = (3,) + self.csd_shape
self._acc = np.zeros(acc_shape)
Expand Down Expand Up @@ -318,7 +318,7 @@ class _PPCEst(_EpochMeanConEstBase):
accumulate_psd = False

def __init__(self, n_cons, n_freqs, n_times):
super(_PPCEst, self).__init__(n_cons, n_freqs, n_times)
super().__init__(n_cons, n_freqs, n_times)

# store csd / abs(csd)
self._acc = np.zeros(self.csd_shape, dtype=np.complex128)
Expand Down
6 changes: 2 additions & 4 deletions mne_connectivity/spectral/epochs_multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ class _MultivariateCohEstBase(_EpochMeanMultivariateConEstBase):
accumulate_psd = False

def __init__(self, n_signals, n_cons, n_freqs, n_times, n_jobs=1):
super(_MultivariateCohEstBase, self).__init__(
n_signals, n_cons, n_freqs, n_times, n_jobs
)
super().__init__(n_signals, n_cons, n_freqs, n_times, n_jobs)

def compute_con(self, indices, ranks, n_epochs=1):
"""Compute multivariate coherency methods."""
Expand Down Expand Up @@ -658,7 +656,7 @@ class _GCEstBase(_EpochMeanMultivariateConEstBase):
accumulate_psd = False

def __init__(self, n_signals, n_cons, n_freqs, n_times, n_lags, n_jobs=1):
super(_GCEstBase, self).__init__(n_signals, n_cons, n_freqs, n_times, n_jobs)
super().__init__(n_signals, n_cons, n_freqs, n_times, n_jobs)

self.freq_res = (self.n_freqs - 1) * 2
if n_lags >= self.freq_res:
Expand Down

0 comments on commit 57afdcc

Please sign in to comment.