In [ ]:
# import
In [6]:
def pix_sub(infil, outfil, rows=(80,310)):
hdu = fits.open(infil)
# Trim
img = hdu[0].data
sub_img = img[:,rows[0]:rows[1]]
# New
newhdu = fits.PrimaryHDU(sub_img)
# Header
for key in ['CAMERA','VSPECTER','RDNOISE','EXPTIME']:
newhdu.header[key] = hdu[0].header[key]
# Write
newhdulist = fits.HDUList([newhdu])
newhdulist.writeto(outfil,clobber=True)
print('Wrote: {:s}'.format(outfil))
In [2]:
arc_fil = '/u/xavier/DESI/Wavelengths/pix-b0-00000000.fits'
In [3]:
out_arc = '/u/xavier/DESI/Wavelengths/pix-sub_b0-00000000.fits'
In [ ]:
pix_sub(arc_fil, out_arc)
In [4]:
flat_fil = '/u/xavier/DESI/Wavelengths/pix-b0-00000001.fits'
out_flat = '/u/xavier/DESI/Wavelengths/pix-sub_b0-00000001.fits'
In [7]:
pix_sub(flat_fil, out_flat)
desi_bootcalib.py \
--fiberflat /Users/xavier/DESI/Wavelengths/pix-sub_b0-00000001.fits \
--arcfile /Users/xavier/DESI/Wavelengths/pix-sub_b0-00000000.fits \
--outfile /Users/xavier/DESI/Wavelengths/boot_psf-sub_b0.fits \
--qafile /Users/xavier/DESI/Wavelengths/qa_boot-sub_b0.pdf
scp pix-sub_b0-00000000.fits.gz hopper.nersc.gov:/project/projectdirs/desi/www/data/spectest
scp pix-sub_b0-00000001.fits.gz hopper.nersc.gov:/project/projectdirs/desi/www/data/spectest
In [9]:
import urllib2
In [14]:
url_arc = 'https://portal.nersc.gov/project/desi/data/spectest/pix-sub_b0-00000000.fits.gz'
In [15]:
f = urllib2.urlopen(url_arc)
tst_fil = 'tmp_arc.fits.gz'
with open(tst_fil, "wb") as code:
code.write(f.read())
In [16]:
url_flat = 'https://portal.nersc.gov/project/desi/data/spectest/pix-sub_b0-00000001.fits.gz'
In [17]:
f = urllib2.urlopen(url_flat)
tst_fil = 'tmp_flat.fits.gz'
with open(tst_fil, "wb") as code:
code.write(f.read())
In [ ]: