dz_reduc = spectra_reduction() script_code = dz.get_script_code() lickIndcs_extension = '_lick_indeces.txt' #Load catalogue dataframe catalogue_dict = dz.import_catalogue() catalogue_df = dz.load_excel_DF('/home/vital/Dropbox/Astrophysics/Data/WHT_observations/WHT_Galaxies_properties.xlsx') image_address = '/home/vital/Dropbox/Astrophysics/Papers/Yp_AlternativeMethods/images/telluric_correction_detail' SIII_theo = 2.469 H7_H8_ratio_theo = 1.98 #Set figure format size_dict = {'figure.figsize': (16, 10), 'axes.labelsize':20, 'legend.fontsize':20, 'font.family':'Times New Roman', 'mathtext.default':'regular', 'xtick.labelsize':20, 'ytick.labelsize':20} dz.FigConf(plotStyle='seaborn-colorblind', plotSize = size_dict, Figtype = 'Grid_size', n_columns = 1, n_rows = 2) #Sulfur lines to plot lines_interest = ['S3_9069A','S3_9531A', 'H1_9015A', 'H1_9229A', 'H1_9546A'] for i in range(len(catalogue_df.index)): print '\n-- Treating {} @ {}'.format(catalogue_df.iloc[i].name, catalogue_df.iloc[i].Red_file) codeName = catalogue_df.iloc[i].name fits_file = catalogue_df.iloc[i].Red_file ouput_folder = '{}{}/'.format(catalogue_dict['Obj_Folder'], codeName) if codeName == '8': #Get object
from pandas import read_csv from dazer_methods import Dazer from timeit import default_timer as timer from DZ_LineMesurer import LineMesurer_v2 #Define main class dz = Dazer() lm = LineMesurer_v2('/home/vital/workspace/dazer/format/', 'DZT_LineLog_Headers.dz') #Making the plot: dz.FigConf() #Load catalogue dataframe catalogue_dict = dz.import_catalogue() catalogue_df = dz.load_excel_DF( '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/WHT_Galaxies_properties.xlsx' ) lickIndcs_extension = '_lick_indeces.txt' #Declare object to treat objName = 'SHOC575_n2' #Load line regions ouput_folder = '{}{}/'.format(catalogue_dict['Obj_Folder'], objName) lick_idcs_df = read_csv(ouput_folder + objName + lickIndcs_extension, delim_whitespace=True, header=0, index_col=0, comment='L') #Dirty trick to avoid the Line_label row
from dazer_methods import Dazer from DZ_observation_reduction import spectra_reduction from numpy import isnan import os.path dz = Dazer() dz_reduc = spectra_reduction() script_code = dz.get_script_code() catalogue_dict = dz.import_catalogue() catalogue_df = dz.load_excel_DF( '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/WHT_Galaxies_properties.xlsx' ) dz.FigConf(Figtype='Grid_size', n_columns=1, n_rows=2) for i in range(len(catalogue_df.index)): #print '\n-- Treating {} @ {}'.format(catalogue_df.iloc[i].name, catalogue_df.iloc[i].Red_file) codeName = catalogue_df.iloc[i].name fits_file = catalogue_df.iloc[i].Red_file ouput_folder = '{}{}/'.format(catalogue_dict['Obj_Folder'], codeName) redshift_factor = 1 + catalogue_df.iloc[i].z_Red star = catalogue_df.iloc[i].telluric_star calibration_star = catalogue_df.iloc[i].calibration_star.split(';')[0] if os.path.isfile( '{reduc_folder}objects/{calibStar}_Red_slit5.0_n.fits'.format( reduc_folder=catalogue_df.iloc[i].obsfolder,
) cHbeta_type = 'cHbeta_reduc' nebular_exten = '_NebularContinuum.fits' Stellar_ext = '_StellarContinuum.fits' emitting_ext = '_Emission.fits' #Define plot frame and colors size_dict = { 'axes.labelsize': 20, 'legend.fontsize': 18, 'font.family': 'Times New Roman', 'mathtext.default': 'regular', 'xtick.labelsize': 18, 'ytick.labelsize': 18 } dz.FigConf(plotSize=size_dict) #Reddening properties R_v = 3.4 red_curve = 'G03_average' cHbeta_type = 'cHbeta_reduc' obj_lines = {} obj_lines['SHOC579'] = OrderedDict() obj_lines['SHOC579'][r'Balmer jump'] = (3646.0, 2.1e-16) obj_lines['SHOC579'][r'$HI_{11}\lambda3770\AA$'] = (3771.0, 2.1e-16) obj_lines['SHOC579'][r'$HI_{20}\lambda3683\AA$ '] = (3676.0, 1.85e-16) ak = lineid_plot.initial_annotate_kwargs() ak['arrowprops']['relpos'] = (0.5, 0.0) ak['rotation'] = 90
# from ManageFlow import DataToTreat # from CodeTools.PlottingManager import myPickle # from Plotting_Libraries.dazer_plotter import Plot_Conf # from astropy.coordinates import EarthLocation # from astropy.coordinates import SkyCoord # from astropy.time import Time # favoured_objects = ['72', '60', '61', '12', '29', '36', 'Mar1987', 'Mar2232', 'Mar2474', 'Mar88', 'Mar1315', 'Mar1390', 'Mar652', 'Mar2018', 'Mar1715', 'Mar2260', 'Mar1342', 'Mar87'] favoured_objects = ['02', '03', '05', '09', 'Mar2232'] #Generate dazer object dz = Dazer() #Define figure format dz.FigConf(n_colors=2) cmap = dz.cmap_pallete() #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)):
''' Created on Mar 15, 2017 @author: vital ''' import numpy as np from dazer_methods import Dazer dz = Dazer() #Set figure format sizing_dict = {'figure.figsize': (8, 8)} dz.FigConf(sizing_dict) te_SIII = np.linspace(8000, 20000, 50) te_SII = 0.88 * te_SIII + 1560 line_unity = te_SIII dz.data_plot(te_SIII, te_SII, label=r'$T_e[SII]=0.88T_e[SIII]+1560$') dz.data_plot(te_SIII, te_SIII, label='', color='grey', linestyle='--') dz.Axis.set_xlim(8000, 20000) dz.Axis.set_ylim(8000, 20000) dz.Axis.grid(True) ticklines = dz.Axis.get_xticklines() + dz.Axis.get_yticklines() gridlines = dz.Axis.get_xgridlines() + dz.Axis.get_ygridlines() ticklabels = dz.Axis.get_xticklabels() + dz.Axis.get_yticklabels() for line in ticklines:
#Read table data df = pd.read_excel( '/home/vital/Dropbox/Astrophysics/Thesis/notes/table_yp_literature.xlsx', sheetname='Sheet1') #Define plot frame and colors size_dict = { 'figure.figsize': (18, 8), 'axes.labelsize': 28, 'legend.fontsize': 35, 'font.family': 'Times New Roman', 'mathtext.default': 'regular', 'xtick.labelsize': 28, 'ytick.labelsize': 28 } dz.FigConf(plotStyle='colorblind', plotSize=size_dict) # Generate the color map dz.gen_colorList(0, df.index.size) marker_dict = {'Peimbert': 's', 'Skillman': '^', 'Izotov': 'o'} #Loop through the lines for i in range(df.index.size): author, value, error, year, comments, upper_limit, group = df.iloc[ i].values marker_type = '_' if group not in marker_dict else marker_dict[group] if error < 0.236:
dz.load_input_data(config_dict) #Perform SSP synthesis start = timer() fit_products = dz.fit_ssp(config_dict['input_z'], config_dict['input_sigma'], config_dict['input_Av']) end = timer() print 'ssp', ' time ', (end - start) # start = timer() # Gamma_FF_HI = neb.FreeFreeContinuum("HI") # end = timer() # print 'FF', ' time ', (end - start) #Plot the results dzp.FigConf() dzp.data_plot(dz.sspFit_dict['obs_wave'], dz.sspFit_dict['obs_flux'], label='obs_flux') dzp.data_plot(dz.sspFit_dict['obs_wave'], dz.sspFit_dict['zero_mask'], label='my mask') # dzp.data_plot(dz.fit_conf['obs_wave'], mis_cosas[1], label='Hector mask') # dzp.data_plot(dz.fit_conf['obs_wave'], mis_cosas[2], label='Hector fit') dzp.data_plot(dz.sspFit_dict['obs_wave'], fit_products['flux_sspFit'], label='my fit') dzp.FigWording('Wave', 'Flux', 'Input spectra') dzp.display_fig()
return PartialWavelength, PartialIntensity, LineHeight, LineExpLoc #Create class object dz = Dazer() script_code = dz.get_script_code() #Load catalogue dataframe catalogue_dict = dz.import_catalogue() catalogue_df = dz.load_excel_DF( '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/WHT_Galaxies_properties.xlsx' ) #Set figure format dz.FigConf('night') #Not sure what this is dz.force_WD = True #Loop through the objects for i in range(len(catalogue_df.index)): #Object objName = catalogue_df.iloc[i].name fits_file = catalogue_df.iloc[i].reduction_fits ouput_folder = '{}{}/'.format(catalogue_dict['Obj_Folder'], objName) print '-- Treating {} @ {}'.format(objName, fits_file) #Spectrum data
import numpy as np from dazer_methods import Dazer from lib.Astro_Libraries.Nebular_Continuum import NebularContinuumCalculator from timeit import default_timer as timer import timeit dz = Dazer() neb = NebularContinuumCalculator() for_dic = {'figure.figsize': (14, 20)} dz.FigConf(for_dic) Te = 10000.0 wave = np.arange(2000, 7000) HeI, HeII = 0.01, 0.001 Flux_recomb = 1.5e-13 wave_ryd = 3 neb.PropertiesfromUser(Te, Flux_recomb, HeI, HeII, wave) neb.load_neb_constants() wave_ryd = (neb.const['h'] * neb.const['c_Angs']) / (neb.const['Ryd2erg'] * wave) Gamma_FF_HI_fast = neb.free_free_gCont(wave, Te) Gamma_2q_HI_fast = neb.two_photon_gCont(wave, Te) Gamma_FB_HI_fast = neb.free_bound_gCont(wave_ryd, Te, neb.HI_fb_dict) Gamma_FB_HeI_fast = neb.free_bound_gCont(wave_ryd, Te, neb.HeI_fb_dict) Gamma_FB_HeII_fast = neb.free_bound_gCont(wave_ryd, Te, neb.HeII_fb_dict) Gamma_FB_HI = neb.FreeBoundContinuum_EP("HeII") Gamma_Total, Gamma_lambda, Gamma_FB_HI, Gamma_FB_HeI, Gamma_FB_HeII, Gamma_2q, Gamma_FF = neb.Calculate_Nebular_gamma(
Hbeta_dist = random.normal( reduc_lineslog_df.loc['H1_4861A'].line_Int.nominal_value, reduc_lineslog_df.loc['H1_4861A'].line_Int.std_dev, MC_length) #Insert new section in pdf with dz.pdfDoc.create(Section('HII Galaxy: {}'.format(objName))): dz.add_page() #------Plot Oxygen lines element_lines = reduc_lineslog_df.loc[( reduc_lineslog_df.index.isin(oxygen_emision))].index.values if len(element_lines) > 0: dz.FigConf(plotStyle='seaborn-colorblind', Figtype='grid', plotSize=sizing_dict, n_columns=int(len(element_lines)), n_rows=int(np_ceil(len(element_lines) / n_columns))) for j in range(len(element_lines)): #Define plotting regions regions_wavelengths = reduc_lineslog_df.loc[ element_lines[j], ['Wave1', 'Wave2', 'Wave3', 'Wave4', 'Wave5', 'Wave6' ]].values idcs_obj, idcs_stellar = searchsorted( wave_reduc, regions_wavelengths), searchsorted( wave_stellar, regions_wavelengths) subwave_solar, subFlux_solar = wave_stellar[ idcs_stellar[0]:idcs_stellar[5]], flux_stellar[