README.md 4.45 KB
Newer Older
Paul McCarthy's avatar
Paul McCarthy committed
1
# 2020 WIN PyTreat
Paul McCarthy's avatar
readme  
Paul McCarthy committed
2
3


Paul McCarthy's avatar
Paul McCarthy committed
4
This repository contains Jupyter notebooks and data for the 2020 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 6.0.3 is
21
22
23
24
25
26
installed.


## For attendees


27
These notebooks can be run in the `fslpython` environment using:
28
29
30


```
31
git clone https://git.fmrib.ox.ac.uk/fsl/pytreat-practicals-2020.git
Paul McCarthy's avatar
Paul McCarthy committed
32
cd pytreat-practicals-2020
33
fslpython -m notebook
34
35
```

36
37
38
39
40
41
42
A page should open in your web browser - to access the practicals, navigate
into one of the `getting_started` or `advanced_topics` directories, and click
on the `.ipynb` file you are interested in. Some of the talks are also
presented in notebook form - navigate to the talk you are interested in
(within the `talks` directory), and click on the `.ipynb` file to follow
along.

43

Paul McCarthy's avatar
Paul McCarthy committed
44
45
46
47
48
49
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
50
git stash save
Paul McCarthy's avatar
Paul McCarthy committed
51
git pull origin master
Paul McCarthy's avatar
Paul McCarthy committed
52
git stash pop
Paul McCarthy's avatar
Paul McCarthy committed
53
54
55
```


56
57
58
59
Have fun!


## For contributors
Paul McCarthy's avatar
readme  
Paul McCarthy committed
60
61


Paul McCarthy's avatar
Paul McCarthy committed
62
The main repository can be found at:
Paul McCarthy's avatar
Paul McCarthy committed
63

Paul McCarthy's avatar
Paul McCarthy committed
64
https://git.fmrib.ox.ac.uk/fsl/pytreat-practicals-2020
Paul McCarthy's avatar
readme  
Paul McCarthy committed
65
66


Paul McCarthy's avatar
Paul McCarthy committed
67
Updates to the master branch should occur via merge requests. You can choose
Paul McCarthy's avatar
Paul McCarthy committed
68
69
to either work on a branch within this repository, on a fork of this
repository.
Paul McCarthy's avatar
Paul McCarthy committed
70

Paul McCarthy's avatar
Paul McCarthy committed
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
### Using a branch within this repository

1. Make a local clone of the repository:

    ```
    git clone https://git.fmrib.ox.ac.uk/fsl/pytreat-practicals-2020.git
    ```

2. Create a branch for your work:

    ```
    git checkout -b my_cool_branch origin/master
    ```

3. Make your changes on this branch.

4. Push your changes to the gitlab repository:

    ```
    git push origin my_cool_branch
    ```

5. In gitlab, submit a merge request from your branch onto the master
   branch.


### Using a fork of this repository
Paul McCarthy's avatar
readme  
Paul McCarthy committed
98

Paul McCarthy's avatar
Paul McCarthy committed
99
1. Fork the upstream repository on gitlab
Paul McCarthy's avatar
readme  
Paul McCarthy committed
100

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

Paul McCarthy's avatar
Paul McCarthy committed
103
    ```
Paul McCarthy's avatar
Paul McCarthy committed
104
    git clone https://git.fmrib.ox.ac.uk/<your_username>/pytreat-practicals-2020.git
Paul McCarthy's avatar
Paul McCarthy committed
105
    ```
Paul McCarthy's avatar
Paul McCarthy committed
106
107
108

3. Add the upstream repository as a remote:

Paul McCarthy's avatar
Paul McCarthy committed
109
    ```
110
    git remote add upstream https://git.fmrib.ox.ac.uk/fsl/pytreat-practicals-2020.git
Paul McCarthy's avatar
Paul McCarthy committed
111
    ```
Paul McCarthy's avatar
Paul McCarthy committed
112
113
114

4. Make your changes on your local repository

Paul McCarthy's avatar
Paul McCarthy committed
115
5. Push your changes to your fork:
Paul McCarthy's avatar
Paul McCarthy committed
116

Paul McCarthy's avatar
Paul McCarthy committed
117
    ```
Paul McCarthy's avatar
Paul McCarthy committed
118
    git push origin master
Paul McCarthy's avatar
Paul McCarthy committed
119
    ```
Paul McCarthy's avatar
Paul McCarthy committed
120
121
122

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


Paul McCarthy's avatar
Paul McCarthy committed
125
### Updating your local repository
Paul McCarthy's avatar
Paul McCarthy committed
126

Paul McCarthy's avatar
Paul McCarthy committed
127
128
To bring in the changes that other people have contributed to the main
repository into your local repository:
Paul McCarthy's avatar
Paul McCarthy committed
129
130


Paul McCarthy's avatar
Paul McCarthy committed
131
132
```
git fetch --all
Paul McCarthy's avatar
Paul McCarthy committed
133

Paul McCarthy's avatar
Paul McCarthy committed
134
135
136
# make sure you are on the correct local branch - if you followed the
# instructions above and are working on a fork of the main repository:
git checkout master
Paul McCarthy's avatar
Paul McCarthy committed
137

Paul McCarthy's avatar
Paul McCarthy committed
138
139
# Or if you are working on a branch within the main repository:
git checkout my_cool_branch
Paul McCarthy's avatar
Paul McCarthy committed
140

Paul McCarthy's avatar
Paul McCarthy committed
141
142
# Do this if you are working on a fork of the main repository
git merge upstream/master
Paul McCarthy's avatar
Paul McCarthy committed
143

Paul McCarthy's avatar
Paul McCarthy committed
144
145
146
# Or do this if you are working on a branch within the main repository
git merge origin/master
```
Paul McCarthy's avatar
Paul McCarthy committed
147

Paul McCarthy's avatar
Paul McCarthy committed
148
149
150
151
152
153
154
155
156
157
158
159

> Or, if you are comfortable with git, `rebase` is so much cooler:
>
> ```
> git fetch --all
>
> # replace <branch_name> with your local branch name
> git rebase <remote_name>/master
>
> # replace <remote_name> with the main repository name
> git rebase <remote_name>/master
> ```
Paul McCarthy's avatar
Paul McCarthy committed
160
161


162
You may also wish to install
163
[`notedown`](https://github.com/aaren/notedown):
Paul McCarthy's avatar
Paul McCarthy committed
164

Paul McCarthy's avatar
Paul McCarthy committed
165
```
166
source $FSLDIR/fslpython/bin/activate fslpython
Paul McCarthy's avatar
Paul McCarthy committed
167
168
pip install notedown
source deactivate
169
fslpython -m notedown
Paul McCarthy's avatar
Paul McCarthy committed
170
171
172
ln -s $FSLDIR/fslpython/envs/fslpython/bin/notedown $FSLDIR/bin/fslnotedown
```

173
174
175
176
177
`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
178
179
180


```
181
fslnotedown my_markdown_file.md > my_notebook.ipynb
Paul McCarthy's avatar
Paul McCarthy committed
182
```