from collections import OrderedDict from dazer_methods import Dazer from lib.inferenceModel import SpectraSynthesizer from lib.Astro_Libraries.spectrum_fitting.import_functions import make_folder # Import functions dz = Dazer() specS = SpectraSynthesizer() # Declare data location root_folder = 'E:\\Dropbox\\Astrophysics\\Data\\WHT_observations\\bayesianModel\\' whtSpreadSheet = 'E:\\Dropbox\\Astrophysics\\Data\\WHT_observations\\WHT_Galaxies_properties.xlsx' # Import data catalogue_dict = dz.import_catalogue() catalogue_df = dz.load_excel_DF(whtSpreadSheet) default_lines = [ 'H1_4341A', 'H1_6563A', 'He1_4471A', 'He1_5876A', 'He1_6678A', 'He2_4686A', 'O2_7319A', 'O2_7319A_b', 'O2_7330A', 'O3_4363A', 'O3_4959A', 'O3_5007A', 'N2_6548A', 'N2_6584A', 'S2_6716A', 'S2_6731A', 'S3_6312A', 'S3_9069A', 'S3_9531A', 'Ar3_7136A', 'Ar4_4740A' ] # Quick indexing dz.quick_indexing(catalogue_df) # Sample objects excludeObjects = [ 'SHOC579', 'SHOC575_n2', '11', 'SHOC588', 'SDSS3', 'SDSS1', 'SHOC36' ]
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 #Load spectrum data
import numpy as np from uncertainties import ufloat, unumpy from dazer_methods import Dazer #Generate dazer object dz = Dazer() #Set figure format dz.FigConf() file_tradional_reduc = '/home/vital/Dropbox/Astrophysics/Data/Fabian_Catalogue/data/Traditional_Abundances.xlsx' file_starlight = '/home/vital/Dropbox/Astrophysics/Data/Fabian_Catalogue/data/Starlight_Abundances.xlsx' df_dict = {} df_dict['traditional'] = dz.load_excel_DF(file_tradional_reduc) df_dict['starlight'] = dz.load_excel_DF(file_starlight) type = 'traditional' element = 'Oxygen' conf_dict = {} conf_dict['Oxygen_xlabel'] = r'y' conf_dict['Nitrogen_xlabel'] = r'N/H $(10^{-6})$' conf_dict['ylabel'] = r'$Y$' conf_dict['title'] = 'Helium mass fraction versus {} abundance'.format(element) conf_dict['legend_label'] = 'Data generated from {} treatment'.format(type) conf_dict['Oxygen_color'] = 'green' conf_dict['Nitrogen_color'] = 'blue' x = df_dict[type][element] y = df_dict[type].y
'SDSS_reference', 'SDSS_Web', 'z_Blue', 'RA', 'DEC', 'Dichroic' ] headers = [ 'Local reference', 'SDSS reference', 'z', 'RA (hh:{arcmin}:{arcsec})'.format(arcmin="'", arcsec='"'), 'DEC (deg:{arcmin}:{arcsec})'.format(arcmin="'", arcsec='"'), 'ISIS configuration' ] #Import library object dz = Dazer() #Load observational data catalogue_df = dz.load_excel_DF( 'E:\\Dropbox\\Astrophysics\\Data\\WHT_observations\\WHT_Galaxies_properties.xlsx' ) #Define data to load pdf_address = 'E:\\Dropbox\\Astrophysics\\Papers\\Yp_BayesianMethodology\\source files\\tables\\reference_table_noPreamble' #Generate pdf #dz.create_pdfDoc(pdf_address, pdf_type='table') dz.pdf_insert_table(headers) #Quick indexing dz.quick_indexing(catalogue_df) # Sample objects excludeObjects = ['SHOC579', 'SHOC575_n2', '11', 'SHOC588', 'SDSS1', 'SHOC36' ] # SHOC579, SHOC575, SHOC220, SHOC588, SHOC592, SHOC036
import pandas as pd from dazer_methods import Dazer from numpy import isnan, nan, sort, unique, zeros, core, full from numpy.core.defchararray import add as add_str_array from astropy import units as u from astropy.coordinates import SkyCoord dz = Dazer() #Define data location table_address_new = '/home/vital/Dropbox/Astrophysics/Papers/Determination 2photon continua/Master_table.xlsx' #Load the tables new_df = dz.load_excel_DF(table_address_new) for i in range(len(new_df)): if pd.notnull(new_df.iloc[i].Ra): coordinate = r'{} {}'.format(new_df.iloc[i].Ra, new_df.iloc[i].Dec) c = SkyCoord(coordinate, unit=(u.hourangle, u.deg)).to_string('decimal').split() pn_code = new_df.iloc[i].name new_df.loc[pn_code, 'Ra_deg'] = c[0] new_df.loc[pn_code, 'Dec_deg'] = c[1] # Create a Pandas Excel writer using XlsxWriter as the engine. writer = pd.ExcelWriter(table_address_new, engine='xlsxwriter')
import pandas as pd from dazer_methods import Dazer from numpy import isnan, nan, sort, unique, zeros dz = Dazer() table_address = '/home/vital/Desktop/NGC5457_CHAOSIII_regions.xlsx' old_df = dz.load_excel_DF(table_address) regions_list = pd.unique(old_df.index) wavelength = sort(pd.unique(old_df.wavelength)[0:-1]) physical_param = ['C(Hbeta)', 'F(Hbeta)', 'EW(Hbeta)', 'EW(Halpha)'] #Generate the good columns line_labels = zeros(len(wavelength)).astype(str) for i in range(len(wavelength)): wave = wavelength[i] ions = unique(old_df.line_label[(old_df.wavelength == wave)].values) line_labels[i] = str(wave) + '_'+ ions[0] #Create dataframe new_df = pd.DataFrame(columns = list(line_labels) + physical_param, index=regions_list) #Add error column for column in new_df.columns.values: new_df.insert(new_df.columns.get_loc(column) + 1, column + '_error', nan) #Transfer data from old df to the new for i in range(len(old_df)): region = old_df.iloc[i].name wave = old_df.iloc[i].wavelength check_err = old_df.iloc[i].flux_label
from numpy import object_ import pyneb as pn import pandas as pd from string import ascii_uppercase from dazer_methods import Dazer from collections import OrderedDict from uncertainties import UFloat, unumpy #Generate dazer object dz = Dazer() sciData_address = '/home/vital/Dropbox/Astrophysics/Data/WHT_observations_BackUp/WHT_Galaxies_properties.xlsx' sciData_saving_test = '/home/vital/Dropbox/Astrophysics/Data/WHT_observations_BackUp/WHT_Galaxies_properties_saveTest.xlsx' catalogue_sheetDF = dz.load_excel_DF(sciData_address) # for coso in dz.ipExcel_sheetColumns: # print coso, dz.ipExcel_sheetColumns[coso] # # print catalogue_sheetDF.columns.values # print catalogue_sheetDF['Code1'] # catalogue_sheetDF['Code3'] = unumpy.uarray(catalogue_sheetDF.Code1.values, catalogue_sheetDF.Code2.values) # catalogue_sheetDF['Code4'] = unumpy.uarray(catalogue_sheetDF.Code1.values, catalogue_sheetDF.Code2.values) # # dz.ipExcel_sheetColumns['Data_Properties'].append('Code3') # dz.ipExcel_sheetColumns['Data_Properties'].append('Code4') dz.save_excel_DF(catalogue_sheetDF, sciData_saving_test, df_sheet_format = 'catalogue_data')
lines_log_format_address = 'C:\\Users\\Vital\\PycharmProjects\\dazer\\format\\emlines_pyneb_optical_infrared.dz' whtDataFile = 'E:\\Dropbox\\Astrophysics\\Data\\WHT_observations\\WHT_Galaxies_properties.xlsx' output_folder = 'E:\\Dropbox\\Astrophysics\\Data\\WHT_observations\\objects\\' saving_folder = 'E:\\Dropbox\\Astrophysics\\Papers\\Yp_BayesianMethodology\\source files\\images\\' lines_log_format_headers = ['line_label', 'ion', 'lambda_theo', 'latex_format'] lines_df = read_csv(lines_log_format_address, index_col=0, names=lines_log_format_headers, delim_whitespace=True) # linformat_df = read_csv(lines_log_format_address, names=['line_label', 'ion', 'lambda_theo', 'latex_format'], delim_whitespace=True) # Load catalogue dataframe catalogue_dict = dz.import_catalogue() catalogue_df = dz.load_excel_DF(whtDataFile) norm_factor = 100 # Treatment add quick index dz.quick_indexing(catalogue_df) # Declare data for the analisis AbundancesFileExtension = '_' + catalogue_dict[ 'Datatype'] + '_linesLog_reduc.txt' # Reddening properties R_v = 3.4 red_curve = 'G03_average' cHbeta_type = 'cHbeta_emis' # Define table properties
from dazer_methods import Dazer from numpy import nanmean, nanstd, mean, nan as np_nan, zeros from uncertainties import ufloat, unumpy import pandas as pd #Generate dazer object dz = Dazer() #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' ) ICF_IR_df = dz.load_excel_DF( '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/data/SIV_ICF_literature.xlsx' ) dz.quick_indexing(catalogue_df) idcs = (pd.notnull(catalogue_df.TeSIII_emis2nd)) & (pd.notnull( catalogue_df.ICF_SIV_emis2nd)) & (catalogue_df.quick_index.notnull()) idcs_oxygen = (pd.notnull(catalogue_df.OI_HI_emis2nd)) & (pd.notnull( catalogue_df.OII_HII_emis2nd)) & (catalogue_df.quick_index.notnull()) for index in catalogue_df.index: print 'Troleo', index, catalogue_df.loc[index, 'ICF_SIV_emis2nd'] #Define plot frame and colors size_dict = { 'axes.labelsize': 35, 'legend.fontsize': 22,