Rhys Taylor's home page
Science, Art and Data Visualisation

Online scripts

Not so long ago I discovered the wonderful Streamlit, which lets you run Python code directly on a web page. There are some simple astronomical tasks I do so often it's just helpful to be able to call up a web page, enter the values and have the answer pop out. So far these are all very simple tasks (except one) that could easily be done on a calculator, but this just saves a bit of time. The exception is the source visibility calculator. I'm not a fan of any of the other tools available online to do this. They're either annoying to learn, have an ugly interface, or don't give sufficiently precise results. So I wrote my own, and now I'm happy.

EDIT : I recently found this one, however, which I like very much.


WARNING : There seems to be a major bug in the compatibilities of numpy and astropy, which is causing havoc when trying to load some of the apps. Streamlit also appears to have weird server issues, which is making everything difficult to test. In particular, the source visibility app requires earlier versions of numpy and astropy than the defaults otherwise it fails horribly. For the moment I don't have a good solution to this, other than to continuously recompile each app using the appropriate versions. Hopefully numpy will be fixed for better backwards-compatibility. If not, I'll probably have to move each one to its own repository with individually-adjusted module versions, which is something I'd like to avoid.



Total HI mass calculator


A simple project to learn the basics. You give it the total flux and distance to the source, specify the units, and it spits out the total HI mass. Optionally can also calculate the integrated S/N, which is more useful since this is a more complex parameter.



Tophat HI mass calculator


Another simple calculator to examine how changing the parameters of a source changes its total HI mass, i.e. you know the line width, noise level and S/N but not the total flux (for some reason, presumably because you're an idiot or something).  Assumes a flat profile of the spectrum. Also lets you calculate the integrated S/N.



Column density calculator


A slightly more sophisticated calculator. Given the parameters of an HI source and the telescope, calculates the column density. It can also simply convert between units, but exploring the telescope parameter is more interesting – this is quite a nice way to explore how sensitivity changes. It isn't as straightforward as lower rms = better, because lower rms often comes at the expense of a larger beam size.



Travel time calculator


Super simple. Just lets you calculate speed, travel time or velocity using astronomer-friendly units.



HI deficiency calculator


A little bit more advanced. Here you can calculate how much gas your galaxy has lost, given its observed HI mass, optical diameter and morphological type, for a variety of calibration parameters. Also provides some useful reference information.



I can see my source from here !


Suppose you need to observe some source from some random location at some random date. This lets you find out what time your source will rise, when it's close to the horizon, and when it's close to the Sun, colour-coding the output data so you can see at a glance when it's good to observe. Comes with a source name resolver so you don't have to input the coordinates, as well as a pre-set list of observatory locations (or you can enter latitude and longitude). Prints out directly to the screen but also lets you download a higher-precision text file.



Whose Spectral Line Is It Anyway ?


Something that's a very occasional irritation : the need to calculate the exact frequency of a spectral line when planning new observations. It isn't a difficult calculation but there are enough stages that it's easy to slip up, especially as different observatories still use different conventions. For example the radio community developed a different velocity convention from the optical astronomers, neither of which is really correct, but both of which are actually used ! So this GUI-based calculator relieves all of that. You provide the rest wavelength or frequency (in cm or m, or Hz, kHz, MHz, GHz, or THz) and it will output the frequency, wavelength, redshift, and optical/radio/relativistic velocities at whatever parameter you specify.



Angular Size Converter


A very simple tool to convert angular to physical size (or vice-versa) at a given distance, specifying each in astronomy-friendly units. Assumes simple Euclidean geometry and does no fancy cosmological corrections at all. Should be fine at low redshifts. I leave an examination of where this breaks down for a future upgrade (there are of course already umpteen cosmological calculators out there)



Dynamical Mass


Another simple tool, this time to calculate the dynamical mass of a galaxy. Or more generally, if you supply two out of the three parameters of size, mass, and rotation speed, it will calculate the missing variable for you. Allows conversion between different units (SI and standard astronomical conventions like kpc) but doesn't account for relativistic effects – designed for galaxies, where these can be safely neglected.



Photometry Calculator


Converting the observed photometric data of photon counts, or apparent magnitude, into a physical stellar mass estimate of a galaxy is a straightforward but tedious process. There are various prescriptions you can use for a wide variety of observable wavebands and colours, and the calculations are mathematically simple. But you also need to correct for internal and Galactic extinction, and because you need to do all this in at least two wavebands, it can become all too easy to make a mistake. This app lets you enter photon counts or apparent magnitudes in the standard SDSS ugriz filters. Give it an inclination angle, distance, and sky coordinates, and it will handle all the rest for you, popping out a series of stellar mass estimates according to a bunch of different recipes.