def viewCube(self, cube, **kwargs): print "\nDISPLAYING DATA CUBE" iraf.gfdisplay(cube, **kwargs) return
def viewCube(self, cubeFile, frameNo=1, z1=0., z2=0., ext="SCI", \ version="*"): iraf.gfdisplay(cubeFile, frame=frameNo, z1=z1, z2=z2, extname=ext, \ version=version) return
iraf.imdelete('rg@' + ic.lst_flat) iraf.imdelete('erg@' + ic.lst_flat) for flat in iraf.type(ic.lst_flat, Stdout=1): flat = flat.strip() iraf.gfreduce(flat, rawpath=ic.rawdir, fl_extract='yes', bias=ic.bias, fl_over='yes', fl_trim='yes', mdffile=ic.nmdf, mdfdir='./', slits='both', line=1400, fl_fluxcal='no', fl_gscrrej='no', fl_wavtran='no', fl_skysub='no', fl_inter='no', fl_vardq='yes') os.system('ds9 &') iraf.sleep(5.0) for flat in iraf.type(ic.lst_flat, Stdout=1): flat = flat.strip() iraf.gfdisplay('erg' + flat, 1) # Printing the running time print('--- %s seconds ---' % (time.time() - start_time))
# ---------- Trace reference ---------- # flat = np.loadtxt(ic.lst_flat, dtype=str) if (flat.size > 1): raise ValueError("Please check if there is only one flat image for the standard star.") flat0 = flat.item(0) iraf.imdelete('g@'+ic.lst_flat) iraf.imdelete('rg@'+ic.lst_flat) iraf.imdelete('erg@'+ic.lst_flat) iraf.gfreduce(flat0, rawpath=ic.rawdir, fl_extract='yes', bias=ic.caldir+ic.procbias, fl_over='yes', fl_trim='yes', mdffile=ic.nmdf, mdfdir='./', slits=ic.cslit, line=pk_line, fl_fluxcal='no', fl_gscrrej='no', fl_wavtran='no', fl_skysub='no', fl_inter='no', fl_vardq='yes') # ----- Displaying the results ----- # if (ic.nslit == 1): vkw = '1' if (ic.nslit == 2): vkw = '*' os.system('ds9 &') iraf.sleep(5.0) iraf.gfdisplay('erg'+flat0, 1, version=vkw) # Printing the running time print('--- %.4f seconds ---' %(time.time()-start_time))
iraf.imdelete('qbrg@'+ic.lst_flat) iraf.imdelete('eqbrg@'+ic.lst_flat) iraf.gfreduce('brg@'+ic.lst_flat, recenter='no', reference='erg'+flat0, fl_extract='yes', fl_qecorr='yes', qe_refim='erg'+arc0, fl_addmdf='no', fl_bias='no', fl_over='no', fl_trim='no', mdffile=ic.nmdf, mdfdir='./', slits=ic.cslit, line=pk_line, fl_fluxcal='no', fl_gscrrej='no', fl_wavtran='no', fl_skysub='no', fl_inter='no', fl_vardq='yes') if (ic.nslit == 1): vkw = '1' if (ic.nslit == 2): vkw = '*' os.system('ds9 &') iraf.sleep(5.0) iraf.gfdisplay('eqbrg'+flat0, 1, version=vkw) # ---------- Response function ---------- # iraf.imdelete(flat0+'_resp') iraf.gfresponse('eqbrg'+flat0, outimage=flat0+'_resp', sky='', order=45, func='spline3', sample='*', fl_fit='yes', fl_inter='no') # os.system('ds9 &') # iraf.sleep(5.0) iraf.gfdisplay(flat0+'_resp', 1, version=vkw) # Printing the running time
import glob, os import g0_init_cfg as ic # ----- Importing IRAF from the root directory ----- # current_dir = os.getcwd() os.chdir(ic.dir_iraf) from pyraf import iraf from pyraf.iraf import gemini, gmos os.chdir(current_dir) iraf.chdir(current_dir) # ----- Spectrophotometric calibration ----- # iraf.imdelete('cstxeqxbrg@'+ic.lst_sci, verify='no') for sci in iraf.type(ic.lst_sci, Stdout=1): sci = sci.strip() iraf.gscalibrate('stxeqxbrg'+sci, sfunction=ic.caldir+ic.sensfunc, obs=ic.obs_site, extinction=ic.extinction, fl_ext='yes', fl_vardq='yes') os.system('ds9 &') iraf.sleep(5.0) for sci in iraf.type(ic.lst_sci, Stdout=1): iraf.gfdisplay('cstxeqxbrg'+sci, 1, version=1) # Printing the running time print('--- %s seconds ---' %(time.time()-start_time))
iraf.unlearn('gfextract') iraf.unlearn('gfdisplay') # ---------- QE correction and extraction of the science ---------- # flat0 = iraf.type(ic.lst_flat, Stdout=1)[0].strip() response = flat0+'_resp' ref_flat0 = 'eqbrg'+flat0 arc0 = iraf.type(ic.lst_arc, Stdout=1)[0].strip() iraf.imdelete('qxbrg@'+ic.lst_sci) iraf.imdelete('eqxbrg@'+ic.lst_sci) for sci in iraf.type(ic.lst_sci, Stdout=1): sci = sci.strip() iraf.gqecorr('xbrg'+sci, refimage='erg'+arc0, fl_correct='yes', fl_vardq='yes', verbose='yes') iraf.gfextract('qxbrg'+sci, response=response, recenter='no', trace='no', reference=ref_flat0, weights='none', fl_vardq='yes', line=1400) os.system('ds9 &') iraf.sleep(5.0) for sci in iraf.type(ic.lst_sci, Stdout=1): sci = sci.strip() iraf.gfdisplay('eqxbrg'+sci, 1) # Printing the running time print('--- %s seconds ---' %(time.time()-start_time))
iraf.imdelete('qbrg@'+ic.lst_flat) iraf.imdelete('eqbrg@'+ic.lst_flat) iraf.gfreduce('brg@'+ic.lst_flat, recenter='no', reference='erg'+flatref, fl_extract='yes', fl_qecorr='yes', qe_refim='erg'+arc0, fl_addmdf='no', fl_bias='no', fl_over='no', fl_trim='no', mdffile=ic.nmdf, mdfdir='./', slits='both', line=1400, fl_fluxcal='no', fl_gscrrej='no', fl_wavtran='no', fl_skysub='no', fl_inter='no', fl_vardq='yes') os.system('ds9 &') iraf.sleep(5.0) for flat in iraf.type(ic.lst_flat, Stdout=1): flat = flat.strip() iraf.gfdisplay('eqbrg'+flat, 1) # ---------- Response function ---------- # for flat in iraf.type(ic.lst_flat, Stdout=1): flat = flat.strip() iraf.imdelete(flat+'_resp') iraf.gfresponse('eqbrg'+flat, outimage=flat+'_resp', sky='', order=45, func='spline3', sample='*', fl_fit='yes', fl_inter='no') # os.system('ds9 &') # iraf.sleep(5.0) for flat in iraf.type(ic.lst_flat, Stdout=1): flat = flat.strip() iraf.gfdisplay(flat+'_resp', 1)
iraf.imdelete('qxbrg@'+ic.lst_std) iraf.imdelete('eqxbrg@'+ic.lst_std) iraf.gqecorr('xbrg'+std0, refimage='erg'+arc0, fl_correct='yes', fl_vardq='yes', verbose='yes') iraf.gfextract('qxbrg'+std0, response=response, recenter='no', trace='no', reference=ref_flat0, weights='none', fl_vardq='yes', line=pk_line, exslits=ic.eslit) if (ic.nslit == 1): vkw = '1' if (ic.nslit == 2): vkw = '*' os.system('ds9 &') iraf.sleep(5.0) iraf.gfdisplay('eqxbrg'+std0, 1, version=vkw) # ----- Displaying the extracted data for checking bad columns ----- # # fits.open('eqxbrg'+std0+'.fits').info() if (glob.glob("badcol/") == []): os.system("mkdir badcol") # ---> making a directory for bad column masking region files # ("badcol/std{}_slit{}.reg", with DS9 saoimage format) dt1, hd1 = fits.getdata('eqxbrg'+std0+'.fits', ext=2, header=True) z1l, z1u = np.percentile(dt1, [15, 85]) # 2-slit mode if (ic.nslit == 2): dt2, hd2 = fits.getdata('eqxbrg'+std0+'.fits', ext=5, header=True)