-
Notifications
You must be signed in to change notification settings - Fork 0
NSB Programming Courses (in ALPHA)
Reproduced from https://automatetheboringstuff.com/2e/chapter0/
“You’ve just done in two hours what it takes the three of us two days to do.” My college roommate was working at a retail electronics store in the early 2000s. Occasionally, the store would receive a spreadsheet of thousands of product prices from other stores. A team of three employees would print the spreadsheet onto a thick stack of paper and split it among themselves. For each product price, they would look up their store’s price and note all the products that their competitors sold for less. It usually took a couple of days.
“You know, I could write a program to do that if you have the original file for the printouts,” my roommate told them, when he saw them sitting on the floor with papers scattered and stacked all around.
After a couple of hours, he had a short program that read a competitor’s price from a file, found the product in the store’s database, and noted whether the competitor was cheaper. He was still new to programming, so he spent most of his time looking up documentation in a programming book. The actual program took only a few seconds to run. My roommate and his co-workers took an extra-long lunch that day.
This is the power of computer programming. A computer is like a Swiss Army knife that you can configure for countless tasks. Many people spend hours clicking and typing to perform repetitive tasks, unaware that the machine they’re using could do their job in seconds if they gave it the right instructions.
Programmers Don’t Need to Know Much Maths
The most common anxiety I hear about learning to program is the notion that it requires a lot of math. Actually, most programming doesn’t require maths beyond basic arithmetic. In fact,** being good at programming isn’t that different from being good at solving Sudoku puzzles**. Just because Sudoku involves numbers doesn’t mean you have to be good at maths to figure out the solution. The same is true of programming. Like solving a Sudoku puzzle, writing programs involves breaking down a problem into individual, detailed steps. Similarly, when debugging programs (that is, finding and fixing errors), you’ll patiently observe what the program is doing and find the cause of the bugs. And like all skills, the more you program, the better you’ll become.
You Are Not Too Old to Learn Programming
The second most common anxiety I hear about learning to program is that people think they’re too old to learn it. I read many internet comments from folks who think it’s too late for them because they are already (gasp!) 23 years old. This is clearly not “too old” to learn to program: many people learn much later in life. It’s important to have a “growth mindset” about programming—in other words, understand that people develop programming skills through practice. They aren’t just born as programmers, and being unskilled at programming now is not an indication that you can never become an expert.
Programming Is a Creative Activity
Programming is a creative task, like painting, writing, knitting, or constructing LEGO castles. Like painting a blank canvas, making software has many constraints but endless possibilities. The difference between programming and other creative activities is that when programming, you have all the raw materials you need in your computer… A decade-old computer is more than powerful enough to write programs. Once your program is written, it can be copied perfectly an infinite number of times. A knit sweater can only be worn by one person at a time, but a useful program can easily be shared online with the entire world.la
- This document is supposed to be beginner friendly, but also self contained. Please let us know if things are not being explained well enough in this document! Or if you have any questions, or there is content you would like to see added.
- The document is in a few sections.
- This first section (here) contains a few introductory notes.
- The following pages have large tables of lists for the common tools that we use. These tables are introduction/dot points of the full breadth of information. It seems like a lot, but you will pick it up quickly with practice. The information presented is a combination of (i) clear and efficient tutorials on the web; and (ii) tutorials developed within the lab. They are listed approximately in order of what to learn: first, interacting with MASSIVE; then, choosing a particular language; then, furthering your analytic techniques.
- The end of the document contains separate sections that expound on the content covered in the tables. Generally, these sections will be content written by and for the lab.
We recommend starting with the excellent Computer Science course developed by folks over at Crash Course. Episode #12 starts with a basic introduction to introductory programming ideas, including variables, statements, and loops. [We also recommend the rest of the course for learning the fundamentals of computer science more broadly].
What happens when your code goes wrong? There are various ways to fix code. You could…
- Talk to a senior: science is collaborative. Do not be afraid to ask for help.
- Rubber Duck Debugging: “the name is a reference to a story in the book _The Pragmatic Programmer _in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line by line, to the duck.” This is a very useful technique - and may be helpful in the process of annotating your code for future code checkers.
- Google and StackOverflow: godsends to programmers of all ages around the world.
-
(NEW) Use ChatGPT to help: but users beware - ChatGPT will sometimes give code alternatives that will not work. At the end of the day, it’s best to know what the code is doing: if things go wrong, you can more effectively debug scripts, reproduce results and justify your analyses.
- Sometimes you can tell it that it’s first answer is wrong, and it will spontaneously correct itself 🙃
- 0.0 NSB Programming Courses (in ALPHA)
- 1.0 Working on the Cluster
- 2.0 Programming Languages
- 2.1 Python
- 2.1.1 Getting Set Up
- 2.1.2 Coding in Python
- 2.1.3 Applications of Python in Neuroimaging
- 2.2 MATLAB
- 2.3 R and RStudio
- 2.4 Programming Intro Exercises
- 2.5 git and GitHub
- 2.6 SLURM and Job Submission
- 2.1 Python
- 3.0 Neuroimaging Tools and Packages
- 3.1 BIDS
- 3.2 FreeSurfer
- 3.3 FSL
- 3.4 Connectome Workbench/wb_command
- 3.5 fMRIPrep
- 3.6 QSIPrep
- 3.7 MICApipe
- 3.8 MRIQC
- 4.0 Specialist Tools