Colin Leach, 2018-19
There were two distinct objectives in creating these notebooks.
-
I have an interest in astrophysics and am trying to learn more about it. Writing some interactive notes at the undergraduate demo level is useful practice. Obviously, this is NOT research-grade code; not even close.
-
Jupyter notebooks, Matplotlib and many other relevant packages have been under active development in recent years, adding interesting new capabilities. Inevitably, the documentation occasionally falls a little behind the pace. I have been trying to work out what can be done with the newer features (part education, part playing).
To run these notebooks you will need Python 3 (preferably 3.6 or later - I really like f-strings), NumPy, AstroPy and a recent (at least v 2.1) version of Matplotlib. These come standard with a default Anaconda 3 installation.
Individual notebooks may need other packages (bokeh, astroml, astroquery, etc) and this will be noted. They should all be available via conda.
The interactive widgets need to be initialized each time the notebook is opened, so it is highly recommended to start with Cell-Run All in nearly all cases. Animations are the main exception as these can (deliberately) include infinite loops.
To run the notebooks remotely on MyBinder use the link below. Not everything works in this environment, so cloning the repo to your local machine may be better if you are comfortable installing Python packages.
Astrophysics:
- radiation/1 - photons.ipynb: the electromagnetic spectrum, wavelength-frequency-energy conversion
- radiation/2 - blackbody.ipynb: basics of blackbody radiation
- gravity/1 - NewtonianOrbit.ipynb: Kepler and the gravitational 1-body problem
- gravity/2 - StellarBinary.ipynb: the gravitational 2-body problem and binary stars
- gravity/3 - LagrangePoints.ipynb: the restricted 3-body problem, effective potential and Roche lobes
- gravity/4 - SpiralGalaxies.ipynb: spiral galaxies (still very incomplete)
- gravity/5 - PlanetaryAtmospheres.ipynb: a complex topic, so this file may later be split as it grows
- gravity/6 - SolarSystemResonances.ipynb: asteroids, planets, and how they affect each other
- gravity/7 - RadialVelocity.ipynb: simulation exoplanet RV curves
- relativity/* - a series of notebooks on SR and GR (in progress). See relativity/README.mkd for more details.
- rebound/* - various N-body simulations with the REBOUND package. This will only work on Linux and Mac, not Windows, so I have kept it separate from the other gravity notebooks. See rebound/README.mkd for more details.
Finding, manipulating, displaying data:
- data/DataSources.ipynb - needs
astropy.coordinates
and a web connection;astroquery
is also useful and may need to be installed separately - data/DataStructures.ipynb - overview of the many ways to structure, retrieve and manipulate data, from Python lists up to multi-petabyte databases
- data/Coordinates.ipynb - specifying positions on the sky
- data/SphericalProjections.ipynb - Mollweide, etc - benefits from
astroML
andhealpy
, though the first part will run without these packages - data/files_FITS.ipynb - the main file format for astronomical data
- data/files_HDF5.ipynb - for big, hierarchical data
Various mathematical techniques and functions: what they are, (briefly) why they're relevant, how to use them in Python:
- math/TaylorExpansions.ipynb
- math/Fourier.ipynb
- math/Bessel.ipynb
- math/Hermite.ipynb
- math/Legendre.ipynb
- math/SphericalHarmonics.ipynb
- math/Gamma.ipynb
- math/Zeta.ipynb
Folders on plotting, animation and code performance have now been moved to the tinkerings repo
However you choose, obviously. It may be worth remembering the motto that The Royal Society adopted in 1663: Nullius in verba, take nobody's word for it. Scientists are naturally skeptical people and will (probably correctly) assume that there are errors, programming inefficiencies and unclear explanations. You can produce something better, so go ahead and do it.
See the separate refs.mkd
file, plus some individual notebooks for more specialist sources.