Skip to content

Commit cc5bc41

Browse files
committed
Merge remote-tracking branch 'dj/updates_py3_nipype0.13.1' into updates
* dj/updates_py3_nipype0.13.1: providing a proper link changing link changing resources_installation notebook to official nipype website temporarily removing Michaels links small edit edits of python cheat sheets, changing cells who cant be run to markdown small edit adding comments about inputs to Function changing tree command adding some options for nipypecli and crashfiles; small edit of spm errors adding a sentence about jupyter lab
2 parents 466a181 + b04cba6 commit cc5bc41

9 files changed

+399
-290
lines changed

index.ipynb

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 6,
5+
"execution_count": 2,
66
"metadata": {
77
"collapsed": false,
88
"deletable": true,
@@ -24,7 +24,7 @@
2424
" <div class=\"section-separator library-section-separator\">\n",
2525
" <center><img src=\"static/images/logoNipype_tutorial.png\" width=700></center>\n",
2626
" <p>Welcome to the Nipype Tutorial!\n",
27-
" This tutorial is based on <a href=\"https://github.com/miykael/nipype_tutorial\">Michael Notter's tutorial</a>, but it's updated to Python 3 and current version of Nipype. \n",
27+
" This tutorial is based on <a href=\"https://github.com/djarecka/nipype_tutorial\">Michael Notter's tutorial</a>, but it's updated to Python 3 and current version of Nipype. \n",
2828
" It covers the basic concepts and most common use cases of Nipype and will teach\n",
2929
" you everything so that you can start creating your own workflows in no time. We recommend that you start with\n",
3030
" the introduction section to familiarize yourself with the tools used in this tutorial and then move on to the\n",
@@ -93,14 +93,11 @@
9393
"\n",
9494
" <h2 class=\"domain-header test-prep\"><a class=\"domain-title\">Useful Resources & Links</a></h2>\n",
9595
" <div class=\"pure-g domain-table-container test-prep\">\n",
96-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_installation.ipynb\">Install Nipype</a>\n",
96+
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"http://nipype.readthedocs.io/en/latest/users/install.html\">Install Nipype</a>\n",
9797
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_resources.ipynb\">Useful Resources & Links</a>\n",
9898
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_help.ipynb\">Where to find Help</a>\n",
9999
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_python_cheat_sheet.ipynb\">Python Cheat Sheet</a>\n",
100100
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"http://nipype.readthedocs.io/en/latest/\">Nipype (homepage)</a>\n",
101-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"https://miykael.github.io/nipype-beginner-s-guide/\">Nipype Beginner's Guide</a>\n",
102-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"https://github.com/miykael/nipype_tutorial\">Github of Nipype Tutorial</a>\n",
103-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"https://github.com/miykael/nipype_course\">Github of Nipype Course</a>\n",
104101
" </div>\n",
105102
" <p>This section will give you helpful links and resources, so that you always know where to go to learn more.</p>\n",
106103
"\n",
@@ -123,7 +120,7 @@
123120
"$( document ).ready(code_toggle);\n",
124121
"</script>\n",
125122
"\n",
126-
"\n",
123+
"<hr/>\n",
127124
"\n",
128125
"To inspect the html code of this page, click: <form action=\"javascript:code_toggle()\"><input type=\"submit\" value=\"Show HTML code\"></form>"
129126
],
@@ -217,14 +214,11 @@
217214
"\n",
218215
" <h2 class=\"domain-header test-prep\"><a class=\"domain-title\">Useful Resources & Links</a></h2>\n",
219216
" <div class=\"pure-g domain-table-container test-prep\">\n",
220-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_installation.ipynb\">Install Nipype</a>\n",
217+
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"http://nipype.readthedocs.io/en/latest/users/install.html\">Install Nipype</a>\n",
221218
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_resources.ipynb\">Useful Resources & Links</a>\n",
222219
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_help.ipynb\">Where to find Help</a>\n",
223220
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_python_cheat_sheet.ipynb\">Python Cheat Sheet</a>\n",
224221
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"http://nipype.readthedocs.io/en/latest/\">Nipype (homepage)</a>\n",
225-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"https://miykael.github.io/nipype-beginner-s-guide/\">Nipype Beginner's Guide</a>\n",
226-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"https://github.com/miykael/nipype_tutorial\">Github of Nipype Tutorial</a>\n",
227-
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"https://github.com/miykael/nipype_course\">Github of Nipype Course</a>\n",
228222
" </div>\n",
229223
" <p>This section will give you helpful links and resources, so that you always know where to go to learn more.</p>\n",
230224
"\n",

notebooks/basic_error_and_crashes.ipynb

Lines changed: 295 additions & 74 deletions
Large diffs are not rendered by default.

notebooks/basic_function_nodes.ipynb

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,33 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": null,
19+
"execution_count": 22,
2020
"metadata": {
2121
"collapsed": true,
2222
"deletable": true,
2323
"editable": true
2424
},
25-
"outputs": [],
25+
"outputs": [
26+
{
27+
"name": "stdout",
28+
"output_type": "stream",
29+
"text": [
30+
"170724-23:46:58,86 workflow INFO:\n",
31+
"\t Executing node add_node in dir: /tmp/tmpn4l8l58q/add_node\n"
32+
]
33+
},
34+
{
35+
"data": {
36+
"text/plain": [
37+
"\n",
38+
"val_output = 6"
39+
]
40+
},
41+
"execution_count": 22,
42+
"metadata": {},
43+
"output_type": "execute_result"
44+
}
45+
],
2646
"source": [
2747
"# Import Node and Function module\n",
2848
"from nipype import Node, Function\n",
@@ -35,7 +55,11 @@
3555
"addtwo = Node(Function(input_names=[\"x_input\"],\n",
3656
" output_names=[\"val_output\"],\n",
3757
" function=add_two),\n",
38-
" name='add_node')"
58+
" name='add_node')\n",
59+
"\n",
60+
"addtwo.inputs.x_input =4\n",
61+
"addtwo.run()\n",
62+
"addtwo.result.outputs"
3963
]
4064
},
4165
{
@@ -47,12 +71,9 @@
4771
"source": [
4872
"# Trap 1\n",
4973
"\n",
50-
"There are only two traps that you should be aware when you're using the `Function` module. The first one is about naming the input variables. The variable name for the node input has to be the exactly the same name as the function input parameter, in this case this is `x_input`.\n",
51-
"\n",
52-
"Otherwise you get the following error:\n",
74+
"There are only two traps that you should be aware when you're using the `Function` module. The first one is about naming the input variables. The variable name for the node input has to be the exactly the same name as the function input parameter, in this case this is `x_input`. \n",
5375
"\n",
54-
" TypeError: add_two() got an unexpected keyword argument 'x_input'\n",
55-
" Interface Function failed to run."
76+
"Note that in the current version of `Nipype` you don't have to provide `input_names` as an argument of `Function`."
5677
]
5778
},
5879
{
@@ -69,7 +90,7 @@
6990
},
7091
{
7192
"cell_type": "code",
72-
"execution_count": null,
93+
"execution_count": 2,
7394
"metadata": {
7495
"collapsed": false,
7596
"deletable": true,
@@ -80,12 +101,12 @@
80101
"name": "stdout",
81102
"output_type": "stream",
82103
"text": [
83-
"170715-22:37:24,267 workflow INFO:\n",
84-
"\t Executing node rndArray_node in dir: /tmp/tmp4uytvbmi/rndArray_node\n",
104+
"170724-23:26:58,221 workflow INFO:\n",
105+
"\t Executing node rndArray_node in dir: /tmp/tmp0_afz7d5/rndArray_node\n",
85106
"\n",
86-
"random_array = [[ 0.79823248 0.73751608 0.47766192]\n",
87-
" [ 0.59740982 0.50278375 0.10288339]\n",
88-
" [ 0.63198252 0.05691885 0.08036156]]\n",
107+
"random_array = [[ 0.03670338 0.35478428 0.13727672]\n",
108+
" [ 0.27467434 0.10316801 0.02931249]\n",
109+
" [ 0.39554677 0.10852735 0.82837828]]\n",
89110
"\n"
90111
]
91112
}

notebooks/introduction_dataset.ipynb

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
"\n",
5656
"The dataset for this tutorial is coming from [https://openfmri.org/](https://openfmri.org/), a homepage dedicated to the free and open sharing of raw magnetic resonance imaging (MRI) datasets. We already downloaded the dataset [ds000114](https://github.com/datalad/ds000114) into the data folder at the current location. To reduce the size of the total dataset, only the first two subjects (`sub-01` and `sub-02`) were kept.\n",
5757
"\n",
58-
"So let's have a look at the tutorial dataset for `sub-01`."
58+
"So let's have a look at the tutorial dataset."
5959
]
6060
},
6161
{
6262
"cell_type": "code",
63-
"execution_count": null,
63+
"execution_count": 4,
6464
"metadata": {
6565
"collapsed": false,
6666
"deletable": true,
@@ -71,22 +71,43 @@
7171
"name": "stdout",
7272
"output_type": "stream",
7373
"text": [
74-
"/data/ds000114/sub-01/\r\n",
75-
"├── anat\r\n",
76-
"│   └── sub-01_T1w.nii.gz -> ../../.git/annex/objects/QP/jm/MD5E-s8677710--d6820f6cb8fb965e864419c14f6a22d5.nii.gz/MD5E-s8677710--d6820f6cb8fb965e864419c14f6a22d5.nii.gz\r\n",
77-
"├── dwi\r\n",
78-
"│   └── sub-01_dwi.nii.gz -> ../../.git/annex/objects/X2/kJ/MD5E-s104193417--454850ac9ed1c96c40b6b7946e51bf71.nii.gz/MD5E-s104193417--454850ac9ed1c96c40b6b7946e51bf71.nii.gz\r\n",
79-
"└── func\r\n",
80-
" ├── sub-01_task-fingerfootlips_bold.nii.gz -> ../../.git/annex/objects/k6/4f/MD5E-s24454931--e9ab535d84a922b0c7ed52461244cf47.nii.gz/MD5E-s24454931--e9ab535d84a922b0c7ed52461244cf47.nii.gz\r\n",
81-
" ├── sub-01_task-linebisection_bold.nii.gz -> ../../.git/annex/objects/32/Qq/MD5E-s31617092--151bc230c3b577110883369b6fad0daa.nii.gz/MD5E-s31617092--151bc230c3b577110883369b6fad0daa.nii.gz\r\n",
82-
" └── sub-01_task-linebisection_events.tsv\r\n",
74+
"/data/ds000114/\r\n",
75+
"├── dataset_description.json\r\n",
76+
"├── derivatives\r\n",
77+
"│   └── freesurfer\r\n",
78+
"│   ├── sub-01\r\n",
79+
"│   ├── sub-02\r\n",
80+
"│   └── Untitled1.ipynb\r\n",
81+
"├── dwi.bval\r\n",
82+
"├── dwi.bvec\r\n",
83+
"├── sub-01\r\n",
84+
"│   ├── anat\r\n",
85+
"│   │   └── sub-01_T1w.nii.gz -> ../../.git/annex/objects/QP/jm/MD5E-s8677710--d6820f6cb8fb965e864419c14f6a22d5.nii.gz/MD5E-s8677710--d6820f6cb8fb965e864419c14f6a22d5.nii.gz\r\n",
86+
"│   ├── dwi\r\n",
87+
"│   │   └── sub-01_dwi.nii.gz -> ../../.git/annex/objects/X2/kJ/MD5E-s104193417--454850ac9ed1c96c40b6b7946e51bf71.nii.gz/MD5E-s104193417--454850ac9ed1c96c40b6b7946e51bf71.nii.gz\r\n",
88+
"│   └── func\r\n",
89+
"│   ├── sub-01_task-fingerfootlips_bold.nii.gz -> ../../.git/annex/objects/k6/4f/MD5E-s24454931--e9ab535d84a922b0c7ed52461244cf47.nii.gz/MD5E-s24454931--e9ab535d84a922b0c7ed52461244cf47.nii.gz\r\n",
90+
"│   ├── sub-01_task-linebisection_bold.nii.gz -> ../../.git/annex/objects/32/Qq/MD5E-s31617092--151bc230c3b577110883369b6fad0daa.nii.gz/MD5E-s31617092--151bc230c3b577110883369b6fad0daa.nii.gz\r\n",
91+
"│   └── sub-01_task-linebisection_events.tsv\r\n",
92+
"├── sub-02\r\n",
93+
"│   ├── anat\r\n",
94+
"│   │   └── sub-02_T1w.nii.gz -> ../../.git/annex/objects/qq/gm/MD5E-s10025785--0e790e210a275d76e3f2f4d895df6358.nii.gz/MD5E-s10025785--0e790e210a275d76e3f2f4d895df6358.nii.gz\r\n",
95+
"│   ├── dwi\r\n",
96+
"│   │   └── sub-02_dwi.nii.gz -> ../../.git/annex/objects/8x/vp/MD5E-s104222416--86575d07809e9c717079592a12c69344.nii.gz/MD5E-s104222416--86575d07809e9c717079592a12c69344.nii.gz\r\n",
97+
"│   └── func\r\n",
98+
"│   ├── sub-02_task-fingerfootlips_bold.nii.gz -> ../../.git/annex/objects/pG/k1/MD5E-s24882575--75c39bee9e25e02c629dfcce1b378589.nii.gz/MD5E-s24882575--75c39bee9e25e02c629dfcce1b378589.nii.gz\r\n",
99+
"│   ├── sub-02_task-linebisection_bold.nii.gz -> ../../.git/annex/objects/WM/m9/MD5E-s32248732--4cd877de7b4c66e073610dffb67dfbcc.nii.gz/MD5E-s32248732--4cd877de7b4c66e073610dffb67dfbcc.nii.gz\r\n",
100+
"│   └── sub-02_task-linebisection_events.tsv\r\n",
101+
"├── task-fingerfootlips_bold.json\r\n",
102+
"├── task-fingerfootlips_events.tsv\r\n",
103+
"└── task-linebisection_bold.json\r\n",
83104
"\r\n",
84-
"3 directories, 5 files\r\n"
105+
"12 directories, 17 files\r\n"
85106
]
86107
}
87108
],
88109
"source": [
89-
"!tree /data/ds000114/sub-01/"
110+
"!tree -L 3 /data/ds000114/"
90111
]
91112
},
92113
{
@@ -96,7 +117,9 @@
96117
"editable": true
97118
},
98119
"source": [
99-
"As you can, we have one anatomical T1w image, two functional images, `fingerfootlips` and `linebisection`, and one diffusion weighted image. "
120+
"As you can, for every subject we have one anatomical T1w image, two functional images, `fingerfootlips` and `linebisection`, and one diffusion weighted image. In addition, we have directory with derivatives. \n",
121+
"\n",
122+
"If you used `datalad` or `git annex` to get the dataset, you can see symlinks for the image files."
100123
]
101124
},
102125
{
@@ -118,7 +141,7 @@
118141
},
119142
{
120143
"cell_type": "code",
121-
"execution_count": null,
144+
"execution_count": 5,
122145
"metadata": {
123146
"collapsed": false,
124147
"deletable": true,

notebooks/introduction_jupyter-notebook.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"\n",
1414
"This notebook was adapted from https://github.com/oesteban/biss2016 and is originally based on https://github.com/jvns/pandas-cookbook.\n",
1515
"\n",
16-
"[Jupyter Notebook](http://jupyter.org/) started as a web application, based on [IPython](https://ipython.org/) that can run Python code directly in the webbrowser. Now, Jupyter Notebook can handle over 40 programming languages and is *the* interactive, open source web application to run any scientific code."
16+
"[Jupyter Notebook](http://jupyter.org/) started as a web application, based on [IPython](https://ipython.org/) that can run Python code directly in the webbrowser. Now, Jupyter Notebook can handle over 40 programming languages and is *the* interactive, open source web application to run any scientific code.\n",
17+
"\n",
18+
"You might also want to try a new Jupyter environment [JupyterLab](https://github.com/jupyterlab/jupyterlab). "
1719
]
1820
},
1921
{
@@ -72,8 +74,7 @@
7274
"source": [
7375
"One of the most useful things about Jupyter Notebook is its tab completion. \n",
7476
"\n",
75-
"Try this: click just after `read_csv(` in the cell below and press `Shift+Tab` 4 times, slowly. \n",
76-
"TODO: i tried few times the 4times trick and it didn't work. Remove??"
77+
"Try this: click just after `read_csv(` in the cell below and press `Shift+Tab` 4 times, slowly (note that if you're using JupyterLab you don't have an additional help box option). \n"
7778
]
7879
},
7980
{

notebooks/resources_help.ipynb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"collapsed": true,
76
"deletable": true,
87
"editable": true
98
},
@@ -14,7 +13,6 @@
1413
{
1514
"cell_type": "markdown",
1615
"metadata": {
17-
"collapsed": true,
1816
"deletable": true,
1917
"editable": true
2018
},
@@ -23,7 +21,7 @@
2321
"\n",
2422
"[NeuroStars.org](https://neurostars.org/) is a platform similar to StackOverflow but dedicated to neuroscience and neuroinformatics. If you have a problem or would like to ask a question about how to do something in Nipype please submit a question to [NeuroStars.org](https://neurostars.org/) with a nipype tag.\n",
2523
"\n",
26-
"All previous Nipype questions are available here: http://neurostars.org/t/nipype/"
24+
"All previous Nipype questions are available [here](https://neurostars.org/tags/nipype)."
2725
]
2826
},
2927
{
@@ -54,23 +52,23 @@
5452
"metadata": {
5553
"anaconda-cloud": {},
5654
"kernelspec": {
57-
"display_name": "Python [default]",
55+
"display_name": "Python 3",
5856
"language": "python",
59-
"name": "python2"
57+
"name": "python3"
6058
},
6159
"language_info": {
6260
"codemirror_mode": {
6361
"name": "ipython",
64-
"version": 2
62+
"version": 3
6563
},
6664
"file_extension": ".py",
6765
"mimetype": "text/x-python",
6866
"name": "python",
6967
"nbconvert_exporter": "python",
70-
"pygments_lexer": "ipython2",
71-
"version": "2.7.12"
68+
"pygments_lexer": "ipython3",
69+
"version": "3.5.2"
7270
}
7371
},
7472
"nbformat": 4,
75-
"nbformat_minor": 0
73+
"nbformat_minor": 1
7674
}

0 commit comments

Comments
 (0)