Skip to content

Commit c331f81

Browse files
committed
MNT fix flake8 errors
1 parent 1ecada4 commit c331f81

3 files changed

Lines changed: 22 additions & 21 deletions

File tree

tutorials/shortclips/01_plot_explainable_variance.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
================================
33
Compute the explainable variance
44
================================
@@ -15,26 +15,25 @@
1515
are the same for each repetition of the stimulus. Thus, encoding models will
1616
predict only the repeatable stimulus-dependent signal.
1717
18-
The stimulus-dependent signal can be estimated by taking the mean of
19-
brain responses over repeats of the same stimulus or experiment. The variance
20-
of the estimated stimulus-dependent signal, which we call the explainable
21-
variance, is proportional to the maximum prediction accuracy that can be
22-
obtained by a voxelwise encoding model in the test set.
18+
The stimulus-dependent signal can be estimated by taking the mean of brain
19+
responses over repeats of the same stimulus or experiment. The variance of the
20+
estimated stimulus-dependent signal, which we call the explainable variance, is
21+
proportional to the maximum prediction accuracy that can be obtained by a
22+
voxelwise encoding model in the test set.
2323
24-
Mathematically, let :math:`y_i, i = 1 \\dots N` be the measured signal in
25-
a voxel for each of the :math:`N` repetitions of the same stimulus and
26-
:math:`\\bar{y} = \\frac{1}{N}\\sum_{i=1}^Ny_i` the average brain response
27-
across repetitions. For each repeat, we define the residual timeseries
28-
between brain response and average brain response as :math:`r_i = y_i - \\bar{y}`.
29-
The explainable variance (EV) is estimated as
24+
Mathematically, let :math:`y_i, i = 1 \dots N` be the measured signal in a
25+
voxel for each of the :math:`N` repetitions of the same stimulus and
26+
:math:`\bar{y} = \frac{1}{N}\sum_{i=1}^Ny_i` the average brain response
27+
across repetitions. For each repeat, we define the residual timeseries between
28+
brain response and average brain response as :math:`r_i = y_i - \bar{y}`. The
29+
explainable variance (EV) is estimated as
3030
3131
.. math::
32-
\\text{EV} = \\frac{1}{N}\sum_{i=1}^N\\text{Var}(y_i) - \\frac{N}{N-1}\sum_{i=1}^N\\text{Var}(r_i)
32+
\text{EV} = \frac{1}{N}\sum_{i=1}^N\text{Var}(y_i) - \frac{N}{N-1}\sum_{i=1}^N\text{Var}(r_i)
3333
3434
35-
In the literature, the explainable
36-
variance is also known as the *signal power*. For more information, see these
37-
references [1]_ [2]_ [3]_.
35+
In the literature, the explainable variance is also known as the *signal
36+
power*. For more information, see these references [1]_ [2]_ [3]_.
3837
"""
3938
# sphinx_gallery_thumbnail_number = 1
4039
###############################################################################
@@ -151,8 +150,8 @@
151150
plt.show()
152151

153152
###############################################################################
154-
# This figure is a flattened map of the cortical surface. A number of regions of
155-
# interest (ROIs) have been labeled to ease interpretation. If you have
153+
# This figure is a flattened map of the cortical surface. A number of regions
154+
# of interest (ROIs) have been labeled to ease interpretation. If you have
156155
# never seen such a flatmap, we recommend taking a look at a `pycortex brain
157156
# viewer <https://www.gallantlab.org/brainviewer/Deniz2019>`_, which displays
158157
# the brain in 3D. In this viewer, press "I" to inflate the brain, "F" to
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# Simply use himalaya
22
from himalaya import bar, ProgressBar
3+
4+
__all__ = ["bar", "ProgressBar"]

voxelwise_tutorials/tests/test_mappers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_flatmap_mappers():
4444
ax=None)
4545
fig = ax.figure
4646
if save_fig:
47-
fig.savefig(f'test.png')
47+
fig.savefig('test.png')
4848
plt.close(fig)
4949

5050

@@ -66,7 +66,7 @@ def test_plot_2d_flatmap_from_mapper():
6666
vmin=-1, vmax=1, vmin2=-1, vmax2=1)
6767
fig = ax.figure
6868
if save_fig:
69-
fig.savefig(f'test_2d.png')
69+
fig.savefig('test_2d.png')
7070
plt.close(fig)
7171

7272

@@ -107,5 +107,5 @@ def test_fsaverage_mappers():
107107
cmap='inferno', alpha=0.7, with_curvature=True)
108108
fig = cortex.quickshow(vertex, with_rois=has_installed("inkscape"))
109109
if save_fig:
110-
fig.savefig(f'test_fsaverage.png')
110+
fig.savefig('test_fsaverage.png')
111111
plt.close(fig)

0 commit comments

Comments
 (0)