cHbeta_type = 'cHBeta_red' emission_log = '_' + Catalogue_Dic['Datatype'] + '_LinesLog_v3.txt' # emission_log_st = '_' + Catalogue_Dic['Datatype'] + '_emission_LinesLog_v3.txt' #Get file list FilesList = dz.Folder_Explorer(emission_log, Catalogue_Dic['Obj_Folder'], CheckComputer=False) #Get the dictionary with the headers format and the data dz.EmissionLinesLog_header() #Generate list of objects (Dazer should have a method for this) for i in range(len(FilesList)): CodeName, FileName, FileFolder = dz.Analyze_Address(FilesList[i]) #load object data cHbeta = dz.GetParameter_ObjLog(CodeName, FileFolder, cHbeta_type, Assumption='float') obj_lines_frame = dz.load_object_frame(FileFolder, CodeName, emission_log, chbeta_coef=cHbeta_type) # obj_lines_frame_star = dz.load_object_frame(FileFolder, CodeName, emission_log_st, chbeta_coef = cHbeta_type) Hbeta_Flux = obj_lines_frame['line_Flux']['H1_4861A'] Hbeta_Int = obj_lines_frame['line_Int']['H1_4861A'] #Generate object row of data
for i in range(len(catalogue_df.index)): #Object objName = catalogue_df.iloc[i].name #Joining pointing joining_wavelength = catalogue_df.iloc[i].join_wavelength #Treat each arm file for color in ['Blue', 'Red']: fits_file = catalogue_df.iloc[i]['z{}_file'.format(color)] print fits_file CodeName, FileName_Blue, FileFolder = dz.Analyze_Address(fits_file) wave, flux, ExtraData = dz.get_spectra_data(fits_file) dz.data_plot(wave, flux, label='{} {} arm'.format(CodeName, color), color=color_dict[color]) idx_point = searchsorted(wave, joining_wavelength) if (wave[0] < joining_wavelength) and (joining_wavelength < wave[-1]): #dz.data_plot(wave[idx_point], flux[idx_point], label = 'Joining lambda {} $\AA$'.format(joining_wavelength), color=dz.colorVector['green'], markerstyle = 'o') dz.Axis.axvline( joining_wavelength, label='Joining lambda {} $\AA$'.format(joining_wavelength),
#Define operation Catalogue_Dic = dz.import_catalogue() Pattern = '_log' FilesList = dz.Folder_Explorer(Pattern, Catalogue_Dic['Obj_Folder'], CheckComputer=False) Hbeta_values, Flux_values, names, sn_values, z_values = [], [], [], [], [] g_mags, r_mags = [], [] Declination_values = [] for i in range(len(FilesList)): #Get the frame row CodeName, FileName, FileFolder = dz.Analyze_Address(FilesList[i], verbose=False) #Load the observational data Hbeta_Flux = dz.GetParameter_ObjLog(CodeName, FileFolder, 'SDSS_Flux_Hbeta', Assumption='float') Hbeta_Ew = dz.GetParameter_ObjLog(CodeName, FileFolder, 'SDSS_Eqw_Hbeta', Assumption='float') SN_median = dz.GetParameter_ObjLog(CodeName, FileFolder, 'SDSS_SNmedian', Assumption='float') z_SDSS = dz.GetParameter_ObjLog(CodeName,
#Create class object dz = Dazer() FilesList = dz.Folder_Explorer( '', '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/', CheckComputer=False, verbose=False, Sort_Output='alphabetically') files_to_keep = [] files_to_delete = [] for file_address in FilesList: CodeName, FileName, FolderName = dz.Analyze_Address(file_address, verbose=False) if (FileName in [ 'WHT_Galaxies_properties.txt' ]) or ('run' in FileName) or ('_lick_indeces.txt' in FileName): files_to_keep.append(FolderName + FileName) else: files_to_delete.append(FolderName + FileName) print '\n--These files will be deleted:' for file_address in files_to_delete: print file_address, ' -> X' print '\n--These files will be preserved:' for file_address in files_to_keep: print file_address, ' -> V'
#Loop through the objects for i in range(len(catalogue_df.index)): #Object objName = catalogue_df.iloc[i].name if objName == 'SHOC579': #Joining pointing joining_wavelength = catalogue_df.iloc[i].join_wavelength #Treat each arm file blue_fits_file = catalogue_df.iloc[i]['zBlue_file'] red_fits_file = catalogue_df.iloc[i]['zRed_file'] CodeName_Blue, FileName_Blue, FileFolder_Blue = dz.Analyze_Address( blue_fits_file) CodeName_Red, FileName_Red, FileFolder_Red = dz.Analyze_Address( red_fits_file) wave_Blue, flux_Blue, ExtraData_Blue = dz.get_spectra_data( blue_fits_file) wave_Red, flux_Red, ExtraData_Red = dz.get_spectra_data(red_fits_file) idx_blue = searchsorted(wave_Blue, joining_wavelength) idx_red = searchsorted(wave_Red, joining_wavelength) wave_comb = concatenate([wave_Blue[0:idx_blue], wave_Red[idx_red:-1]]) flux_comb = concatenate([flux_Blue[0:idx_blue], flux_Red[idx_red:-1]]) dz.data_plot(wave_Blue, flux_Blue, label='Blue arm') dz.data_plot(wave_Red, flux_Red, label='Red arm')
] # flux_calibrated = ['/home/vital/Astrodata/WHT_2016_04/Night1/objects/MRK36_Blue_cr_f_t_w_e_fglobal.fits', # '/home/vital/Astrodata/WHT_2016_04/Night1/objects/MRK36_Red_cr_f_t_w_bg_e_fglobal.fits'] flux_calibrated = [ '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/objects/MRK36_A1/MRK36_A1_Blue_fglobal.fits', '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/objects/MRK36_A2/MRK36_A2_Blue_fglobal.fits', '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/objects/MRK36_A1/MRK36_A1_Red_fglobal.fits', '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/objects/MRK36_A2/MRK36_A2_Red_fglobal.fits', ] for i in range(len(flux_calibrated)): # color = 'Blue' if 'Blue' in extracted_files[i] else 'Red' CodeName, FileName, FileFolder = dz.Analyze_Address(flux_calibrated[i]) wavelength, Flux_array, Header_0 = dz.get_spectra_data(flux_calibrated[i]) # for j in range(Header_0['NAXIS2']): # # color_plot = 'orangish' if j == 0 else 'dark blue' # dz.data_plot(wavelength, Flux_array[j], label = 'Apperture {} {}'.format(j, color), color=dz.colorVector[color_plot]) dz.data_plot(wavelength, Flux_array, label=FileName) dz.FigWording(r'Wavelength $(\AA)$', 'Flux ' + r'$(erg\,cm^{-2} s^{-1} \AA^{-1})$', 'MRK36') dz.display_fig()