Skip to content

Commit 4c3c95f

Browse files
committed
Save computed mapping in example
1 parent 3111413 commit 4c3c95f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ doc/auto_examples
88
doc/gen_modules
99
doc/generated
1010
doc/modules/generated
11-
.vscode
11+
.vscode
12+
13+
examples/**/*.pkl

examples/01_brain_alignment/plot_1_aligning_brain_dense.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
In this example, we align 2 low-resolution left hemispheres
88
using 4 fMRI feature maps (z-score contrast maps).
99
"""
10-
1110
# sphinx_gallery_thumbnail_number = 6
11+
import pickle
12+
1213
import gdist
1314
import matplotlib as mpl
1415
import matplotlib.gridspec as gridspec
@@ -299,6 +300,17 @@ def compute_geometry_from_mesh(mesh_path):
299300
verbose=True,
300301
)
301302

303+
# %%
304+
# Computed mappings can easily be saved on disk and loaded back:
305+
306+
# Save mappings
307+
with open("./mapping.pkl", "wb") as f:
308+
pickle.dump(mapping, f)
309+
310+
# Load mappings
311+
with open("./mapping.pkl", "rb") as f:
312+
mapping = pickle.load(f)
313+
302314
# %%
303315
# Here is the evolution of the FUGW loss during training,
304316
# without the entropic term. Note how, in this case,

0 commit comments

Comments
 (0)