Python is our programming language of choice due to its large open-source community and resources. Python, along with MATLab and R are the common languages to perform neuroimaging analysis. Python is a versatile language; many individuals have contributed to developing additional packages that run on top of Python to allow for more specific use cases. Below in Figure 1. we can see some examples of Python packages that are part of the Python environment. For instance, Numpy is a software package for high-level mathematical programming with arrays and matrices, Matplotlib is a visualization software, and Scikit-learn implements machine learning.
Figure 1. Python Landscape
(from https://pydsc.wordpress.com/wp-content/uploads/2017/11/pythonenvironment.png?w=663)
Python will be used with the Anaconda environment and Jupyter Notebooks on our local machines for neuroimaging analysis. For the first exercises, we will use Google Colab. Google Colab is an online accessible workspace to run Python code, it offers a good amount of storage and RAM to perform our scripts. It provides great computational power, all on the cloud without running on your local machine. Download the .ipynb files, upload to your Google Drive and then open in colab. A great introductory Python course with the Jupyter environment can be found here https://jckantor.github.io/CBE30338/01.01-Getting-Started-with-Python-and-Jupyter-Notebooks.html
- https://colab.research.google.com/github/jckantor/CBE30338/blob/master/docs/01.01-Getting-Started-with-Python-and-Jupyter-Notebooks.ipynb
- https://colab.research.google.com/github/jckantor/CBE30338/blob/master/docs/01.02-Python-Basics.ipynb#scrollTo=AqQVaKYkP5j3
- The top banner has links to further tutorials
- Another good tutorial can be found https://colab.research.google.com/github/data-psl/lectures2020/blob/master/notebooks/01_python_basics.ipynb
- https://www.learnpython.org/ is a great resource with the fundamentals clearly laid out. Please complete the “Learn the Basics” list of lessons.
https://www.codecademy.com/catalog/language/python
https://cs50.harvard.edu/python/2022/
https://www.khanacademy.org/computing/computer-science
https://docs.python.org/2/tutorial/
https://www.greenteapress.com/thinkpython/html/index.html
- The best course I have found is https://www.udemy.com/course/learn-python-programming-from-a-z/ Which is available on Udemy, if you have an account. Check if your institution provides a license.
- Data types
- Arrays and Matrices
- Conditional Statements: If
- Boolean Algebra
- Loops: For, While, and Do While
- Methods: def
- Classes:
There is a wealth of information and resources geared for beginners to quickly develop skills in programming. They are there, I promise.
TIP: if you ever get an error, copy and paste the error into google, I (almost) guarantee someone else has had the same problem and someone else has solved it. Stack exchange is a lifesaver.