====== Python on a lab bench ====== [[https://github.com/btel/aspp_munich_2015|Github repository]] with code, slides and data ===== Lecture ===== [[http://btel.github.io/aspp_munich_2015|Slides]] [[https://github.com/btel/aspp_munich_2015/blob/master/docs/lecture_notes.md|Lecture notes]] ===== Exercises ===== === Data exploration === * clone repository to your home directory git clone yourusername@python.g-node.org:/home/bartosz/lab_bench * copy data to ''data'' subdir: cp ~/lab-bench-data/* ~/lab_bench/data * set path for extra libaries: echo "export PYTHONPATH=/home/student/lab_bench/libs" >> ~/.bashrc source ~/.bashrc * create a new branch (use unique names for your team): cd lab_bench git checkout -b MYTEAM_pairwise_correlations * in the script we worked on during the lecture, calculate all pairwise correlations between all neurons (use nested for loops and plot the histogram) * commit and push your branch back to ''origin'' (replace MYTEAM with ...): git push origin --set-upstream MYTEAM_pairwise_correlations === Workflow === * update your master branch git checkout master git pull * create a new branch: git checkout -b MYTEAM_first_workflow * add new command line argument (''-​-bin-size'' of type ''float'' and default value of 10) and pass it to ''calc_corr_coef'' function. * write script ''plot_correlations_histogram.py'' which reads correlation files (given in the first command line argument), plots a histogram and saves it in a file given by ''-​-save-fig'' argument (use ''plt.savefig'') . * Test the script on files generated with ''open_data.py'' script. * Don't forget to add ''plot_correlations_histogram.py'' to you repository git add plot_correlations_histogram.py * commit and push your branch back to ''origin'': git push origin MYTEAM_first_workflow === Automation/batch processing === * update your master branch git checkout master git pull * create a new branch: git checkout -b MYTEAM_automation * add ''task_merge_correlations.py'' to ''dodo.py'' (located in ''workflows'' directory), which merges correlations from all files generated by ''task_open_data'' (dependencies) and saves them in new npz file (target). * update ''task_plot_correlations_histogram'' to plot histogram of merged correlations * run doit -- change to workflows directory and run ''doit'' * try what happens when a single file from ''results'' is deleted. * commit and push your branch back to ''origin'': git push origin MYTEAM_automation === .bashrc === In case you accidentally overwrote your ''.bashrc'', here is a copy: {{:bashrc.txt|}}. Download it, move it to your home directory and rename it to ''.bashrc''