Welcome to qsonic’s documentation!
QSOnic
Lightining-fast continuum fitting
QSOnic is an MPI-parallelized, highly optimized quasar continuum fitting package for DESI built on the same algorithm as picca, but faster. It also provides an efficient API to read DESI quasar spectra. If you use this software, please cite the article in the Journal of Open Source Software (JOSS).
The key differences
You can use any desired input continuum from another continuum prediction method as input continuum model.
Coadding of spectrograph arms can be performed after continuum fitting or disabled entirely.
Continuum is multiplied by a fiducial mean flux when provided.
You can pass fiducial var_lss (column VAR_LSS) and mean flux (column MEANFLUX) for observed wavelength LAMBDA in STATS extention of a FITS file. Wavelength should be linearly and equally spaced. This is the same format as rawio output from picca, except VAR column in picca is the variance on flux not deltas. We break away from that convention by explicitly requiring variance on deltas in a new column.
If no fiducial is passed, we fit only for var_lss (no eta fitting by default). Eta fitting can be enabled by passing
--var-fit-eta. A covariance matrix is calculated based on delete-one Jackknife over subsamples between var_pipe and var_obs data points, and used in var_lss, eta fitting if--var-use-covpassed (soft recommendation to always enable this).Internal weights for continuum fitting and coadding are based on smoothed
IVAR, and outputWEIGHTis based on this smoothed ivar. This smoothing can be turned off.Chi2 information as well as best fits are saved in continuum_chi2_catalog.fits. Chi2 is calculated using smooth ivar and var_lss, and does not subtract sum of ln(weights).
Similarities
Delta files are the same.
CONTcolumn is mean flux times continuum even when fiducial mean flux is passed.MEANSNRin header file and chi2 catalog is average of flux times square root of positive ivar values. Header values are per arm, but catalog values are the average over all arms.Eta fitting does not rescale
IVARoutput. Pipeline noise will be modified with explicit calibration option.
Programs
qsonic-fit is the main continuum fitting script. It requires MPI. Each MPI task is responsible for independent sky regions based on HEALPix. Reading and fitting the continuum are done in parallel. After all quasars are fit with a continuum, all MPI tasks syncronize to calculate the mean continuum and check for convergence. See here or execute
qsonic-fit --helpfor help.qsonic-calib calculates stacked flux, var_lss and eta terms for a given set of deltas. This script does not perform continuum fitting, and so, it enables fast calculations for data SNR splits, parameter variations in wavelength and variance binning. Also requires MPI. See here or execute
qsonic-calib --helpfor help.qsonic-coadd is a helper program to coadd delta files by
TARGETIDand regroup them by HEALPix. It usesmultiprocessingto read delta files in parallel and does not require MPI. See here or executeqsonic-coadd --helpfor help.
Note: Some platforms require these help commands to begin with mpirun -np 1 or srun -n 1.
Source
See API Reference for details.
calibration.py containes noise and flux calibration classes. Can be imported without MPI. The output file of the continuum fitting
attibutes.fitscan be used as an input for these calibrations. As an additional feature, large-scale variance termvar_lsscan be applied as an additive correction in noise calibration by passing--varlss-as-additive-noise.catalog.py provides function to read catalog and broadcast from master pe. Needs following columns:
TARGETID, Z, TARGET_RA, RA, TARGET_DEC, DEC, SURVEY, HPXPIXEL, VMIN_CIV_450, VMAX_CIV_450, VMIN_CIV_2000, VMAX_CIV_2000.io.py module contains functions to read spectra and save deltas. Can be imported without MPI.
masks.py provides maskers for sky, BAL and DLA. Can be imported without MPI. Sky mask is a simple text file, where colums are type (unused), wave_min mininum wavelength, wave_max maximum wavelength, frame rest-frame (RF) or observed (OBS). BAL mask assumes related
VMIN_CIV_450, VMAX_CIV_450, VMIN_CIV_2000, VMAX_CIV_2000values are already present in catalog. DLA masking takes both Lya and Lyb profiles into account, masksF<0.8and corrects for the wings.mathtools.py hosts some functions and classes that are purely numerical. Can be imported without MPI.
mpi_utils.py hosts MPI related functions such as logging. Can be imported without MPI.
picca_continuum.py fits each quasar continuum and calculates global statistics. Needs MPI.
spectrum.py has
Spectrumclass that stores each quasar spectrum. Can be imported without MPI.continuum_model has the supported continuum models including fitting in the forest region as
PiccaContinuumModel, and input continuum from another method asInputContinuumModel.