README.md 3.45 KB
Newer Older
Paul McCarthy's avatar
readme  
Paul McCarthy committed
1
2
3
4
# 2018 WIN PyTreat


This repository contains Jupyter notebooks and data for the 2018 WIN PyTreat.
Paul McCarthy's avatar
Paul McCarthy committed
5
6
7
8
It contains the following:

- The `talks` directory contains some (but not all) of the _Topyc_ talks that
  will be given throughout the week.
9
10
11
12
13
14
15
16
17
18
19

- The `getting_started` directory contains a series of practicals intended
  for those of you who are new to the Python programming language, or need
  a refresher.

- The `advanced_topics` directory contains a series of practicals on various
  aspects of the Python programming language - these are intended for those
  of you who are familiar with the basics of Python, and want to learn more
  about the language.


Paul McCarthy's avatar
Paul McCarthy committed
20
The practicals have been written under the assumption that FSL 5.0.10 is
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
installed.


## For attendees


To run these notebooks in the `fslpython` environment, you must first install
jupyter:


```
# If your FSL installation requires administrative privileges to modify, then
# you MUST run these commands as root - don't just prefix each individual
# command with sudo, or you will probably install jupyter into the wrong
# location!
#
# One further complication - once you have become root, $FSLDIR may not be set,
Paul McCarthy's avatar
Paul McCarthy committed
38
# so either set it as we have done below, or make sure that it is set, before
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# proceeding.
sudo su
export FSLDIR=/usr/local/fsl
source $FSLDIR/fslpython/bin/activate fslpython
conda install jupyter
source deactivate
ln -s $FSLDIR/fslpython/envs/fslpython/bin/jupyter $FSLDIR/bin/fsljupyter
```


Then, clone this repository on your local machine, and run
`fsljupyter notebook`:


```
git clone git@git.fmrib.ox.ac.uk:fsl/pytreat-2018-practicals.git
cd pytreat-2018-practicals
fsljupyter notebook
```


Paul McCarthy's avatar
Paul McCarthy committed
60
61
62
63
64
65
Throughout the week we might make changes to this repository. When this
happens, we will ask you to update your local clone of the repository with the
following command:


```
Paul McCarthy's avatar
Paul McCarthy committed
66
git stash save
Paul McCarthy's avatar
Paul McCarthy committed
67
git pull origin master
Paul McCarthy's avatar
Paul McCarthy committed
68
git stash pop
Paul McCarthy's avatar
Paul McCarthy committed
69
70
71
```


72
73
74
75
Have fun!


## For contributors
Paul McCarthy's avatar
readme  
Paul McCarthy committed
76
77


Paul McCarthy's avatar
Paul McCarthy committed
78
The upstream repository can be found at:
Paul McCarthy's avatar
Paul McCarthy committed
79
80

https://git.fmrib.ox.ac.uk/fsl/pytreat-2018-practicals
Paul McCarthy's avatar
readme  
Paul McCarthy committed
81
82
83
84


To contribute to the practicals:

Paul McCarthy's avatar
Paul McCarthy committed
85
1. Fork the upstream repository on gitlab
Paul McCarthy's avatar
readme  
Paul McCarthy committed
86

Paul McCarthy's avatar
Paul McCarthy committed
87
2. Make a local clone of your fork:
Paul McCarthy's avatar
readme  
Paul McCarthy committed
88

Paul McCarthy's avatar
Paul McCarthy committed
89
90
91
    ```
    git clone git@git.fmrib.ox.ac.uk:<username>/pytreat-2018-practicals
    ```
Paul McCarthy's avatar
Paul McCarthy committed
92
93
94

3. Add the upstream repository as a remote:

Paul McCarthy's avatar
Paul McCarthy committed
95
96
97
    ```
    git remote add upstream git@git.fmrib.ox.ac.uk:fsl/pytreat-2018-practicals.git
    ```
Paul McCarthy's avatar
Paul McCarthy committed
98
99
100
101
102

4. Make your changes on your local repository

5. Rebase onto the upstream repository, and push your changes to your fork:

Paul McCarthy's avatar
Paul McCarthy committed
103
104
    ```
    git fetch --all
Paul McCarthy's avatar
Paul McCarthy committed
105
106
    git rebase upstream/master
    git push --force origin master
Paul McCarthy's avatar
Paul McCarthy committed
107
    ```
Paul McCarthy's avatar
Paul McCarthy committed
108
109
110

6. In gitlab, submit a merge request from your fork back to the upstream
   repository.
Paul McCarthy's avatar
Paul McCarthy committed
111
112


113
114
When you install `jupyter` above, you may also wish to install
[`notedown`](https://github.com/aaren/notedown):
Paul McCarthy's avatar
Paul McCarthy committed
115

Paul McCarthy's avatar
Paul McCarthy committed
116
```
117
118
119
# .
# see instructions above
# .
Paul McCarthy's avatar
Paul McCarthy committed
120
121
122
conda install jupyter
pip install notedown
source deactivate
123
ln -s $FSLDIR/fslpython/envs/fslpython/bin/jupyter  $FSLDIR/bin/fsljupyter
Paul McCarthy's avatar
Paul McCarthy committed
124
125
126
ln -s $FSLDIR/fslpython/envs/fslpython/bin/notedown $FSLDIR/bin/fslnotedown
```

127
128
129
130
131
`notedown` is a handy tool which allows you to convert a markdown (`.md`) file
to a Jupyter notebook (`.ipynb`) file. So you can write your practical in your
text editor of choice, and then convert it into a notebook, instead of writing
the practical in the web browser interface. If you install notedown as
suggested in the code block above, you can run it on a markdown file like so:
Paul McCarthy's avatar
Paul McCarthy committed
132
133
134


```
135
fslnotedown my_markdown_file.md > my_notebook.ipynb
Paul McCarthy's avatar
Paul McCarthy committed
136
```