Skip to content

Commit

Permalink
DOC: rebrand reverse correlation -> deconvolution
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Jul 15, 2021
1 parent 8bfd5d0 commit f81ff1b
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ New in 0.25
- The ``model`` parameter for ANOVA tests is now optional (see
:attr:`MneExperiment.tests`).

* Reverse correlation using :func:`boosting`.
* Deconvolution using :func:`boosting`.
* Loading and saving ``*.wav`` files (:func:`load.wav` and :func:`save.wav`).


Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def section_order(self):
'colormaps.py',
'customizing.py',
],
'reverse-correlation': [
'deconvolution': [
'trf_intro.py',
'mtrf.py',
'epoch_impulse.py',
Expand Down
6 changes: 3 additions & 3 deletions doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ functions. See also :class:`NDVar` methods.
xhemi


^^^^^^^^^^^^^^^^^^^
Reverse Correlation
^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^
Deconvolution
^^^^^^^^^^^^^

.. autosummary::
:toctree: generated
Expand Down
8 changes: 4 additions & 4 deletions eelbrain/_trf/_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from .._utils import LazyProperty, PickleableDataClass, user_activity
from .._utils.notebooks import tqdm
from ._boosting_opt import l1, l2, generate_options, update_error
from .shared import PredictorData, RevCorrData, Split, Splits, merge_segments
from .shared import PredictorData, DeconvolutionData, Split, Splits, merge_segments
from ._fit_metrics import get_evaluators


Expand Down Expand Up @@ -499,7 +499,7 @@ class Boosting:
Standard usage of the object-oriented API for a model with
cross-validation, comparable to the :func:`boosting` function::
data = RevCorrData(y, x, ds)
data = DeconvolutionData(y, x, ds)
data.apply_basis(0.05, 'hamming'')
data.normalize('l1')
data.initialize_cross_validation(5, test=1)
Expand Down Expand Up @@ -527,7 +527,7 @@ class Boosting:

def __init__(
self,
data: RevCorrData,
data: DeconvolutionData,
):
self.data = data

Expand Down Expand Up @@ -958,7 +958,7 @@ def boosting(
if selective_stopping < 0:
raise ValueError(f"selective_stopping={selective_stopping}")

data = RevCorrData(y, x, ds, scale_in_place)
data = DeconvolutionData(y, x, ds, scale_in_place)
data.apply_basis(basis, basis_window)
if scale_data:
data.normalize(error)
Expand Down
6 changes: 3 additions & 3 deletions eelbrain/_trf/_fit_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from scipy.stats import spearmanr, SpearmanRConstantInputWarning

from ._boosting_opt import l1, l2
from .shared import RevCorrData
from .shared import DeconvolutionData


class Evaluator:
Expand All @@ -18,7 +18,7 @@ class Evaluator:

def __init__(
self,
data: RevCorrData,
data: DeconvolutionData,
segments: List[np.ndarray] = None, # evaluations for different test-segments
):
n = len(data.y)
Expand Down Expand Up @@ -247,7 +247,7 @@ def _r(self, y, y_pred):

def get_evaluators(
keys: List[str],
data: RevCorrData,
data: DeconvolutionData,
segments: List[np.ndarray] = None, # evaluations for different test-segments
) -> (List[Evaluator], List[Evaluator], List[Evaluator]):
evaluators = [EVALUATORS[key](data, segments) for key in keys]
Expand Down
2 changes: 1 addition & 1 deletion eelbrain/_trf/_predictors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Predictors for reverse correlation"""
"""Predictors for deconvolution"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from itertools import repeat

Expand Down
6 changes: 3 additions & 3 deletions eelbrain/_trf/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def split_data(


class PredictorData:
"""Restructure model NDVars (like RevCorrData but for x only)"""
"""Restructure model NDVars (like DeconvolutionData but for x only)"""

def __init__(
self,
Expand Down Expand Up @@ -298,8 +298,8 @@ def __init__(
self.segments = segments


class RevCorrData:
"""Restructure input NDVars into arrays for reverse correlation
class DeconvolutionData:
"""Restructure input NDVars into arrays for deconvolution
Attributes
----------
Expand Down
4 changes: 2 additions & 2 deletions eelbrain/_trf/tests/test_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)

from eelbrain.testing import assert_dataobj_equal
from eelbrain._trf._boosting import Boosting, RevCorrData, Split, boost, convolve as boosting_convolve
from eelbrain._trf._boosting import Boosting, DeconvolutionData, Split, boost, convolve as boosting_convolve


def assert_res_equal(res1, res):
Expand Down Expand Up @@ -158,7 +158,7 @@ def test_boosting_epochs():

def test_boosting_oo():
ds = datasets._get_continuous(ynd=True)
data = RevCorrData('y', 'x2', ds)
data = DeconvolutionData('y', 'x2', ds)
data.apply_basis(0.2, 'hamming')
data.normalize('l1')
data.initialize_cross_validation(4, test=1)
Expand Down
12 changes: 6 additions & 6 deletions eelbrain/_trf/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
import pytest

from eelbrain import Factor, datasets, epoch_impulse_predictor
from eelbrain._trf.shared import RevCorrData
from eelbrain._trf.shared import DeconvolutionData


def test_revcorr_data_continuous():
def test_deconvolution_data_continuous():
ds = datasets._get_continuous(ynd=True)

# normalizing
data = RevCorrData(ds['y'][:8], ds['x1'][:8])
data = DeconvolutionData(ds['y'][:8], ds['x1'][:8])
data.normalize('l1')
assert data.x[0].mean() == pytest.approx(0, abs=1e-16)
assert abs(data.x).mean() == pytest.approx(1, abs=1e-10)
with pytest.raises(ValueError):
data.apply_basis(0.050, 'hamming')
# with basis
data = RevCorrData(ds['y'][:8], ds['x1'][:8])
data = DeconvolutionData(ds['y'][:8], ds['x1'][:8])
data.apply_basis(0.500, 'hamming')
data.normalize('l1')
assert data.x[0].mean() == pytest.approx(0, abs=1e-16)
Expand Down Expand Up @@ -65,13 +65,13 @@ def test_revcorr_data_continuous():
assert_array_equal(data.splits.splits[11].train, [[0, 40]])


def test_revcorr_data_trials():
def test_deconvolution_data_trials():
ds = datasets.get_uts()
n_times = len(ds['uts'].time)
ds['imp'] = epoch_impulse_predictor('uts', ds=ds)
ds['imp_a'] = epoch_impulse_predictor('uts', "A == 'a1'", ds=ds)

data = RevCorrData('uts', 'imp', ds)
data = DeconvolutionData('uts', 'imp', ds)
data.normalize('l1')
assert_array_equal(data.segments, [[i * n_times, (i + 1) * n_times] for i in range(60)])

Expand Down
2 changes: 1 addition & 1 deletion eelbrain/datasets/_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _get_continuous(
seed: int = 0,
xn: int = 0,
) -> Dataset:
"""Generate continuous data for reverse correlation
"""Generate continuous data for deconvolution tests
Parameters
----------
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
plot.Array(spectrogram, xlim=5, w=6, h=2)

###############################################################################
# Plot the envelope used as stimulus representation for reverse correlation:
# Plot the envelope used as stimulus representation for deconvolution:
plot.UTS(envelope, xlim=5, w=6, h=2)

###############################################################################
Expand All @@ -53,8 +53,8 @@
p.set_time(1.200)

###############################################################################
# Reverse correlation
# -------------------
# Deconvolution
# -------------
# TRF for the envelope using boosting:
#
# - TRF from -100 to 400 ms
Expand Down
File renamed without changes.

0 comments on commit f81ff1b

Please sign in to comment.