Neural Data Science in Python#

Welcome! This online textbook is aimed primarily at students and researchers in neuroscience and cognitive psychology who want to learn how to work with and make sense of data using Python. It is also accessible for students with a computer science background who want to learn how to apply their skills to neuroscience. The textbook assumes no prior knowledge of Python, or any other programming language. If you do have prior knowledge of Python and want to learn how to apply it to neuroscience, you can skip the first few chapters and start with Chapter 4.

This book will teach you the fundamentals of Python, and how to use the GitHub Copilot AI assistant to help you learn to code, and write code for you. From there, we learn additional Python in the context of using it for data science, including data visualization, and working with different types of neuroscience data, including single unit recordings, EEG, and fMRI.

This book was written to support the course NESC 3505 Neural Data Science, at Dalhousie University. Development of the textbook is in progress, with irregular but ongoing updates being posted. It is released as an open educational resource, under a license that allows free re-use and re-mixing, except for commercial purposes.

Written by Prof. Aaron J. Newman, Department of Psychology & Neuroscience, Dalhousie University, with contributions from students in his lab, including Laura Elliott, Danny Godfrey,, Brynn Harris-Shanks, Reann Post, and Saisha Rankaduwa as well as other generous folks from around the world (see the book’s GitHub page for a complete list). Some of the text and code was generated using the GitHub Copilot AI assistant. We welcome additional contributions from the community; once you are familiar with GitHub (from working through the early part of this book) you can create Issues and Pull Requests to help us correct typos, other errors, and also to suggest things you’d like to see in the book, or requests for clarification of things you don’t understand.

Downloading the Materials to Work Through the Book#

You can learn about neural data science in Python by simply reading the book, but you probably won’t become a proficient coder, or practitioner of data science, unless you work through the book’s Jupyter notebooks, which let you write and run code. To do this, you will need to download the materials for each chapter from our GitHub repository. The third chapter explains how to set up your computer for this course, and will walk you through downloading the materials as well as all the software you need to install to work through the book. All of these tools are free and open source, with the possible exception of the GitHub Copilot AI assistant, if you are not a student or otherwise affiliated with an academic institution.

Video Tutorials#

This textbook has an accompanying playlist on YouTube, with video tutorials that walk you through the material in the book. The recommended way to work through the book is to read the text in the sequence it’s written, and at the same time work through the Jupyter notebooks (which let you write and run code) that you can download from our GitHub repository (getting all this set up is explained in the first part of the book). If you like video, you can play the video and at the same time work through the notebooks, writing and running the code yourself. The notebooks are pretty self-explanatory without the videos though, so it’s a matter of personal preference. The videos are also useful if you want to review a topic, or reinforce it after you’ve read the text and/or worked through the notebooks.

We Love Feedback!#

If you notice any errors, or have suggestions or other feedback, please click on the Octocat icon in the top right of the page in question, and select “open issue”. This will allow you to submit a bug report or feature request. You can also submit a pull request if you want to contribute to the book directly. You will need a GitHub account to do this; setting one up is covered in the chapter, Setting up Your Computer for Data Science.