In [1]:
#%matplotlib notebook
%matplotlib inline
In [2]:
# imports
from importlib import reload
import os
from matplotlib import pyplot as plt
from astropy.io import fits
from desispec import preproc
# You may wish to comment this out
#from pypeit import ginga
In [3]:
exp_path = '/home/xavier/DESI/Commissioning/exposures'
In [4]:
night = '20190619'
In [5]:
def add_gain(header):
header['GAINA'] = 1.21763880607
header['GAINB'] = 1.26599257375
header['GAINC'] = 1.37207665312
header['GAIND'] = 1.28793077884
In [6]:
def show_boundary(img, vmin=-400, vmax=1673):
plt.clf()
plt.figure(figsize=(13,7))
plt.imshow(img.pix[1800:2200,500:1000], vmin=vmin, vmax=vmax)
plt.show()
In [7]:
iid = 16322
ifile_05 = os.path.join(exp_path, night, '000{}'.format(iid), 'desi-000{}.fits.fz'.format(iid))
ifile_05
Out[7]:
In [8]:
hdulist = fits.open(ifile_05)
z2_hdu = hdulist['z2']
In [9]:
#ginga.show_image(z2_hdu.data)
In [10]:
## Add in gain
add_gain(z2_hdu.header)
In [11]:
reload(preproc)
img = preproc.preproc(z2_hdu.data, z2_hdu.header, None, bias=False, pixflat=False, mask=False,
nocrosstalk=True, ccd_calibration_filename=False, dark=False, overscan_per_row=True)
In [12]:
#ginga.show_image(img.pix)
show_boundary(img)
In [13]:
reload(preproc)
img_orig = preproc.preproc(z2_hdu.data, z2_hdu.header, None, bias=False, pixflat=False, mask=False,
nocrosstalk=True, ccd_calibration_filename=False, dark=False, orig_over=True,
overscan_per_row=True)
In [14]:
show_boundary(img_orig)
In [15]:
iid = 16287
ifile = os.path.join(exp_path, night, '000{}'.format(iid), 'desi-000{}.fits.fz'.format(iid))
ifile
Out[15]:
In [16]:
hdulist = fits.open(ifile)
z2_hdu_10 = hdulist['z2']
In [17]:
## Add in gain
add_gain(z2_hdu_10.header)
In [18]:
reload(preproc)
img_10 = preproc.preproc(z2_hdu_10.data, z2_hdu.header, None, bias=False, pixflat=False, mask=False,
nocrosstalk=True, ccd_calibration_filename=False, dark=False, overscan_per_row=True)
In [19]:
show_boundary(img_10, vmin=None, vmax=None)