Skip to content

Commit 8d26e8d

Browse files
committed
ENH: PEP8 corrections
1 parent 4bceb14 commit 8d26e8d

18 files changed

+445
-333
lines changed

notebooks/basic_data_input.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@
323323
"from nipype import SelectFiles, Node\n",
324324
"\n",
325325
"# String template with {}-based strings\n",
326-
"templates={'anat': '{subject_id}/anat/{subject_id}_T1w.nii.gz',\n",
327-
" 'func': '{subject_id}/func/{subject_id}_task-flanker_run-{task_id}_bold.nii.gz'}\n",
326+
"templates = {'anat': '{subject_id}/anat/{subject_id}_T1w.nii.gz',\n",
327+
" 'func': '{subject_id}/func/{subject_id}_task-flanker_run-{task_id}_bold.nii.gz'}\n",
328328
"\n",
329329
"# Create SelectFiles node\n",
330330
"sf = Node(SelectFiles(templates),\n",
@@ -421,8 +421,8 @@
421421
"from os.path import abspath as opap\n",
422422
"\n",
423423
"# String template with {}-based strings\n",
424-
"templates={'anat': '{subject_id}/anat/{subject_id}_T1w.nii.gz',\n",
425-
" 'func': '{subject_id}/func/{subject_id}_task-flanker_run-[1,2]_bold.nii.gz'}\n",
424+
"templates = {'anat': '{subject_id}/anat/{subject_id}_T1w.nii.gz',\n",
425+
" 'func': '{subject_id}/func/{subject_id}_task-flanker_run-[1,2]_bold.nii.gz'}\n",
426426
"\n",
427427
"# Create SelectFiles node\n",
428428
"sf = Node(SelectFiles(templates),\n",

notebooks/basic_data_output.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
"wf.connect([(smooth, sinker, [('out_file', 'in_file')]),\n",
238238
" (mcflirt, sinker, [('mean_img', 'mean_img'),\n",
239239
" ('par_file', 'par_file')]),\n",
240-
" ])\n",
240+
" ])\n",
241241
"wf.run()"
242242
]
243243
},
@@ -284,7 +284,7 @@
284284
"wf.connect([(smooth, sinker, [('out_file', 'preproc.@in_file')]),\n",
285285
" (mcflirt, sinker, [('mean_img', 'preproc.@mean_img'),\n",
286286
" ('par_file', 'preproc.@par_file')]),\n",
287-
" ])\n",
287+
" ])\n",
288288
"wf.run()"
289289
]
290290
},

notebooks/basic_graph_visualization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@
520520
"name": "python",
521521
"nbconvert_exporter": "python",
522522
"pygments_lexer": "ipython2",
523-
"version": "2.7.12"
523+
"version": "2.7.13"
524524
}
525525
},
526526
"nbformat": 4,

notebooks/basic_import_workflows.ipynb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@
228228
" -Tmean smean.nii.gz\n",
229229
"\n",
230230
"from nilearn import image, plotting\n",
231-
"plotting.plot_epi('fmean.nii.gz', title=\"mean (no smoothing)\",\n",
232-
" display_mode='z', cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))\n",
233-
"plotting.plot_epi('smean.nii.gz', title=\"mean (susan smoothed)\",\n",
234-
" display_mode='z', cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))"
231+
"plotting.plot_epi(\n",
232+
" 'fmean.nii.gz', title=\"mean (no smoothing)\", display_mode='z',\n",
233+
" cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))\n",
234+
"plotting.plot_epi(\n",
235+
" 'smean.nii.gz', title=\"mean (susan smoothed)\", display_mode='z',\n",
236+
" cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))"
235237
]
236238
},
237239
{
@@ -392,14 +394,17 @@
392394
" -Tmean mmean.nii.gz\n",
393395
"\n",
394396
"from nilearn import image, plotting\n",
395-
"plotting.plot_epi('smean.nii.gz', title=\"mean (susan smooth)\",\n",
396-
" display_mode='z', cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))\n",
397-
"plotting.plot_epi('mmean.nii.gz', title=\"mean (smoothed, median=99%)\",\n",
398-
" display_mode='z', cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))"
397+
"plotting.plot_epi(\n",
398+
" 'smean.nii.gz', title=\"mean (susan smooth)\", display_mode='z',\n",
399+
" cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))\n",
400+
"plotting.plot_epi(\n",
401+
" 'mmean.nii.gz', title=\"mean (smoothed, median=99%)\", display_mode='z',\n",
402+
" cmap='gray', cut_coords=(-15, -5, 5, 15, 25, 35))"
399403
]
400404
}
401405
],
402406
"metadata": {
407+
"anaconda-cloud": {},
403408
"kernelspec": {
404409
"display_name": "Python [default]",
405410
"language": "python",

notebooks/basic_interfaces.ipynb

Lines changed: 75 additions & 58 deletions
Large diffs are not rendered by default.

notebooks/basic_iteration.ipynb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"from nipype.interfaces.fsl import BET, IsotropicSmooth\n",
4848
"\n",
4949
"# Initiate a skull stripping Node with BET\n",
50-
"skullstrip = Node(BET(mask=True, in_file='/data/ds102/sub-01/anat/sub-01_T1w.nii.gz'),\n",
50+
"skullstrip = Node(BET(mask=True,\n",
51+
" in_file='/data/ds102/sub-01/anat/sub-01_T1w.nii.gz'),\n",
5152
" name=\"skullstrip\")"
5253
]
5354
},
@@ -314,16 +315,21 @@
314315
"source": [
315316
"%pylab inline\n",
316317
"from nilearn import plotting\n",
317-
"plotting.plot_anat('/data/ds102/sub-01/anat/sub-01_T1w.nii.gz', title='original', \n",
318-
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
319-
"plotting.plot_anat('/data/smoothflow/skullstrip/sub-01_T1w_brain.nii.gz', title='skullstripped', \n",
320-
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
321-
"plotting.plot_anat('/data/smoothflow/_fwhm_4/iso_smooth/sub-01_T1w_brain_smooth.nii.gz', title='FWHM=4', \n",
322-
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
323-
"plotting.plot_anat('/data/smoothflow/_fwhm_8/iso_smooth/sub-01_T1w_brain_smooth.nii.gz', title='FWHM=8', \n",
324-
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
325-
"plotting.plot_anat('/data/smoothflow/_fwhm_16/iso_smooth/sub-01_T1w_brain_smooth.nii.gz', title='FWHM=16', \n",
326-
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)"
318+
"plotting.plot_anat(\n",
319+
" '/data/ds102/sub-01/anat/sub-01_T1w.nii.gz', title='original',\n",
320+
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
321+
"plotting.plot_anat(\n",
322+
" '/data/smoothflow/skullstrip/sub-01_T1w_brain.nii.gz', title='skullstripped',\n",
323+
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
324+
"plotting.plot_anat(\n",
325+
" '/data/smoothflow/_fwhm_4/iso_smooth/sub-01_T1w_brain_smooth.nii.gz', title='FWHM=4',\n",
326+
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
327+
"plotting.plot_anat(\n",
328+
" '/data/smoothflow/_fwhm_8/iso_smooth/sub-01_T1w_brain_smooth.nii.gz', title='FWHM=8',\n",
329+
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)\n",
330+
"plotting.plot_anat(\n",
331+
" '/data/smoothflow/_fwhm_16/iso_smooth/sub-01_T1w_brain_smooth.nii.gz', title='FWHM=16',\n",
332+
" display_mode='z', cut_coords=(-20, -10, 0, 10, 20), annotate=False)"
327333
]
328334
},
329335
{

notebooks/basic_nodes.ipynb

Lines changed: 26 additions & 29 deletions
Large diffs are not rendered by default.

notebooks/basic_workflow.ipynb

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@
133133
],
134134
"source": [
135135
"f = plt.figure(figsize=(12, 4))\n",
136-
"for i, img in enumerate([\"T1w\", \"T1w_smooth\", \"T1w_brain_mask\", \"T1w_smooth_mask\"]):\n",
136+
"for i, img in enumerate([\"T1w\", \"T1w_smooth\",\n",
137+
" \"T1w_brain_mask\", \"T1w_smooth_mask\"]):\n",
137138
" f.add_subplot(1, 4, i + 1)\n",
138139
" plot_slice(\"/data/ds102/sub-02/anat/sub-02_%s.nii.gz\" % img)\n",
139140
" plt.title(img)"
@@ -204,7 +205,8 @@
204205
"mask.run()\n",
205206
"\n",
206207
"f = plt.figure(figsize=(12, 4))\n",
207-
"for i, img in enumerate([\"T1w\", \"T1w_smooth\", \"T1w_brain_mask\", \"T1w_smooth_mask\"]):\n",
208+
"for i, img in enumerate([\"T1w\", \"T1w_smooth\",\n",
209+
" \"T1w_brain_mask\", \"T1w_smooth_mask\"]):\n",
208210
" f.add_subplot(1, 4, i + 1)\n",
209211
" plot_slice(\"/data/ds102/sub-02/anat/sub-02_%s.nii.gz\" % img)\n",
210212
" plt.title(img)"
@@ -248,11 +250,13 @@
248250
"from nipype.interfaces import fsl\n",
249251
"\n",
250252
"# Skullstrip process\n",
251-
"skullstrip = fsl.BET(in_file=\"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\", mask=True)\n",
253+
"skullstrip = fsl.BET(\n",
254+
" in_file=\"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\", mask=True)\n",
252255
"bet_result = skullstrip.run() # skullstrip object\n",
253256
"\n",
254257
"# Smooth process\n",
255-
"smooth = fsl.IsotropicSmooth(in_file=\"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\", fwhm=4)\n",
258+
"smooth = fsl.IsotropicSmooth(\n",
259+
" in_file=\"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\", fwhm=4)\n",
256260
"smooth_result = smooth.run() # smooth object\n",
257261
"\n",
258262
"# Mask process\n",
@@ -261,7 +265,8 @@
261265
"mask.run()\n",
262266
"\n",
263267
"f = plt.figure(figsize=(12, 4))\n",
264-
"for i, img in enumerate([\"T1w\", \"T1w_smooth\", \"T1w_brain_mask\", \"T1w_smooth_mask\"]):\n",
268+
"for i, img in enumerate([\"T1w\", \"T1w_smooth\",\n",
269+
" \"T1w_brain_mask\", \"T1w_smooth_mask\"]):\n",
265270
" f.add_subplot(1, 4, i + 1)\n",
266271
" plot_slice(\"/data/ds102/sub-02/anat/sub-02_%s.nii.gz\" % img)\n",
267272
" plt.title(img)"
@@ -833,8 +838,10 @@
833838
"source": [
834839
"from nipype import Function\n",
835840
"extract_func = lambda list_out: list_out[0]\n",
836-
"list_extract = Node(Function(input_names=[\"list_out\"], output_names=[\"out_file\"],\n",
837-
" function=extract_func), name=\"list_extract\")"
841+
"list_extract = Node(Function(input_names=[\"list_out\"],\n",
842+
" output_names=[\"out_file\"],\n",
843+
" function=extract_func),\n",
844+
" name=\"list_extract\")"
838845
]
839846
},
840847
{
@@ -867,12 +874,14 @@
867874
"# Connect the nodes to each other and to the susan workflow\n",
868875
"wf2.connect([(skullstrip2, mask2, [(\"mask_file\", \"mask_file\")]),\n",
869876
" (skullstrip2, susan, [(\"mask_file\", \"inputnode.mask_file\")]),\n",
870-
" (susan, list_extract, [(\"outputnode.smoothed_files\", \"list_out\")]),\n",
877+
" (susan, list_extract, [(\"outputnode.smoothed_files\",\n",
878+
" \"list_out\")]),\n",
871879
" (list_extract, mask2, [(\"out_file\", \"in_file\")])\n",
872-
" ])\n",
880+
" ])\n",
873881
"\n",
874882
"# Specify the remaining input variables for the susan workflow\n",
875-
"susan.inputs.inputnode.in_files = abspath(\"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\")\n",
883+
"susan.inputs.inputnode.in_files = abspath(\n",
884+
" \"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\")\n",
876885
"susan.inputs.inputnode.fwhm = 4"
877886
]
878887
},
@@ -1024,7 +1033,8 @@
10241033
"source": [
10251034
"f = plt.figure(figsize=(12, 4))\n",
10261035
"for i, e in enumerate([[\"/data/ds102/sub-02/anat/sub-02_T1w.nii.gz\", 'input'],\n",
1027-
" [\"working_dir/susanflow/mask/sub-02_T1w_smooth_masked.nii.gz\", 'output']]):\n",
1036+
" [\"working_dir/susanflow/mask/sub-02_T1w_smooth_masked.nii.gz\", \n",
1037+
" 'output']]):\n",
10281038
" f.add_subplot(1, 2, i + 1)\n",
10291039
" plot_slice(e[0])\n",
10301040
" plt.title(e[1])"

notebooks/example_1stlevel.ipynb

Lines changed: 58 additions & 40 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)