Closed drvdputt closed 2 years ago
I figured something out to get uncertainties (basically quadratic summing the pixels). I added the aperture extraction code to my package here https://github.com/drvdputt/PAHFIT-cube/blob/master/pahfitcube/cube_aperture.py
The uncertainties are included in the files. They are loaded in by Spectrum1D.
Merging #228 (2f7ee26) into master (2c6afb6) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #228 +/- ##
=======================================
Coverage 43.84% 43.84%
=======================================
Files 12 12
Lines 821 821
=======================================
Hits 360 360
Misses 461 461
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 2c6afb6...2f7ee26. Read the comment docs.
Thanks Dries. This looks great to me. We should test a diversity of Spectrum1D-readable formats anyway. Is there some segment identifying header keywords in the FITS files?
Happy to commit later today unless others notice any issue.
Can we get an updated figure?
Here are some plots. According to the uncertainties output by the JWST pipeline, the SNR is between 100 and 200 by the way (but if you zoom in on some parts, the noise is clearly bigger than that).
Here's a zoom-in of some early attempts at fitting these segments. Clearly still some fringing in certain locations, even with the residual fringe step applied.
These are great, thanks. What do you make of the flux breaks? Aperture-related? On Monday Karl mentioned that for point sources the segment flux alignment is perfect.
Also could you post a snippet for loading these via Spectrum1D?
Well perfect is a high ideal. Very, very good. The offsets shown are small. Some may be improved with updates to the calibration reference files. Very happy with how good this spectrum already looks!
This should do for loading.
from pathlib import Path
from specutils import Spectrum1D
s1d_files = list(Path('./VV114-extracted/').glob('*s1d*'))
twelve_specs = [Spectrum1D.read(f) for f in s1d_files]
And something like this for using one of them in PAHFIT
from astropy.nddata import StdDevUncertainty
# convert Spectrum1D object to PAHFIT data format
if spec1d.uncertainty is None:
# fake uncertainty if there is none
unc = StdDevUncertainty(0.05 * spec1d.flux)
else:
unc = spec1d.uncertainty
obsdata = {"x": spec1d.spectral_axis.to(u.micron), "y": spec1d.flux, "unc": unc.quantity}
This looks great, thanks @drvdputt. Merging for now, and we can always make improvements to these files when new calibrations/etc. appear.
The fringe correction is not perfect (still some wobbles at a scale of 4 wavelength points), but these might be usable.
What format should the included test spectra be in? What I did for these was just use the write function of Spectrum1D, and wrote them to fits (which is binary). Maybe text format (ipac like the rest) is preferred?
Caveats: