Skip to content

DominikaDu/QSmooth

Repository files navigation

QSmooth

QSmooth is a smoothing algorithm for quasar spectra developed by Dominika Ďurovčíková and implemented in Ďurovčíková et al. 2020.

Please include the following citation if you use this code:

D. Ďurovčíková, H. Katz, S. E. I. Bosman, F. B. Davies, J. Devriendt, and A. Slyz, Monthly Notices of the Royal Astronomical Society 493, 4256 (2020).

Requirements:

Please find the list of all required Python packages in the "requirements.txt" file. In addition, a working Latex installation is required for the plotting.

This code has been developed using Python 2.7. It has also been tested on Python 3.7.

Description:

QSmooth first computes a running median with a bin size of 50 data points to capture the main continuum and emission features in the spectrum. It then performs a peak-finding procedure using the SciPy Python library (Jones et al. 2001) above the aforementioned running median border (a) and interpolates the peaks to construct an upper envelope of the spectrum (b). This envelope is then subtracted from the spectrum. QSmooth then applies the RANSAC regressor algorithm (Fischler & Bolles 1981) from the Scikit-Learn Python package (Pedregosa et al. 2012) on the residuals, thus rejecting most absorption features in the spectrum (c). The data points that are flagged as inliers by RANSAC are interpolated and smoothed by computing a running median with a bin size of 20 (and an reduced bin size around the Lya peak), thus creating the final smooth flux fit of the spectrum (d).

Here is a visualisation of the procedure:

Smoothing procedure

For SDSS quasars from a spec-PLATE-MJD-FIBER.fits file, we also provide a routine to mask out all sky lines listed in Table 30 of Stoughton et al. (2002) as well as all pixels that were flagged as highly uncertain by the SDSS pipelines.

For a detailed account of the smoothing procedure, please refer to Appendix B in Ďurovčíková et al. 2020.

Example usage

Please refer to "example.py" for an example usage of the algorithm.

To smooth and plot an example spectrum from an SDSS spec-PLATE-MJD-FIBER.fits file, run:

<python example.py>

to produce an output image like the following:

Example output spectrum

Contact

Please contact Dominika Ďurovčíková at dominika.durovcikova@gmail.com in case of questions/issues.

About

Smoothing algorithm for quasar spectra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages