示例#1
0
]
target_posCwide = "HIP85871_7.25_POSC_WIDE"
IO.fix_long2pos_headers(obsfiles_posCwide)
obsfiles_posAwide = [
    'Offset_14_HIP85871_7.25_PosA.txt', 'Offset_21_HIP85871_7.25_PosA.txt'
]
target_posAwide = "HIP85871_7.25_POSA_WIDE"
IO.fix_long2pos_headers(obsfiles_posAwide)

# Note: for long2pos, the row position is ignored, and the middle point of the slit is used
longslit = {
    'yrange': [[1062, 1188], [887, 1010]],
    'row_position': 0,
    'mode': 'long2pos'
}
Flats.handle_flats('Flat.txt', maskname, band, flatops, longslit=longslit)

# in this case, we are using the argon lines.
# replace this with neon=['Ne.txt'] if you prefer to use Ne, and edit the following lines accordingly
argon = ['Ar.txt']
Wavelength.imcombine(argon, maskname, band, waveops)
Wavelength.fit_lambda_interactively(maskname,
                                    band,
                                    argon,
                                    waveops,
                                    longslit=longslit,
                                    argon=True,
                                    bypass=bypassflag)
Wavelength.fit_lambda(maskname, band, argon, argon, waveops, longslit=longslit)
Wavelength.apply_lambda_simple(maskname,
                               band,
示例#2
0
    import pyfits as pf
np.seterr(all='ignore')
flatops = Options.flat
waveops = Options.wavelength

#Driver file automatically generated on Sat Jul 25 17:33:42 2015
#For questions and comments, email [email protected], submit a ticket on the ticketing system, or contact Luca Rizzi @ WMKO

maskname = 'maskname'
band = 'band'

#Set noninteractive to True to autofit wavelenth solution instead of manually fitting.
noninteractiveflag=False
obsfiles=['Offset_1.25.txt','Offset_-1.25.txt']

Flats.handle_flats('Flat.txt', maskname, band, flatops)

Wavelength.imcombine(obsfiles, maskname, band, waveops)
Wavelength.fit_lambda_interactively(maskname, band, obsfiles,waveops, noninteractive=noninteractiveflag)
Wavelength.fit_lambda(maskname, band, obsfiles, obsfiles,waveops)
Wavelength.apply_lambda_simple(maskname, band, obsfiles, waveops)

# modify this variable to point to the correct wavelength file created on the previous step
Wavelength_file = 'lambda_solution_wave_stack_H_m141130_0323-0338.fits'

Background.handle_background(obsfiles,Wavelength_file,maskname,band,waveops)

redfiles = ["eps_" + file + ".fits" for file in obsfiles]
Rectify.handle_rectification(maskname, redfiles,Wavelength_file,band,obsfiles,waveops)

示例#3
0
target_posCnarrow = "HIP85871_7.25_POSC_NARROW"
IO.fix_long2pos_headers(obsfiles_posCnarrow)
obsfiles_posAnarrow = ["Offset_7_HIP85871_7.25_PosA.txt", "Offset_21_HIP85871_7.25_PosA.txt"]
target_posAnarrow = "HIP85871_7.25_POSA_NARROW"
IO.fix_long2pos_headers(obsfiles_posAnarrow)
# these are the wide slits, comment out if you are not using specphot
obsfiles_posCwide = ["Offset_-14_HIP85871_7.25_PosC.txt", "Offset_-7_HIP85871_7.25_PosC.txt"]
target_posCwide = "HIP85871_7.25_POSC_WIDE"
IO.fix_long2pos_headers(obsfiles_posCwide)
obsfiles_posAwide = ["Offset_14_HIP85871_7.25_PosA.txt", "Offset_21_HIP85871_7.25_PosA.txt"]
target_posAwide = "HIP85871_7.25_POSA_WIDE"
IO.fix_long2pos_headers(obsfiles_posAwide)

# Note: for long2pos, the row position is ignored, and the middle point of the slit is used
longslit = {"yrange": [[1062, 1188], [887, 1010]], "row_position": 0, "mode": "long2pos"}
Flats.handle_flats("Flat.txt", maskname, band, flatops, longslit=longslit)

# in this case, we are using the argon lines.
# replace this with neon=['Ne.txt'] if you prefer to use Ne, and edit the following lines accordingly
argon = ["Ar.txt"]
Wavelength.imcombine(argon, maskname, band, waveops)
Wavelength.fit_lambda_interactively(maskname, band, argon, waveops, longslit=longslit, argon=True, bypass=bypassflag)
Wavelength.fit_lambda(maskname, band, argon, argon, waveops, longslit=longslit)
Wavelength.apply_lambda_simple(maskname, band, argon, waveops, longslit=longslit, smooth=True)

# make sure you use the correct wavelength file generated before
Wavelength_file = "lambda_solution_wave_stack_H_m150428_0091-0091.fits"

# narrow
Background.handle_background(obsfiles_posAnarrow, Wavelength_file, maskname, band, waveops, target=target_posAnarrow)
Background.handle_background(obsfiles_posCnarrow, Wavelength_file, maskname, band, waveops, target=target_posCnarrow)
    flatlist = []

    if roll == 0:
        for num in nums:
            flatlist.append("/users/npk/desktop/5apr/m120406_%4.4i.fits" % num)
    else:
        for num in nums:
            header, ff, bs, targs, ssl, msl, asl = IO.readmosfits(
                    "/users/npk/desktop/5apr/m120406_%4.4i.fits" % num)
            hdu = pyfits.PrimaryHDU(np.roll(ff, -5, 0), header)
            hdulist = pyfits.HDUList([hdu])

            for tbl in [targs, ssl, msl, asl]:
                hdu = pyfits.new_table(tbl)
                hdulist.append(hdu)

            fn = "/users/npk/desktop/5apr/roll_m120406_%4.4i.fits" % num
            os.remove(fn)
            hdulist.writeto(fn)

            flatlist.append(fn)

    
    print flatlist

    Flats.handle_flats(flatlist, name, band,  Options.flat)




示例#5
0
import numpy as np, pylab as pl, pyfits as pf
np.seterr(all='ignore')
flatops = Options.flat
waveops = Options.wavelength

#Driver file automatically generated on Sat Jul 25 17:46:43 2015
#For questions and comments, email [email protected], submit a ticket on the ticketing system, or contact Luca Rizzi @ WMKO

maskname = 'maskname'
band = 'band'

#Set bypass to True to autofit wavelenth solution instead of manually fitting.
bypassflag=False
obsfiles=['Offset_1.25.txt','Offset_-1.25.txt']

Flats.handle_flats('Flat.txt', maskname, band, flatops,lampOffList='FlatThermal.txt')

Wavelength.imcombine(obsfiles, maskname, band, waveops)
# if you have Ar
Wavelength.imcombine('Ar.txt', maskname, band, waveops)
# if you have Ne
Wavelength.imcombine('Ne.txt', maskname, band, waveops)
Wavelength.fit_lambda_interactively(maskname, band, obsfiles,waveops, bypass=bypassflag)

Wavelength.apply_interactive(maskname, band, waveops, apply=obsfiles, to='Ar.txt', argon=True)
Wavelength.apply_interactive(maskname, band, waveops, apply=obsfiles, to='Ne.txt', neon=True)

Wavelength.fit_lambda(maskname, band, obsfiles, obsfiles,waveops)
Wavelength.fit_lambda(maskname, band, 'Ne.txt', 'Ne.txt',waveops, wavenames2='Ar.txt')
LROI = [[21000,22800]]*1
LROIs = Wavelength.check_wavelength_roi(maskname, band, obsfiles, 'Ne.txt', LROI, waveops)
# Create A/B positions for each observation
As1 = ["m120604_%4.4i.fits" % i for i in range(608,648,2)]
Bs1 = ["m120604_%4.4i.fits" % i for i in range(609,648,2)]
wavenames1 = As1[:] ; wavenames1.extend(Bs1)

As2 = ["m120604_%4.4i.fits" % i for i in range(591,604,2)]
Bs2 = ["m120604_%4.4i.fits" % i for i in range(592,604,2)]
wavenames2 = As2[:] ; wavenames2.extend(Bs2)

# Change the bad pixel mask path
# Options.path_bpm = "/scr2/mosfire/badpixels/badpix_18may2012.fits"

# Change if False to if True when you want to execute that step
# On interactive step, make sure you attempt to quit&save after fitting one
# slit!
if False: Flats.handle_flats(flatnames, maskname, band, flatops)
if False: Wavelength.imcombine(wavenames1, maskname, band, wavlops)
if False: Wavelength.imcombine(wavenames2, maskname, band, wavlops)

# only one interactive fit is needed
if False: Wavelength.fit_lambda_interactively(maskname, band, wavenames1,
        wavlops)

#                               mask     band  to fit       guess      options
if False: Wavelength.fit_lambda(maskname, band, wavenames1, wavenames1, wavlops)
if False: Wavelength.fit_lambda(maskname, band, wavenames2, wavenames1, wavlops)

if False: Wavelength.apply_lambda_simple(maskname, band, wavenames1, wavlops)
if False: Wavelength.apply_lambda_simple(maskname, band, wavenames2, wavlops)

As = As1[:]