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)
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) # wide Background.handle_background(obsfiles_posAwide, Wavelength_file, maskname, band, waveops, target=target_posAwide) Background.handle_background(obsfiles_posCwide, Wavelength_file, maskname, band, waveops, target=target_posCwide) # narrow redfiles = ["eps_" + file + ".fits" for file in obsfiles_posAnarrow] Rectify.handle_rectification( maskname, redfiles, Wavelength_file, band, obsfiles_posAnarrow, waveops, target=target_posAnarrow ) redfiles = ["eps_" + file + ".fits" for file in obsfiles_posCnarrow] Rectify.handle_rectification( maskname, redfiles, Wavelength_file, band, obsfiles_posCnarrow, waveops, target=target_posCnarrow ) # wide
noninteractive=noninteractiveflag) 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) # wide Background.handle_background(obsfiles_posAwide, Wavelength_file, maskname, band, waveops, target=target_posAwide)
#For questions and comments, email [email protected], submit a ticket on the ticketing system, or contact Luca Rizzi @ WMKO maskname = 'LONGSLIT-3x0.7' band = 'H' #Set bypass to True to autofit wavelenth solution instead of manually fitting. bypassflag=False # modify the target name to match your observations obsfiles=['Offset_5_HIP17971.txt','Offset_-5_HIP17971.txt'] target="HIP17971" # modify the yrange to match the size of your longslit # row position is the extraction line used for the initial wavelength solution. It should be away from your target longslit = {'yrange':[968,1100],'row_position':1034,'mode':'longslit'} Flats.handle_flats('Flat.txt', maskname, band, flatops,longslit=longslit) Wavelength.imcombine(obsfiles, maskname, band, waveops) Wavelength.fit_lambda_interactively(maskname, band, obsfiles,waveops,longslit=longslit, bypass=bypassflag) Wavelength.fit_lambda(maskname, band, obsfiles, obsfiles,waveops,longslit=longslit) Wavelength.apply_lambda_simple(maskname, band, obsfiles, waveops,longslit=longslit) # make sure you use the file generated on the previous step Wavelength_file = 'lambda_solution_wave_stack_H_m121227_0162-0311.fits' Background.handle_background(obsfiles,Wavelength_file,maskname,band,waveops,target=target) redfiles = ["eps_" + file + ".fits" for file in obsfiles] Rectify.handle_rectification(maskname, redfiles,Wavelength_file,band,obsfiles,waveops, target=target)
# 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[:] Bs = Bs1[:] As.extend(As2) Bs.extend(Bs2) if True: Background.handle_background(As, Bs, wavenames1, maskname, band, wavlops) if True: Rectify.handle_rectification(maskname, ["A", "B"], wavenames1, band, wavlops)