Skip to content

Commit 1fd9e64

Browse files
committed
dev docs: nilearn/nilearn@329d901 : [FIX] standardize verbosity (#5778)
1 parent 1a03d33 commit 1fd9e64

File tree

907 files changed

+24630
-8061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

907 files changed

+24630
-8061
lines changed
Binary file not shown.

dev/_downloads/01cfe421c270935a30bc814b91794c28/plot_haxby_mass_univariate.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
},
5959
"outputs": [],
6060
"source": [
61-
"from nilearn.image import index_img\nfrom nilearn.maskers import NiftiMasker\n\nmask_filename = haxby_dataset.mask\n\nnifti_masker = NiftiMasker(\n smoothing_fwhm=8,\n mask_img=mask_filename,\n memory=\"nilearn_cache\", # cache options\n memory_level=1,\n)\nfunc_filename = haxby_dataset.func[0]\nfunc_reduced = index_img(func_filename, condition_mask)\nfmri_masked = nifti_masker.fit_transform(func_reduced)\n\n# We consider the mean image per run and per condition.\n# Otherwise, the observations cannot be exchanged at random because\n# a time dependence exists between observations within a same run.\nn_runs = np.unique(runs).size\nconditions_per_run = 2\ngrouped_fmri_masked = np.empty(\n (conditions_per_run * n_runs, fmri_masked.shape[1])\n)\ngrouped_conditions_encoded = np.empty((conditions_per_run * n_runs, 1))\n\nfor s in range(n_runs):\n run_mask = runs[condition_mask] == s\n run_house_mask = np.logical_and(\n run_mask, conditions[condition_mask] == \"house\"\n )\n run_face_mask = np.logical_and(\n run_mask, conditions[condition_mask] == \"face\"\n )\n grouped_fmri_masked[2 * s] = fmri_masked[run_house_mask].mean(0)\n grouped_fmri_masked[2 * s + 1] = fmri_masked[run_face_mask].mean(0)\n grouped_conditions_encoded[2 * s] = conditions_encoded[run_house_mask][0]\n grouped_conditions_encoded[2 * s + 1] = conditions_encoded[run_face_mask][\n 0\n ]"
61+
"from nilearn.image import index_img\nfrom nilearn.maskers import NiftiMasker\n\nmask_filename = haxby_dataset.mask\n\nnifti_masker = NiftiMasker(\n smoothing_fwhm=8,\n mask_img=mask_filename,\n memory=\"nilearn_cache\", # cache options\n memory_level=1,\n verbose=1,\n)\nfunc_filename = haxby_dataset.func[0]\nfunc_reduced = index_img(func_filename, condition_mask)\nfmri_masked = nifti_masker.fit_transform(func_reduced)\n\n# We consider the mean image per run and per condition.\n# Otherwise, the observations cannot be exchanged at random because\n# a time dependence exists between observations within a same run.\nn_runs = np.unique(runs).size\nconditions_per_run = 2\ngrouped_fmri_masked = np.empty(\n (conditions_per_run * n_runs, fmri_masked.shape[1])\n)\ngrouped_conditions_encoded = np.empty((conditions_per_run * n_runs, 1))\n\nfor s in range(n_runs):\n run_mask = runs[condition_mask] == s\n run_house_mask = np.logical_and(\n run_mask, conditions[condition_mask] == \"house\"\n )\n run_face_mask = np.logical_and(\n run_mask, conditions[condition_mask] == \"face\"\n )\n grouped_fmri_masked[2 * s] = fmri_masked[run_house_mask].mean(0)\n grouped_fmri_masked[2 * s + 1] = fmri_masked[run_face_mask].mean(0)\n grouped_conditions_encoded[2 * s] = conditions_encoded[run_house_mask][0]\n grouped_conditions_encoded[2 * s + 1] = conditions_encoded[run_face_mask][\n 0\n ]"
6262
]
6363
},
6464
{

dev/_downloads/034e4a0d5c805cf4938eba117765c0ee/plot_predictions_residuals.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"outputs": [],
4242
"source": [
43-
"from nilearn.glm.first_level import FirstLevelModel\n\nfmri_glm = FirstLevelModel(\n t_r=subject_data.t_r,\n drift_model=\"cosine\",\n signal_scaling=False,\n mask_img=mask,\n minimize_memory=False,\n)\n\nfmri_glm = fmri_glm.fit(fmri_img, events)"
43+
"from nilearn.glm.first_level import FirstLevelModel\n\nfmri_glm = FirstLevelModel(\n t_r=subject_data.t_r,\n drift_model=\"cosine\",\n signal_scaling=False,\n mask_img=mask,\n minimize_memory=False,\n verbose=1,\n)\n\nfmri_glm = fmri_glm.fit(fmri_img, events)"
4444
]
4545
},
4646
{
@@ -76,7 +76,7 @@
7676
},
7777
"outputs": [],
7878
"source": [
79-
"from nilearn.maskers import NiftiSpheresMasker\nfrom nilearn.reporting import get_clusters_table\n\ntable = get_clusters_table(\n z_map, stat_threshold=threshold, cluster_threshold=20\n)\ntable.set_index(\"Cluster ID\", drop=True)\nprint(table)\n\ncoords = table.loc[range(1, 7), [\"X\", \"Y\", \"Z\"]].to_numpy()\nprint(coords)\n\nmasker = NiftiSpheresMasker(coords)\nreal_timeseries = masker.fit_transform(fmri_img)\npredicted_timeseries = masker.fit_transform(fmri_glm.predicted[0])"
79+
"from nilearn.maskers import NiftiSpheresMasker\nfrom nilearn.reporting import get_clusters_table\n\ntable = get_clusters_table(\n z_map, stat_threshold=threshold, cluster_threshold=20\n)\ntable.set_index(\"Cluster ID\", drop=True)\nprint(table)\n\ncoords = table.loc[range(1, 7), [\"X\", \"Y\", \"Z\"]].to_numpy()\nprint(coords)\n\nmasker = NiftiSpheresMasker(coords, verbose=1)\nreal_timeseries = masker.fit_transform(fmri_img)\npredicted_timeseries = masker.fit_transform(fmri_glm.predicted[0])"
8080
]
8181
},
8282
{
Binary file not shown.
Binary file not shown.
40 Bytes
Binary file not shown.
Binary file not shown.

dev/_downloads/0819560eb93050d61651e3d779f2047b/plot_haxby_multiclass.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54-
"from nilearn.maskers import NiftiMasker\n\n# For decoding, standardizing is often very important\nnifti_masker = NiftiMasker(\n mask_img=mask_filename,\n standardize=\"zscore_sample\",\n runs=run,\n smoothing_fwhm=4,\n memory=\"nilearn_cache\",\n memory_level=1,\n)\nX = nifti_masker.fit_transform(func_filename)\n\n# Remove the \"rest\" condition\nX = X[non_rest]\nrun = run[non_rest]"
54+
"from nilearn.maskers import NiftiMasker\n\n# For decoding, standardizing is often very important\nnifti_masker = NiftiMasker(\n mask_img=mask_filename,\n standardize=\"zscore_sample\",\n runs=run,\n smoothing_fwhm=4,\n memory=\"nilearn_cache\",\n memory_level=1,\n verbose=1,\n)\nX = nifti_masker.fit_transform(func_filename)\n\n# Remove the \"rest\" condition\nX = X[non_rest]\nrun = run[non_rest]"
5555
]
5656
},
5757
{
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)