pv.FigFormat_One(ColorConf='Night1') #Loop through files for i in range(len(FilesList)): for j in range(len(FilesList[i])): CodeName, FileName, FileFolder = pv.FileAnalyzer(FilesList[i][j]) #From the fits file determine which is the star being treated StarName = py_w.StarnameFromFileName(FileName) #Star sensitivity curve SensitivityCurve = 'a_sen_' + StarName #Get Airmass and Exptime for the object Airmass_Value = py_w.get_HeaderValue(py_w.Airmass_Key, FileFolder + FileName, True) ExpTime_Value = py_w.get_HeaderValue(py_w.Exptime_Key, FileFolder + FileName, True) #Calibration with the same star OutputFile_CalibratedFileSingle = py_w.CalibrateTask(FileName, None, SensitivityCurve, FileFolder, Airmass_Value, ExpTime_Value, Suffix='fxW_OwnSensitivityCurve') #Calibration with the global curve GlobalCurve = py_w.GlobalSensitiviyCurve + '.fits' OutputFile_CalibratedFileCombined = py_w.CalibrateTask(FileName, None, GlobalCurve, FileFolder, Airmass_Value, ExpTime_Value, Suffix='fxW') #Extract the data for the plots Wave_Single, Int_Single, ExtraData_Single = pv.File2Data(FileFolder, OutputFile_CalibratedFileSingle) Wave_Combined, Int_Combined, ExtraData_Combined = pv.File2Data(FileFolder, OutputFile_CalibratedFileCombined) #Getting star calibration file StarCalibrationName, BandWidth, BandSep = py_w.getCalibrationFile(StarName)
CatalogueFolder = '/home/vital/Desktop/SDSS_Galaxies/Flux_Calibration_Steps/Night1_Blue/' #Find and organize files from terminal command or .py file FilesList = pv.FindAndOrganize(Pattern, CatalogueFolder, CheckComputer=False) #Generate plot frame and colors pv.FigFormat_One(ColorConf='Night1') #Loop through files for i in range(len(FilesList)): for j in range(len(FilesList[i])): CodeName, FileName, FileFolder = pv.FileAnalyzer(FilesList[i][j]) input_spec = FileName + '[0]' Airmass_Value = py_w.get_HeaderValue(py_w.Airmass_Key, FileFolder + input_spec, True) ExpTime_Value = py_w.get_HeaderValue(py_w.Exptime_Key, FileFolder + input_spec, True) sens_func = 'a_std_wideCombAll_se.fits[0]' print 'Airmass measured', Airmass_Value print 'Exposition time measured', ExpTime_Value OutputFile_CalibratedFile = py_w.CalibrateTask(input_spec, None, sens_func, CatalogueFolder, Airmass_Value, ExpTime_Value, Suffix='fxW_TESTINGPYRAF') TwoAirmass_CalibratedFile = py_w.CalibrateTask(input_spec, None, sens_func, CatalogueFolder, Airmass_Value * 10, ExpTime_Value, Suffix='fxW_2Airmass') HalfExptime_CalibratedFile = py_w.CalibrateTask(input_spec, None, sens_func, CatalogueFolder, Airmass_Value, ExpTime_Value / 5, Suffix='fxW_halfexp') Wave, Int, ExtraData_Red = pv.File2Data(FileFolder, OutputFile_CalibratedFile) Wave, Int2airmass, ExtraData_Red = pv.File2Data(FileFolder, TwoAirmass_CalibratedFile) Wave, Inthalfexptime, ExtraData_Red = pv.File2Data(FileFolder, HalfExptime_CalibratedFile) pv.DataPloter_One(Wave, Int, 'calibrated Spectrum', pv.Color_Vector[2][3])
''' import CodeTools.PlottingManager as plotMan from Scientific_Lib.IrafMethods import Pyraf_Workflow pv = plotMan.myPickle() py_w = Pyraf_Workflow('WHT') Pattern, CatalogueFolder = py_w.DataFormat(Reduction_Operation = 'Std_FluxCalibration') #Find and organize files from terminal command or .py file FilesList = pv.FindAndOrganize(Pattern, CatalogueFolder, CheckComputer=False) GlobalStandard_File = py_w.Airmass_Key #Loop through files for i in range(len(FilesList)): for j in range(len(FilesList[i])): CodeName, FileName, FileFolder = pv.FileAnalyzer(FilesList[i][j]) #Red Airmass_Value = py_w.get_HeaderValue(py_w.Airmass_Key, FileFolder + FileName, Digitalize=True) ExpTime_Value = py_w.get_HeaderValue(py_w.Exptime_Key, FileFolder + FileName, Digitalize=True) #Run the task OutputFile_StandardFile = py_w.StandardTask(FileName, OutputFile = None, FitsFolder =FileFolder, airmass_value = Airmass_Value, exptime_value = ExpTime_Value) print '\n--- Data wrote to', OutputFile_StandardFile, '\n' print 'All data treated'