--- tags: swd1a --- # 2023-12 <br> SWD1a: Introduction to Python **NB**: ask for help! https://bit.ly/arc-help If you have any questions on any aspect of the course, just ping us a message in the course chat, or send one of us a Teams message, or stick a request in the linked form above! Welcome to the hack pad for SWD1a course from Research Computing at the University of Leeds! You can edit this document using [Markdown syntax](https://guides.github.com/features/mastering-markdown/). **First of all** please check if you have a Google account in order to use [Google Colab](https://colab.google/); set up a Google account if you don't. ## Contents 1. [Links to resource](#Links-to-resources) 2. [Agenda](#Agenda) 3. [What's your name and where do you come from?](#What’s-your-name-and-where-do-you-come-from) 4. [Further reading](#Further-reading) 5. [Extra code snippets](#Misc-code-snippets) ## Links to resources - **Contact Research Computing** - https://bit.ly/arc-help - **Workshop Slides** - https://swcarpentry.github.io/python-novice-inflammation/ - **Research Computing website** - https://arc.leeds.ac.uk/ - **Google Colab** - https://colab.google/ - **Notebooks** - https://github.com/ARCTraining/swd1a-class-material/tree/main/2023-12 ## Agenda ### Agenda Day 1 | Time | Agenda | | ---- | ------------------------------------------ | | 1000 | Intro, using Google Colab, What is Python? | | 1050 | Break | | 1100 | Python Fundamentals | | 1130 | Storing Multiple Values in Lists | | 1230 | Lunch | | 1330 | Analyzing Patient Data | | 1430 | Break | | 1445 | Visualizing Tabular Data | | 1545 | Questions | | 1600 | Close | ### Agenda Day 2 | Time | Agenda | | ---- | ---------------------------------- | | 1000 | Repeating Actions with Loops | | 1050 | Break | | 1100 | Analyzing Data from Multiple Files | | 1200 | Lunch | | 1300 | Making Choices | | 1400 | Creating Functions | | 1450 | Break | | 1500 | Errors and Exceptions | | 1545 | Questions | | 1600 | Close | ## What's your name and where do you come from? - Narinder Gahir,Research Technician work at St James university. Pathology department. My aim of this course is to learn coding and work as a Data scientist. TT - [Patricia Ternes](https://patricia-ternes.github.io/) - Research Software Engineer and member of the [IT Services Research Computing Team](https://arc.leeds.ac.uk/about/team/). **Course Instructor**. :flag-br: - Ollie Clark, Research Software Engineer and member of the [IT Services Research Computing Team](https://arc.leeds.ac.uk/about/team/). **Course Instructor**. - [Maeve Murphy Quinlan](https://murphyqm.github.io/), one of the Research Software Engineers on the [Research Computing Team](https://arc.leeds.ac.uk/about/team/). I love applying Python to solve problems in planetary science, from modelling the thermal evolution of planets, to analysing electron microscopy output from the analysis of 4.6 billion year old meteorites. :sparkles: I came to Python *via* research, so I love helping researchers figure out how to use Python in their work! **Course instructor.** :four_leaf_clover: - Veronica Gonzalez - PhD student in Management - Daisy Akgonullu - PhD student in Food Science. I would like to learn how to use coding to optimise my data analysis to save time and fit data - Beth Webb - Post-Doctoral Researcher in FMH researching platelets in the context of cardiovascular disease. I'm in the process of learning R and Python to improve my analysis of clinical datasets. - Reham Gonnah - Postgraduate Researcher at the School of Dentistry. I would like to learn how to code to better analyse my research data. - Jennifer McLauchlan - PhD student in Food Science - part of my project involves molecular dynamics simulations, so I would like to learn some coding skills. - Sufyan Dalal - PhD Student in the school of Mechanical Engineering (Institute of Medical and Biological Engineering) - James Cannon - Postgraduate Researcher in Music Psychology - Sarah Bostan - Postdoc - Can Cheng - Postgraduate Researcher in Risky Kitchen behaviours in the UK. - Charlotte Wyatt- PhD student in Chemistry - Mingxin Wang - PhD Student in Food Science - Lazar Novakovic - Postdoc in plant science - Ivo Andika Hasugian - PhD Student in School of Mechanical Engineering, planning to create agent-based modelling in python and hybrid simulation. - Imogen Ridley - PhD student School of Civil Engineering, studying reinforced concrete and its cracking behaviour - Sinead - Research Assistant (LITE - Education Research) - Patricia Hoyos - MSc student of Precision Medicine: Genomic Data Sciences from Mexico. - Tanya Seth - PhD student at School of Mechanical Engineering, iMBE - Filip Jinga - PGR in the School of Chemistry, wanting to use python for drug discovery. - Sina Najjari_ PhD student at School of Mechanical Engineering. - Siddeequah Azmi - International Networks and Projects Officer in the Global Research Developmet Team (Researcg and Innovation Services, University of Leeds) - Steven Teasdale ---> Electronics Research Technician - Electronics Workshop Physics ---> School of Mechnical Engineering love learning, coding and using Python ## Misc code snippets ### Some example Colab Notebooks: - [Analysing multiple datasets](https://colab.research.google.com/drive/15wmMjkHXfwzHApf2LcvhDUNNbrJ6MpXz?usp=sharing) - [Creating functions](https://colab.research.google.com/drive/1BF5_2ia8kloG5KYfGmmLO9Wl3r_mTKAm?usp=sharing) - All notebooks here: [GitHub](https://github.com/ARCTraining/swd1a-python-2023) ### Download data ```python= # Download 2 files and store in the swc-python folder !wget -P swc-python https://swcarpentry.github.io/python-novice-inflammation/data/python-novice-inflammation-data.zip !wget -P swc-python https://swcarpentry.github.io/python-novice-inflammation/files/code/python-novice-inflammation-code.zip ``` ### Unzip Files ```python= # Extract .zip files inside the folder swc-python/ !unzip /content/swc-python/python-novice-inflammation-code.zip -d /content/swc-python/ !unzip /content/swc-python/python-novice-inflammation-data.zip -d /content/swc-python/ ``` As we are using colab, an alternative is to move the data onto Google Drive and mount the drive: ```python= import numpy from google.colab import drive drive.mount("/content/gdrive") # Load the data (Modify the path to include the drive directory into which you have moved things for this course - i.e. change "..." to "Work/Training") data = numpy.loadtxt(fname='/content/gdrive/My Drive/.../swc-python/data/inflammation-01.csv', delimiter=',') print(data) ``` ## Further reading - How to mount your GoogleDrive to your GoogleColab session: [Google Documentation](https://colab.research.google.com/notebooks/io.ipynb) ### Some Free textbooks: - Full **FREE** datascience with Python textbook with code snippets - https://jakevdp.github.io/PythonDataScienceHandbook/ - Full **FREE** computational numerical Modelling in Python book - https://greenteapress.com/ModSimPy/ModSimPy.pdf - [Recommended Python book - crash course (free)](https://ehmatthes.github.io/pcc/) - RealPython.com - useful website