def __init__(self): #Import Dazer_Files Class to import data from lines_logs Nebular_Bayesian.__init__(self) Txt_Files_Manager.__init__(self) self.Hydrogen_CollCoeff_TableAddress = '/home/vital/git/Dazer/Dazer/dazer/libraries/Astro_Libraries/Neutral_Hydrogen_Collisional_Correction_coef.txt' self.Helium_CollCoeff_TableAddress = '/home/vital/git/Dazer/Dazer/dazer/libraries/Astro_Libraries/Neutral_Helium_Collisional_Correction_coef.txt' self.Helium_OpticalDepth_TableAddress = '/home/vital/git/Dazer/Dazer/dazer/libraries/Astro_Libraries/Helium_OpticalDepthFunction_Coefficients.txt' #Declare Hydrogen and Helium lines for the analysis self.posHydrogen_Lines = ['H1_4102A', 'H1_4340A', 'H1_4861A', 'H1_6563A'] self.Hydrogen_Wavelengths = [4101.742, 4340.471, 4862.683, 6562.819] self.posHelium_Lines = ['He1_3889A', 'He1_4026A', 'He1_4387A', 'He1_4471A', 'He1_4686A', 'He1_4714A', 'He1_4922A', 'He1_5876A', 'He1_6678A', 'He1_7065A', 'He1_7281A', 'He1_10830A'] self.Helium_Wavelengths = [3889.0, 4026.0, 4387.0, 4471.0, 4686.0, 4714.0, 4922.0, 5876.0, 6678.0, 7065.0, 7281.0, 10830.0] self.Cand_Hydrogen_Lines = [] self.Cand_Helium_Lines = [] self.nHydrogen = None self.nHelium = None #Define indexes and labels to speed up the code self.H13889A_label = 'H1_3889A' self.HBeta_label = 'H1_4861A' self.He3889_label = 'He1_3889A' self.He3889_Check = None #Set up the right emissivities pn.atomicData.setDataFile('he_i_rec_Pal12-Pal13.fits') #Declare pyneb Hydrogen and Helium atoms to calculate emissivities self.H1 = pn.RecAtom('H', 1) self.He1 = pn.RecAtom('He', 1) #Import collisional coefficients table self.Coef_Kalpha_dict = self.Import_Coll_Coeff_Table(self.posHydrogen_Lines, None) #Import Optical depth function self.Coef_ftau_dict = self.Import_OpticalDepth_Coeff_Table(self.posHelium_Lines) #Declare dictionaries to store the data self.Flux_dict = OrderedDict() self.Error_dict = OrderedDict() self.Wave_dict = OrderedDict() self.PynebCode_dict = OrderedDict() self.EqW_dict = OrderedDict() self.EqWerror_dict = OrderedDict() self.hlambda_dict = OrderedDict() self.flambda_dict = self.get_flambda_dict(self.posHydrogen_Lines + self.posHelium_Lines, self.Hydrogen_Wavelengths + self.Helium_Wavelengths) #flambda does not form part of the inference predictions
#!/usr/bin/env python import pymc import numpy as np from dazer_methods import Dazer from scipy.interpolate import interp1d from libraries.Astro_Libraries.Nebular_Continuum import Nebular_Bayesian from lmfit.models import LinearModel #Declare code classes dz = Dazer() nb = Nebular_Bayesian() #Declare data to treat Catalogue_Dic = dz.import_catalogue() nebular_exten = '_NebularContinuum.fits' Stellar_ext = '_StellarContinuum.fits' emitting_ext = '_Emission.fits' cHbeta_type = 'cHBeta_red' AbundancesFileExtension = '_' + Catalogue_Dic['Datatype'] + '_emission_LinesLog_v3.txt' #First data log for reduced spectra #Find and organize files from terminal command or .py file FilesList = dz.Folder_Explorer(Stellar_ext, Catalogue_Dic['Obj_Folder'], CheckComputer=False) catalogue_frame = dz.load_catalogue_frame(FilesList) # # print catalogue_frame # # #Define plot frame and colors dz.FigConf(n_colors=5, fontsize=30) # # lineal_mod = LinearModel(prefix='lineal_')
import pymc import pyneb as pn import numpy as np from dazer_methods import Dazer from scipy.interpolate import interp1d from libraries.Astro_Libraries.Nebular_Continuum import Nebular_Bayesian from lmfit.models import LinearModel H1 = pn.RecAtom('H', 1) print H1.getEmissivity(tem=10000, den=100, wave=6563) / H1.getEmissivity(tem=10000, den=100, wave=4861) #Declare code classes dz = Dazer() nb = Nebular_Bayesian() #Define plot frame and colors dz.FigConf(n_colors=5) nb.ObjectData_dict = {} nb.ObjectData_dict['nHeII_HII'] = 0.075 nb.ObjectData_dict['TOIII'] = 10000 nb.ObjectData_dict['TOIII_error'] = 500.0 nb.ObjectData_dict['Flux_Hbeta_Normalize'] = 2.86 * 1e-14 / 1e-14 nb.ObjectData_dict['Error_Hbeta_Normalize'] = 0.05 * 1e-14 / 1e-14 wave = np.linspace(3500, 7000, 7000 - 3500 - 1) nebular_flux_n = nb.Calculate_Nebular_gamma(nb.ObjectData_dict['TOIII'], nb.ObjectData_dict['Flux_Hbeta_Normalize'], nb.ObjectData_dict['nHeII_HII'] , 0.00, wave) dz.data_plot(wave, nebular_flux_n, 'Nebular flux normalized', dz.ColorVector[2][1])