Ejemplo n.º 1
0
def identify2d(fs=None):
    iraf.cd('work')
    if fs is None:
        fs = glob('mos/arc*mos*.fits')
    if len(fs) == 0:
        print "WARNING: No mosaiced (2D) specidentify."
        # Change directories to fail gracefully
        iraf.cd('..')
        return
    arcfs, arcgas = get_ims(fs, 'arc')
    if not os.path.exists('id2'):
        os.mkdir('id2')

    lampfiles = {
        'Th Ar': 'ThAr.salt',
        'Xe': 'Xe.salt',
        'Ne': 'NeAr.salt',
        'Cu Ar': 'CuAr.salt',
        'Ar': 'Argon_hires.salt',
        'Hg Ar': 'HgAr.salt'
    }
    for i, f in enumerate(arcfs):
        ga = arcgas[i]

        # find lamp and corresponding linelist
        lamp = pyfits.getval(f, 'LAMPID')
        lampfn = lampfiles[lamp]
        if pyfits.getval(f, 'GRATING') == 'PG0300' and lamp == 'Ar':
            lampfn = 'Argon_lores.swj'

        ccdsum = int(pyfits.getval(f, 'CCDSUM').split()[1])

        # linelistpath is a global variable defined in beginning, path to
        # where the line lists are.
        lamplines = pysaltpath + '/data/linelists/' + lampfn
        print(lamplines)

        # img num should be right before the .fits
        imgnum = f[-9:-5]
        # run pysalt specidentify
        idfile = 'id2/arc%05.2fid2%04i' % (float(ga), int(imgnum)) + '.db'
        iraf.unlearn(iraf.specidentify)
        iraf.flpr()
        iraf.specidentify(
            images=f,
            linelist=lamplines,
            outfile=idfile,
            guesstype='rss',
            inter=True,  # automethod='FitXcor',
            rstep=600 / ccdsum,
            rstart=200 / ccdsum,
            startext=1,
            clobber='yes',
            #startext=1, clobber='yes',
            verbose='no',
            mode='hl',
            logfile='salt.log',
            mdiff=2,
            function='legendre')
    iraf.cd('..')
Ejemplo n.º 2
0
def identify2d(fs=None):
    iraf.cd('work')
    if fs is None:
        fs = glob('mos/arc*mos*.fits')
    if len(fs) == 0:
        print "WARNING: No mosaiced (2D) specidentify."
        # Change directories to fail gracefully
        iraf.cd('..')
        return
    arcfs, arcgas = get_ims(fs, 'arc')
    if not os.path.exists('id2'):
        os.mkdir('id2')

    lampfiles = {'Th Ar': 'ThAr.salt', 'Xe': 'Xe.salt', 'Ne': 'NeAr.salt',
                 'Cu Ar': 'CuAr.salt', 'Ar': 'Argon_hires.salt',
                 'Hg Ar': 'HgAr.salt'}
    for i, f in enumerate(arcfs):
        ga = arcgas[i]

        # find lamp and corresponding linelist
        lamp = pyfits.getval(f, 'LAMPID')
        lampfn = lampfiles[lamp]
        if pyfits.getval(f,'GRATING') == 'PG0300' and lamp == 'Ar':
            lampfn = 'Argon_lores.swj'

        ccdsum = int(pyfits.getval(f, 'CCDSUM').split()[1])

        # linelistpath is a global variable defined in beginning, path to
        # where the line lists are.
        lamplines = pysaltpath + '/data/linelists/' + lampfn
        print(lamplines)

        # img num should be right before the .fits
        imgnum = f[-9:-5]
        # run pysalt specidentify
        idfile = 'id2/arc%05.2fid2%04i' % (float(ga), int(imgnum)) + '.db'
        iraf.unlearn(iraf.specidentify)
        iraf.flpr()
        iraf.specidentify(images=f, linelist=lamplines, outfile=idfile,
                          guesstype='rss', inter=True, # automethod='FitXcor',
                          rstep=600 / ccdsum,
                          rstart=200 / ccdsum, startext=1, clobber='yes',
                          #startext=1, clobber='yes',
                          verbose='no', mode='hl', logfile='salt.log',
                          mdiff=2, function='legendre')
    iraf.cd('..')
Ejemplo n.º 3
0
def call_specidentify(file,
                      i,
                      calfile,
                      object,
                      grating,
                      tilt,
                      lampid,
                      year_obs,
                      dir_linelists,
                      verbose=0):

    if (object != "ARC"):
        print "Can't do SPECIDENTIFY: Object = " + object + ", not ARC"
        return

    if (verbose > 0):
        print "\n ** Calling SPECIDENTIFY, " + file + ", i = " + repr(i) + ", object = " + object + \
        ", lampid = " + \
        lampid.replace(" ", "") + ", grating = " + grating + ", tilt = " + repr(tilt) + ' deg' + "\n\n"

    a = tilt
    if (tilt < 15):
        guessfile = 'salt_pluto_cal_guess_angle_13.txt'
    else:
        guessfile = 'salt_pluto_cal_guess_angle_20.txt'

    mdiff = 10  # differnce between observed line position and catalog line position. In tutorial, this was 5,
    # and I missed a lot of lines as a result.

    # Figure out which ARC light file to use. As per Steve Crawford, I should use the .salt ones, not the .txt ones.

    if (year_obs == 2015):
        rmiddle = 342  # 2015 data seemed to be binned more aggressively than 2014, with fewer rows in the output!
        rstep = 50
        rstart = rmiddle - rstep

    out = iraf.specidentify(
        images=file,
        linelist=dir_linelists + '/' + lampid.replace(" ", "") + '.salt',
        outfile=calfile,
        automethod='MatchZero',
        guesstype='rss',
        guessfile=None,
        #   	guesstype='file', guessfile=guessfile,
        smooth=3,
        function='polynomial',
        order=3,
        rstep=rstep,
        rstart=rstart,
        #   	function='polynomial', order=3, rstep=rstep, rstart='middlerow',		# rstart='middlerow' for v0.47. In nightly can use #.
        mdiff=mdiff,
        thresh=3,
        startext=0,
        niter=5,
        inter=1,
        clobber=0,
        logfile='salt.log',
        verbose=(verbose > 1))
Ejemplo n.º 4
0
            if (year_obs == 2015):
                rmiddle = 342  # 2015 data seemed to be binned more aggressively than 2014, with fewer rows in the output!
                rstep = 50
                rstart = rmiddle - rstep

            out = iraf.specidentify(
                images=files[i],
                linelist=dir_linelists + '/' + lampid[i].replace(" ", "") +
                '.salt',
                outfile=calfile,
                automethod='MatchZero',
                #                   guesstype='file', guessfile=guessfile, # Works for 2014 obs, but crashes 2015 ones
                guesstype='rss',
                guessfile=None,
                function='polynomial',
                order=3,
                rstep=rstep,
                rstart=rstart,
                mdiff=mdiff,
                thresh=3,
                startext=0,
                niter=5,
                inter=1,
                clobber=0,
                logfile='salt.log',
                verbose=1)

#                guesstype='rss', guessfile=' ', function='polynomial', order=3, rstep=100, rstart='middlerow',
##########
# Step 2: Process cosmic rays.
# Not really necessary on ARCs, but we do it just for consistency to keep filenames the same.