BADASS Code

BADASS_logo

No, the name isn’t supposed to be serious, astronomers are just notorious for bad acronyms.  But I am serious about fitting spectral data, so I wrote a fitting code that is uncompromising when it comes to details.

BADASS is an open source spectral decomposition software currently in development and implemented in Python 2 (but fully compatible with Python 3 as well).  It was intended for fitting SDSS quasar spectra, however, it can fit any type of galactic spectra with both emission lines and stellar absorption features.  Some notable features are:

  • Written in Python, for ease of use and modification (and you don’t have to pay for it!)
  • Fitting performed with Markov chain Monte Carlo for robust uncertainties using the affine-invariant MCMC sampler emcee.
  • Can detect blueshifted-wing “outflows” in emission lines.
  • Uses FeII templates to remove broad and narrow FeII contamination.
  • Can optionally fit the line-of-sight stellar velocity distribution of a galaxy using Michele Cappellari’s penalized pixel-fitting (pPXF; NASA/ADS).
  • Uses autocorrelation analysis to automatically assess sampler chain convergence, or you can set it to run for a fixed number of iterations.
  • Can be modified to fit other types of spectra other than SDSS (such as Keck/LRIS spectra as done here)
  • Still under testing and development (use at your own risk) but the code can be obtained via my GitHub page.  Feel free to contact me via email if you have any questions or if you have used this code in your research.
Screen Shot 2019-08-14 at 3.08.38 PM

Sample output from BADASS with all fitted components shown.  This particular fit contained 43 free parameters.

Screen Shot 2019-08-14 at 3.09.12 PM

Example output of a parameter’s chain, burn-in, histogram, and best fit values and uncertainties.

Disclaimer: “Why Python? Python is so slow.”  It’s time for astronomers to let go of proprietary software that costs hundreds of dollars.  Python is the fastest-growing programming language in the world, and is quickly becoming the choice programming language for data analysis in the industry.  Also, I am proficient in Python by survival – and admittedly – am no Python-guru.  If you find a way to improve my code in any way please contact me!