Scientific Programming IRL¶
Welcome to the Scientific Programming In Real Life textbook!
This book explains practical programming concepts for scientists in a hurry.
Getting started with SPIRL¶
This textbook can be used in a few ways:
as a top-to-bottom interactive crash course in scientific programming (start here)
as a reference for when you can’t remember how to do that one thing (trying searching in the left pane)
to make your own programming course (let me try to convince you to contribute to this one instead!)
Why another learn-to-code resource?¶
There are many free learn-to-code resources which are great but require 40+ hours to complete. On the other hand, quickly copy and pasting impenetrable code from StackOverflow can lead to confusion and the feeling that coding is some sort of arcane art.
This book was crafted by scientists, for scientists with 2 main philosophies:
scientists are busy
scientists like to understand how things work
These two philosophies help make this book as concise as it can be while giving just enough depth to understand why these concepts here are important and how they work.
It is also meant to be a resource that is easy to follow start-to-finish, but also quick to refer back to in a pinch.
An interactive textbook¶
SPIRL is powered by JupyterBook, a fantastic project which makes responsive online textbooks like this one, while allowing readers to execute code without leaving the site!
Don’t believe me? Try cliking the rocket icon at the top and choosing the Live Code option. This is still an experimental feature so sometimes the kernel is slow to start… But now you should be able to run the cell below!
print("Hello World!")
Each tutorial in this book is intended to be hands-on. Learning scientific programming is like learning a language: you need to practice in order to become fluent! When you see code cells like these throughout the SPIRL text, try editing and running them to see what happens!
import random
def lucky(n):
return '-'.join([str(random.randint(1, 49)) for i in range(N)])
N = 8 # change me!
print('Your lucky numbers for today are:')
print(lucky(N))
Issues¶
Did you find a glaring typo? Is one of the links broken? Is the whole textbook broken?? It would be super helpful if you could report bugs, typos, or glitches over at the GitHub issues page here. Thanks for helping make this textbook even more useful!
Contributing¶
This book is a work in progress! Have ideas for new tutorials? Want to apply your copy-editing skills? Check out the contributing guide on GitHub here. This textbook wouldn’t be possible without help from its contributors!
Supporting SPIRL¶
SPIRL will always be free and open source. If you’d like to support it, consider sharing SPIRL with friends or peers who you think would find it useful. If you can spare the time, you can support this project by contributing (see above). If you use any of the code or concepts in an article / lesson / publication (please feel free to!), you can cite SPIRL here. If you’d like to support SPIRL by buying me a coffee, you can also do that here.