Skip to content

Commit 302683c

Browse files
committed
formatted tutorial notebook
1 parent a086db9 commit 302683c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

new-docs/source/tutorial/1-getting-started.ipynb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"from pprint import pprint\n",
3434
"import json\n",
3535
"\n",
36-
"JSON_CONTENTS = {'a': True, 'b': 'two', 'c': 3, 'd': [7, 0.55, 6]}\n",
36+
"JSON_CONTENTS = {\"a\": True, \"b\": \"two\", \"c\": 3, \"d\": [7, 0.55, 6]}\n",
3737
"\n",
3838
"test_dir = Path(mkdtemp())\n",
3939
"json_file = test_dir / \"test.json\"\n",
@@ -78,6 +78,7 @@
7878
"outputs": [],
7979
"source": [
8080
"import nest_asyncio\n",
81+
"\n",
8182
"nest_asyncio.apply()"
8283
]
8384
},
@@ -154,7 +155,9 @@
154155
"\n",
155156
"# Instantiate the task definition, \"splitting\" over all NIfTI files in the test directory\n",
156157
"# by splitting the \"input\" input field over all files in the directory\n",
157-
"mrgrid = MrGrid(operation=\"regrid\", voxel=(0.5,0.5,0.5)).split(in_file=nifti_dir.iterdir())\n",
158+
"mrgrid = MrGrid(operation=\"regrid\", voxel=(0.5, 0.5, 0.5)).split(\n",
159+
" in_file=nifti_dir.iterdir()\n",
160+
")\n",
158161
"\n",
159162
"# Run the task to resample all NIfTI files\n",
160163
"outputs = mrgrid()\n",
@@ -235,8 +238,12 @@
235238
"source": [
236239
"from pydra.tasks.mrtrix3.v3_0 import MrGrid\n",
237240
"\n",
238-
"if __name__ == \"__main__\": # <-- Add this block to allow the script to imported by subprocesses\n",
239-
" mrgrid = MrGrid(operation=\"regrid\", voxel=(0.5,0.5,0.5)).split(in_file=nifti_dir.iterdir())\n",
241+
"if (\n",
242+
" __name__ == \"__main__\"\n",
243+
"): # <-- Add this block to allow the script to imported by subprocesses\n",
244+
" mrgrid = MrGrid(operation=\"regrid\", voxel=(0.5, 0.5, 0.5)).split(\n",
245+
" in_file=nifti_dir.iterdir()\n",
246+
" )\n",
240247
" outputs = mrgrid(worker=\"cf\", n_procs=4) # <-- Select the \"cf\" worker here\n",
241248
" print(\"\\n\".join(str(p) for p in outputs.out_file))"
242249
]
@@ -301,10 +308,7 @@
301308
"my_cache_dir = Path(\"~/new-pydra-cache\").expanduser()\n",
302309
"my_cache_dir.mkdir(exist_ok=True)\n",
303310
"\n",
304-
"outputs = mrgrid(\n",
305-
" cache_dir=my_cache_dir,\n",
306-
" cache_locations=[default_run_cache_dir]\n",
307-
")\n",
311+
"outputs = mrgrid(cache_dir=my_cache_dir, cache_locations=[default_run_cache_dir])\n",
308312
"\n",
309313
"print(outputs)"
310314
]

0 commit comments

Comments
 (0)