Potentially Useful Astronomy FORTRAN Codes

Eric Mamajek (UR)

Last updated: 11 November 2011

Summary

Here are some pieces of FORTRAN code which may or may not be useful. Like most astronomers, I have written (at least) hundreds of programs over the years. My default language is FORTRAN since that was what I was taught as an undergrad, and it has been flexible enough to do most of what I needed to do (although I also do plenty of script writing using awk, perl, etc., and use other packages for image processing). Most of my programs are rather inelegant, and not meant for prime time. A few are similarly inelegant, but have been useful enough for multiple projects that I've shared them with my students (and I've cleaned them up since I know someone else will be looking them over). I'll post new ones from time to time.

I've used these codes many times, so any bugs should have been worked out ages ago. If you find a bug, please tell me. Otherwise, caveat emptor.

On most Unix-based systems, one can compile the codes by simply typing:
> f77 -o code code.f
> ./code


Code

  • cahk.f: converts popular stellar and rotation activity indicators into stellar ages for solar-type stars using empirical calibrations. The most useful diagnostics included are log(Lx/Lbol) [in ROSAT PSPC band], ROSAT PSPC counts/sec (0.2-2.4 keV), rotation period, Mt. Wilson S-value, and logR'HK. This code includes the stellar rotation-activity-age correlations for F8-K2 dwarfs listed in Mamajek & Hillenbrand (2008) (please cite this paper if you use the code). [posted 11/11/2011 - major update]

  • imf.f: Monte Carlo simulates samples of stars (by mass) using the Kroupa (2001) initial mass function. One can either produce a given number of stars, or produce stars up to some total mass. It also bins the outputed fake stars by spectral type (assuming the stars are main sequence). [posted 6/9/2010]

  • sep.f: Binary star separation and position angle (rigorous calculation using law of cosines for spherical triangles). Input is RA and Dec for two stars in degrees. [posted 8/10/2014]