Skip to content

Commit f3605d7

Browse files
committed
MNT rename package voxelwise_tutorials
1 parent c85e8b7 commit f3605d7

21 files changed

Lines changed: 56 additions & 55 deletions

README.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
This repository contains some tutorials describing how to perform voxelwise
1414
modeling, based for instance on visual imaging experiments.
1515
The best way to explore these tutorials is to go to the
16-
`website <https://gallantlab.github.io/tutorials/>`_.
16+
`website <https://gallantlab.github.io/voxelwise_tutorials/>`_.
1717

18-
The ``voxelwise`` package
18+
The ``voxelwise_tutorials`` package
1919
=========================
2020

2121
On top of tutorials, this repository also contains a small Python package
22-
called ``voxelwise``, which contains useful fonctions to download the data sets,
23-
load the files, process the data, and visualize the results.
22+
called ``voxelwise_tutorials``, which contains useful fonctions to download the
23+
data sets, load the files, process the data, and visualize the results.
2424

2525
Installation
2626
------------
@@ -29,8 +29,8 @@ To install this package, run
2929

3030
.. code-block:: bash
3131
32-
git clone https://github.com/gallantlab/tutorials.git
33-
cd tutorials
32+
git clone https://github.com/gallantlab/voxelwise_tutorials.git
33+
cd voxelwise_tutorials
3434
pip install .
3535
3636
@@ -44,7 +44,7 @@ Developers can also install the package in editable mode via:
4444
Requirements
4545
------------
4646

47-
The Python package ``voxelwise`` requires the following dependencies:
47+
The Python package ``voxelwise_tutorials`` requires the following dependencies:
4848

4949
- `numpy <https://github.com/numpy/numpy>`_
5050
- `scipy <https://github.com/scipy/scipy>`_
@@ -57,11 +57,12 @@ documentations, such as:
5757
- `h5py <https://github.com/h5py/h5py>`_
5858
- `himalaya <https://github.com/gallantlab/himalaya>`_
5959
- `pymoten <https://github.com/gallantlab/pymoten>`_
60-
- `voxelwise <https://github.com/gallantlab/tutorials>`_ (this repository)
60+
- `voxelwise_tutorials <https://github.com/gallantlab/voxelwise_tutorials>`_
61+
(this repository)
6162

6263

6364
.. |Github| image:: https://img.shields.io/badge/github-tutorials-blue
64-
:target: https://github.com/gallantlab/tutorials
65+
:target: https://github.com/gallantlab/voxelwise_tutorials
6566

6667
.. |Python| image:: https://img.shields.io/badge/python-3.7%2B-blue
6768
:target: https://www.python.org/downloads/release/python-370

doc/_static/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
}
1212
.sphx-glr-thumbcontainer a.internal {
1313
padding: 150px 10px 0 !important; /*default = 150px 10px 0 */
14-
}
14+
}

doc/index.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ The tutorials consist of Python scripts, which are rendered in a
1616
The tutorials are best explored in order, starting with the
1717
"Movies 3T tutorial".
1818

19-
To run the tutorials yourself, we recommend to download the project on
20-
github at `gallantlab/tutorials <https://github.com/gallantlab/tutorials>`_.
21-
On top of the tutorials, the github repository contains a Python package
22-
called ``voxelwise``, which contains useful fonctions to download the data
23-
sets, load the files, process the data, and visualize the results.
24-
Install instructions are available `here <voxelwise_package.html>`_.
19+
To run the tutorials yourself, we recommend to download the project on github
20+
at `gallantlab/voxelwise_tutorials
21+
<https://github.com/gallantlab/voxelwise_tutorials>`_. On top of the tutorials,
22+
the github repository contains a Python package called ``voxelwise_tutorials``,
23+
which contains useful fonctions to download the data sets, load the files,
24+
process the data, and visualize the results. Install instructions are available
25+
`here <voxelwise_package.html>`_.
2526

2627
Tutorials
2728
---------

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import re
22
from setuptools import find_packages, setup
33

4-
# get version from voxelwise/__init__.py
5-
with open('voxelwise/__init__.py') as f:
4+
# get version from voxelwise_tutorials/__init__.py
5+
with open('voxelwise_tutorials/__init__.py') as f:
66
infos = f.readlines()
77
__version__ = ''
88
for line in infos:
@@ -19,7 +19,7 @@
1919

2020
if __name__ == "__main__":
2121
setup(
22-
name='voxelwise',
22+
name='voxelwise_tutorials',
2323
maintainer="Tom Dupre la Tour",
2424
maintainer_email="tom.dupre-la-tour@m4x.org",
2525
description="Tools and tutorials for voxelwise modeling",

tutorials/movies_3T/00_download_vim4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
###############################################################################
3636
# We will only use the first subject in this tutorial, but you can run the same
37-
# analysis on the four other subjects. Uncomment the lines in `DATAFILES` to
37+
# analysis on the four other subjects. Uncomment the lines in ``DATAFILES``` to
3838
# download more subjects.
3939
#
4040
# We also skip the stimuli files, since the dataset provides two preprocessed
@@ -43,7 +43,7 @@
4343

4444
import getpass
4545

46-
from voxelwise.io import download_crcns
46+
from voxelwise_tutorials.io import download_crcns
4747

4848
DATAFILES = [
4949
"TBD/features/motion_energy.hdf",

tutorials/movies_3T/01_plot_explainable_variance.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import os
3333
import numpy as np
3434

35-
from voxelwise.io import load_hdf5_array
35+
from voxelwise_tutorials.io import load_hdf5_array
3636

3737
###############################################################################
3838
# First, we load the fMRI responses on the test set, which contains 10 repeats.
@@ -48,7 +48,7 @@
4848
# Finally, a correction can be applied to account for small numbers of repeat
4949
# (parameter ``bias_correction``).
5050

51-
from voxelwise.utils import explainable_variance
51+
from voxelwise_tutorials.utils import explainable_variance
5252
ev = explainable_variance(Y_test, bias_correction=False)
5353

5454
###############################################################################
@@ -91,7 +91,7 @@
9191
# in a flatmap. To ease its use, we provide here an example function
9292
# ``plot_flatmap_from_mapper``.
9393

94-
from voxelwise.viz import plot_flatmap_from_mapper
94+
from voxelwise_tutorials.viz import plot_flatmap_from_mapper
9595

9696
mapper_file = os.path.join(directory, 'mappers', f'{subject}_mappers.hdf')
9797
plot_flatmap_from_mapper(ev, mapper_file, vmin=0, vmax=0.7)
@@ -121,7 +121,7 @@
121121
# Then, we load the fsaverage mapper. The mapper is a sparse CSR matrix, which
122122
# map each voxel to some vertices in the fsaverage surface.
123123
# The mapper is applied with a dot product ``@``.
124-
from voxelwise.io import load_hdf5_sparse_array
124+
from voxelwise_tutorials.io import load_hdf5_sparse_array
125125
voxel_to_fsaverage = load_hdf5_sparse_array(mapper_file,
126126
key='voxel_to_fsaverage')
127127
ev_projected = voxel_to_fsaverage @ ev

tutorials/movies_3T/02_plot_wordnet_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# We first load the fMRI responses.
4141
import os
4242
import numpy as np
43-
from voxelwise.io import load_hdf5_array
43+
from voxelwise_tutorials.io import load_hdf5_array
4444

4545
file_name = os.path.join(directory, "responses", f"{subject}_responses.hdf")
4646
Y_train = load_hdf5_array(file_name, key="Y_train")
@@ -82,7 +82,7 @@
8282
# cross-validation split, which preserves each recording run.
8383

8484
from sklearn.model_selection import check_cv
85-
from voxelwise.utils import generate_leave_one_run_out
85+
from voxelwise_tutorials.utils import generate_leave_one_run_out
8686

8787
# indice of first sample of each run
8888
run_onsets = load_hdf5_array(file_name, key="run_onsets")
@@ -113,7 +113,7 @@
113113
# delayed feature with a different weight, to maximize the predictions.
114114
# With a sample every 2 seconds, we typically use 4 delays [1, 2, 3, 4] to
115115
# cover the most part of the hemodynamic response peak.
116-
from voxelwise.delayer import Delayer
116+
from voxelwise_tutorials.delayer import Delayer
117117
delayer = Delayer(delays=[1, 2, 3, 4])
118118

119119
###############################################################################
@@ -197,7 +197,7 @@
197197
# (Check previous example to see how to use the mapper to Freesurfer average
198198
# surface.)
199199
import matplotlib.pyplot as plt
200-
from voxelwise.viz import plot_flatmap_from_mapper
200+
from voxelwise_tutorials.viz import plot_flatmap_from_mapper
201201

202202
mapper_file = os.path.join(directory, "mappers", f"{subject}_mappers.hdf")
203203
ax = plot_flatmap_from_mapper(scores, mapper_file, vmin=0, vmax=0.4)
@@ -264,7 +264,7 @@
264264
# from the diagonal means that one model has better predictive performances
265265
# than the other.
266266

267-
from voxelwise.viz import plot_hist2d
267+
from voxelwise_tutorials.viz import plot_hist2d
268268

269269
ax = plot_hist2d(scores_nodelay, scores)
270270
ax.set(title='Generalization R2 scores', xlabel='model without delays',

tutorials/movies_3T/03_plot_motion_energy_model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import os
4646
import numpy as np
4747

48-
from voxelwise.io import load_hdf5_array
48+
from voxelwise_tutorials.io import load_hdf5_array
4949

5050
file_name = os.path.join(directory, "responses", f"{subject}_responses.hdf")
5151
Y_train = load_hdf5_array(file_name, key="Y_train")
@@ -82,7 +82,7 @@
8282
# previous example.
8383

8484
from sklearn.model_selection import check_cv
85-
from voxelwise.utils import generate_leave_one_run_out
85+
from voxelwise_tutorials.utils import generate_leave_one_run_out
8686

8787
# indice of first sample of each run
8888
run_onsets = load_hdf5_array(file_name, key="run_onsets")
@@ -101,7 +101,7 @@
101101

102102
from sklearn.pipeline import make_pipeline
103103
from sklearn.preprocessing import StandardScaler
104-
from voxelwise.delayer import Delayer
104+
from voxelwise_tutorials.delayer import Delayer
105105
from himalaya.kernel_ridge import KernelRidgeCV
106106
from himalaya.backend import set_backend
107107
backend = set_backend("torch_cuda")
@@ -139,7 +139,7 @@
139139
# The performances are computed using the math:`R^2` scores.
140140

141141
import matplotlib.pyplot as plt
142-
from voxelwise.viz import plot_flatmap_from_mapper
142+
from voxelwise_tutorials.viz import plot_flatmap_from_mapper
143143

144144
mapper_file = os.path.join(directory, "mappers", f"{subject}_mappers.hdf")
145145
ax = plot_flatmap_from_mapper(scores_motion_energy, mapper_file, vmin=0,
@@ -189,7 +189,7 @@
189189
# from the diagonal means that one model has better predictive performances
190190
# than the other.
191191

192-
from voxelwise.viz import plot_hist2d
192+
from voxelwise_tutorials.viz import plot_hist2d
193193

194194
ax = plot_hist2d(scores_wordnet, scores_motion_energy)
195195
ax.set(title='Generalization R2 scores', xlabel='semantic wordnet model',
@@ -202,7 +202,7 @@
202202
# To further describe these differences, we can plot both performances on the
203203
# same flatmap.
204204

205-
from voxelwise.viz import plot_2d_flatmap_from_mapper
205+
from voxelwise_tutorials.viz import plot_2d_flatmap_from_mapper
206206

207207
mapper_file = os.path.join(directory, "mappers", f"{subject}_mappers.hdf")
208208
ax = plot_2d_flatmap_from_mapper(scores_wordnet, scores_motion_energy,

tutorials/movies_3T/04_plot_banded_ridge_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import os
3333
import numpy as np
3434

35-
from voxelwise.io import load_hdf5_array
35+
from voxelwise_tutorials.io import load_hdf5_array
3636

3737
file_name = os.path.join(directory, "responses", f"{subject}_responses.hdf")
3838
Y_train = load_hdf5_array(file_name, key="Y_train")
@@ -81,7 +81,7 @@
8181
# We define again a leave-one-run-out cross-validation split scheme.
8282

8383
from sklearn.model_selection import check_cv
84-
from voxelwise.utils import generate_leave_one_run_out
84+
from voxelwise_tutorials.utils import generate_leave_one_run_out
8585

8686
# define a cross-validation splitter, compatible with scikit-learn
8787
n_samples_train = X_train.shape[0]
@@ -97,7 +97,7 @@
9797
# and add delays with a ``Delayer``.
9898
from sklearn.pipeline import make_pipeline
9999
from sklearn.preprocessing import StandardScaler
100-
from voxelwise.delayer import Delayer
100+
from voxelwise_tutorials.delayer import Delayer
101101
from himalaya.backend import set_backend
102102
backend = set_backend("torch_cuda")
103103

@@ -268,7 +268,7 @@
268268
# from the diagonal means that one model has better predictive performances
269269
# than the other.
270270
import matplotlib.pyplot as plt
271-
from voxelwise.viz import plot_hist2d
271+
from voxelwise_tutorials.viz import plot_hist2d
272272

273273
ax = plot_hist2d(scores_baseline, scores)
274274
ax.set(title='Generalization R2 scores', xlabel='KernelRidgeCV',
@@ -309,7 +309,7 @@
309309
###############################################################################
310310
# We can then plot the split scores on a flatmap with a 2D colormap.
311311

312-
from voxelwise.viz import plot_2d_flatmap_from_mapper
312+
from voxelwise_tutorials.viz import plot_2d_flatmap_from_mapper
313313

314314
mapper_file = os.path.join(directory, "mappers", f"{subject}_mappers.hdf")
315315
ax = plot_2d_flatmap_from_mapper(split_scores[0], split_scores[1],

tutorials/movies_3T/05_extract_motion_energy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
import numpy as np
5757
from moten.io import imagearray2luminance
5858

59-
from voxelwise.progress_bar import bar
60-
from voxelwise.io import load_hdf5_array
59+
from voxelwise_tutorials.progress_bar import bar
60+
from voxelwise_tutorials.io import load_hdf5_array
6161

6262

6363
def compute_luminance(run_name, size=(96, 96)):
@@ -149,7 +149,7 @@ def compute_motion_energy(luminance,
149149
# approximately equal to the "motion-energy" features already precomputed in
150150
# the public data set.
151151

152-
from voxelwise.io import save_hdf5_dataset
152+
from voxelwise_tutorials.io import save_hdf5_dataset
153153

154154
features_directory = os.path.join(directory, "features")
155155
if not os.path.exists(features_directory):

0 commit comments

Comments
 (0)