Skip to content

Commit bb545c1

Browse files
committed
formatted notebook
1 parent ad01174 commit bb545c1

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

new-docs/source/tutorial/2-advanced-execution.ipynb

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"outputs": [],
2525
"source": [
2626
"import nest_asyncio\n",
27+
"\n",
2728
"nest_asyncio.apply()"
2829
]
2930
},
@@ -201,17 +202,17 @@
201202
"nifti_files = [Nifti1.sample(nifti_dir, seed=i) for i in range(10)]\n",
202203
"\n",
203204
"VOX_SIZES = [\n",
204-
" (0.5, 0.5, 0.5),\n",
205-
" (0.25, 0.25, 0.25),\n",
206-
" (0.1, 0.1, 0.1),\n",
207-
" (0.35, 0.35, 0.35),\n",
208-
" (0.1, 0.1, 0.1),\n",
209-
" (0.5, 0.5, 0.5),\n",
210-
" (0.25, 0.25, 0.25),\n",
211-
" (0.2, 0.2, 0.2),\n",
212-
" (0.35, 0.35, 0.35),\n",
213-
" (0.1, 0.1, 0.1),\n",
214-
" ]\n",
205+
" (0.5, 0.5, 0.5),\n",
206+
" (0.25, 0.25, 0.25),\n",
207+
" (0.1, 0.1, 0.1),\n",
208+
" (0.35, 0.35, 0.35),\n",
209+
" (0.1, 0.1, 0.1),\n",
210+
" (0.5, 0.5, 0.5),\n",
211+
" (0.25, 0.25, 0.25),\n",
212+
" (0.2, 0.2, 0.2),\n",
213+
" (0.35, 0.35, 0.35),\n",
214+
" (0.1, 0.1, 0.1),\n",
215+
"]\n",
215216
"\n",
216217
"mrgrid_varying_vox = MrGrid(operation=\"regrid\").split(\n",
217218
" (\"in_file\", \"voxel\"),\n",
@@ -300,7 +301,7 @@
300301
"with submitter:\n",
301302
" result4 = submitter(mrgrid_varying_vox4)\n",
302303
"\n",
303-
"# The cache directory for the new run is different \n",
304+
"# The cache directory for the new run is different\n",
304305
"assert result4.output_dir != result1.output_dir"
305306
]
306307
},
@@ -331,7 +332,7 @@
331332
"\n",
332333
"# Instantiate the task definition, \"splitting\" over all NIfTI files in the test directory\n",
333334
"# by splitting the \"input\" input field over all files in the directory\n",
334-
"mrgrid = MrGrid(in_file=nifti_file, operation=\"regrid\", voxel=(0.5,0.5,0.5))\n",
335+
"mrgrid = MrGrid(in_file=nifti_file, operation=\"regrid\", voxel=(0.5, 0.5, 0.5))\n",
335336
"\n",
336337
"# Run the task to resample all NIfTI files\n",
337338
"outputs = mrgrid(environment=Docker(image=\"mrtrix3/mrtrix3\", tag=\"latest\"))\n",
@@ -375,20 +376,27 @@
375376
"import os\n",
376377
"import platform\n",
377378
"\n",
379+
"\n",
378380
"def notify_task_completion(task: Task, result: Result):\n",
379381
" # Print a message to the terminal\n",
380382
" print(f\"Task completed! Results are stored in {str(task.output_dir)!r}\")\n",
381383
"\n",
382384
" # Platform-specific notifications\n",
383385
" if platform.system() == \"Darwin\": # macOS\n",
384-
" os.system('osascript -e \\'display notification \"Task has completed successfully!\" with title \"Task Notification\"\\'')\n",
386+
" os.system(\n",
387+
" 'osascript -e \\'display notification \"Task has completed successfully!\" '\n",
388+
" 'with title \"Task Notification\"\\''\n",
389+
" )\n",
385390
" elif platform.system() == \"Linux\": # Linux\n",
386391
" os.system('notify-send \"Task Notification\" \"Task has completed successfully!\"')\n",
387392
" elif platform.system() == \"Windows\": # Windows\n",
388393
" os.system('msg * \"Task has completed successfully!\"')\n",
389394
"\n",
395+
"\n",
390396
"# Run the task to resample all NIfTI files\n",
391-
"outputs = mrgrid(hooks=TaskHooks(post_run=notify_task_completion), cache_dir=tempfile.mkdtemp())\n",
397+
"outputs = mrgrid(\n",
398+
" hooks=TaskHooks(post_run=notify_task_completion), cache_dir=tempfile.mkdtemp()\n",
399+
")\n",
392400
"\n",
393401
"# Print the locations of the output files\n",
394402
"pprint(outputs.out_file)"

0 commit comments

Comments
 (0)