コード例 #1
0
    def extractSpec(self, inIm, **kwargs):

        # remove previous spectra and extract new ones
        iraf.imdelete("e" + inIm, verify="yes")
        iraf.gfextract(inIm, **kwargs)

        return
コード例 #2
0
    def extractSpec(self, inIm, **kwargs):

        print "\nEXTRACTING SPECTRA FROM", inIm

        # destroy previous extracted spectra
        iraf.imdelete("e" + inIm)

        # extract the spectra and view the result
        iraf.gfextract(inIm, **kwargs)
        self.viewCube("e" + inIm, frame=1, z1=0., z2=0., extname="SCI", \
         version="*")

        return
コード例 #3
0
ファイル: g1_vmdf.py プロジェクト: joungh93/PyRAF_GMOS_IFU
iraf.imdelete('rg@' + ic.lst_flat)

flat0 = iraf.type(ic.lst_flat, Stdout=1)[0]
iraf.gfreduce(flat0,
              rawpath=ic.rawdir,
              fl_extract='no',
              bias=ic.bias,
              fl_over='yes',
              fl_trim='yes',
              mdffile=ic.mdf,
              mdfdir='./',
              slits='both',
              line=1400,
              fl_fluxcal='no',
              fl_gscrrej='no',
              fl_wavtran='no',
              fl_skysub='no',
              fl_inter='no',
              fl_vardq='no')

iraf.imdelete('erg@' + ic.lst_flat)
iraf.gfextract('rg' + flat0, fl_inter='yes', line=1400)

# Writing aperture file
apfile = ['aperg' + flat0 + '_1', 'aperg' + flat0 + '_2']
for i in np.arange(len(apfile)):
    os.system('cp -rpv ' + ic.dir_db + apfile[i] + ' ' + ic.dir_db +
              apfile[i] + '_old')

# Printing the running time
print('--- %s seconds ---' % (time.time() - start_time))
コード例 #4
0
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))
コード例 #5
0
ファイル: g1_vmdf.py プロジェクト: joungh93/PyRAF_GMOS_IFU
# Extract a flat
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.gfreduce(flat0, rawpath=ic.rawdir, fl_extract='no', bias=ic.caldir+ic.procbias,
	          fl_over='yes', fl_trim='yes', mdffile=ic.mdf, mdfdir='./',
	          slits=ic.cslit, line=pk_line, fl_fluxcal='no', fl_gscrrej='no',
	          fl_wavtran='no', fl_skysub='no', fl_inter='no', fl_vardq='no')

iraf.imdelete('erg@'+ic.lst_flat)
iraf.gfextract('rg'+flat0, fl_inter='yes', line=pk_line, exslits=ic.eslit)
'''
----- Interactive task after gfextract -----
Extracting slit 1
Find apertures for erg[FLAT]_1? ('yes')
Edit apertures for erg[FLAT]_1? ('yes')
(IRAF graphics displaying... please check the fibers visually.)
- "w" + "e" (left bottom) + "e" (right top) : zoom-in
- "w" + "a" : zoom-out
- "q" : quitting the interactive task

Trace apertures for erg[FLAT]_1? ('yes')
Fit traced positions for erg[FLAT]_1 interactively? ('NO')
Write apertures for erg[FLAT]_1 to database ('yes')
Extract aperture spectra for erg[FLAT]_1? ('yes' (IFU-2 slit) / 'NO' (IFU-1 slit))
--> For the IFU-1 slit, this is the end.
コード例 #6
0
ファイル: test_apertures.py プロジェクト: danielrd6/gireds
def main():
    iraf.set(stdimage='imtgmos')

    iraf.gemini()
    iraf.gmos()

    # set directories
    iraf.set(rawdir='/dados/gmos/raw')  # raw files
    iraf.set(
        procdir='/dados/gmos/reduction/products/ngc7213/')  # processed files

    iraf.gmos.logfile = 'logfile.log'
    iraf.gfextract.verbose = 'no'

    iraf.cd('procdir')

    for task in ['gemini', 'gmos', 'gfextract']:
        iraf.unlearn(task)

    flat = 'S20110927S0062'

    for name in glob.glob('database/apeprg' + flat + '*'):
        if os.path.isfile(name):
            print('Removing file {:s}'.format(name))
            os.remove(name)

    if os.path.isfile('eprg' + flat + '.fits'):
        os.remove('eprg' + flat + '.fits')

    grow_gap = 1
    vardq = 'yes'

    ap = auto_apertures.AutoApertures('prg' + flat + '.fits')
    ap.find_dead_beams()
    ap.fix_mdf()

    iraf.delete('eprg' + flat + '.fits')
    extract_args = {
        'inimage': 'prg' + flat,
        'exslits': '*',
        'trace': 'yes',
        'recenter': 'yes',
        'order': 9,
        't_nsum': 50,
        'function': 'chebyshev',
        'fl_novl': 'no',
        'fl_fulldq': vardq,
        'fl_gnsskysub': 'no',
        'fl_fixnc': 'no',
        'fl_fixgaps': 'yes',
        'fl_vardq': 'yes',
        'grow': grow_gap,
        'fl_inter': 'no',
        'verbose': 'no'
    }

    iraf.gfextract(**extract_args)
    sys.exit()

    time_out = 0
    while (ap.check_iraf('database/apeprg' + flat) != 0) and (time_out < 5):
        ap.fix_mdf()
        print('Aperture iteration #{:d}.'.format(time_out))
        iraf.delete('eprg' + flat + '.fits')
        iraf.delete('database/apeprg' + flat + '*')

        extract_args['fl_inter'] = 'yes'
        iraf.gfextract(**extract_args)

        time_out += 1
コード例 #7
0
arc0 = arc.item(0)

std = np.loadtxt(ic.lst_std, dtype=str)
if (std.size > 1):
    raise ValueError("Please check if there is only one image for the standard star.")
std0 = std.item(0)

response = flat0+'_resp'
ref_flat0 = 'eqbrg'+flat0

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/") == []):