In [1]:
%matplotlib inline
In [2]:
# imports
try:
import seaborn as sns; sns.set(context="notebook",font_scale=2)
except:
pass
from desispec import bootcalib as desiboot
from desiutil import funcfits as dufits
from astropy.io import fits
from astropy.stats import sigma_clip
import numpy as np
from astropy.modeling import models, fitting
In [24]:
# Read
fiberflat = '/Users/xavier/DESI/Wavelengths/CRs/pix-r0-00000000.fits.gz'
flat_hdu = fits.open(fiberflat)
header = flat_hdu[0].header
flat = flat_hdu[0].data
ny = flat.shape[0]
In [25]:
# Find Fibers
xpk, ypos, cut = desiboot.find_fiber_peaks(flat)
In [26]:
reload(desiboot)
desiboot.qa_fiber_peaks(xpk, cut)
In [37]:
# Crude first
xset, xerr = desiboot.trace_crude_init(flat,xpk,ypos)
# Polynomial fits
xfit, fdicts = desiboot.fit_traces(xset,xerr)
In [38]:
# QA
desiboot.qa_fiber_Dx(xfit, fdicts)
In [40]:
# Model the PSF
gauss = desiboot.fiber_gauss(flat,xfit,xerr)
desiboot.qa_fiber_gauss(gauss)
In [ ]: