read_spectrum¶
- msaexp.spectrum.read_spectrum(inp, spectrum_extension='SPEC1D', sys_err=0.02, err_mask=(5, 0.5), err_median_filter=[11, 0.2], **kwargs)[source]¶
Read a spectrum and apply flux and/or uncertainty scaling
Flux scaling
corris applied if there arePOLY[i]keywords in the spectrum metadata, with>>> coeffs = [header[f'POLY{i}'] for i in range(order+1)] >>> corr = np.polyval(coeffs, np.log(spec['wave']*1.e4))
- Parameters
- inpstr or
HDUList Fits filename of a file that includes a
BinTableHDUtable of an extracted spectrum. Alternatively, can be anHDUListitself- spectrum_extensionstr
Extension name of 1D spectrum in file or HDUList input
- sys_errfloat
Systematic uncertainty added in quadrature with
errarray- err_maskfloat, float or None
Mask pixels where
err < np.percentile(err[err > 0], err_mask[0])*err_mask[1]- err_median_filterint, float or None
Mask pixels where
err < nd.median_filter(err, err_median_filter[0])*err_median_filter[1]
- inpstr or
- Returns
- spec
Table Spectrum table. Existing columns in
fileshould bewave: observed-frame wavelength, micronsflux: flux density,microJanskyerr: Uncertainty on`flux`
Columns calculated here are
corr: flux scalingescale: extra scaling of uncertaintiesfull_err: Full uncertainty includingsys_errR: spectral resolutionvalid: Data are valid
- spec