Skip to content

Commit

Permalink
Save computed mapping in example
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisthual committed Mar 12, 2023
1 parent 3111413 commit 4c3c95f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ doc/auto_examples
doc/gen_modules
doc/generated
doc/modules/generated
.vscode
.vscode

examples/**/*.pkl
14 changes: 13 additions & 1 deletion examples/01_brain_alignment/plot_1_aligning_brain_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
In this example, we align 2 low-resolution left hemispheres
using 4 fMRI feature maps (z-score contrast maps).
"""

# sphinx_gallery_thumbnail_number = 6
import pickle

import gdist
import matplotlib as mpl
import matplotlib.gridspec as gridspec
Expand Down Expand Up @@ -299,6 +300,17 @@ def compute_geometry_from_mesh(mesh_path):
verbose=True,
)

# %%
# Computed mappings can easily be saved on disk and loaded back:

# Save mappings
with open("./mapping.pkl", "wb") as f:
pickle.dump(mapping, f)

# Load mappings
with open("./mapping.pkl", "rb") as f:
mapping = pickle.load(f)

# %%
# Here is the evolution of the FUGW loss during training,
# without the entropic term. Note how, in this case,
Expand Down

0 comments on commit 4c3c95f

Please sign in to comment.