logS2HI = nplog10((Line_dict['9068.62A'] + Line_dict['9532A']) / Line_dict['4861.36A']) + 6.012 + 0.6309 / TSIII_4 - 0.5722 * nplog10(TSIII_4) -12 logAr3HI = nplog10(Line_dict['4740.12A'] / Line_dict['4861.36A']) + 5.705 + 1.246/TOIII_4 - 0.156 * nplog10(TOIII_4) - 12 logAr2HI = nplog10(Line_dict['7135A'] / Line_dict['4861.36A']) + 6.157 + 0.808/TSIII_4 - 0.508 * nplog10(TSIII_4) - 12 x_axis = logS2HI - logS3HI y_axis = logAr2HI - logAr3HI indexes = x_axis>0.0 return x_axis[indexes], y_axis[indexes], TSIII[indexes], TOIII[indexes] pv = myPickle() dz = Plot_Conf() ct = Cloudy_Tools() diags = pn.Diagnostics() #Define data type and location Catalogue_Dic = DataToTreat() Pattern = Catalogue_Dic['Datatype'] + '.fits' FilesList = pv.Folder_Explorer(Pattern, Catalogue_Dic['Obj_Folder'], CheckComputer=False) Abundances_Matrix = import_data_from_objLog_triple(FilesList, pv) Objects = Abundances_Matrix[:,0] ArIII_HII_array = Abundances_Matrix[:,1] ArIV_HII_array = Abundances_Matrix[:,2] Temps = Abundances_Matrix[:,3] SIII_HII_array = Abundances_Matrix[:,4]
for j in range(len(List_Abundances)): abundance = List_Abundances[j] Empty_Array[j+1] = pv.GetParameter_ObjLog(CodeName, FileFolder, Parameter = abundance, Assumption = 'float') #If the abundance was measure store it if Empty_Array[j+1] == None: All_observed = False if All_observed: Valid_objects.append(array(Empty_Array, copy=True)) return array(Valid_objects) pv = myPickle() dz = Plot_Conf() ct = Cloudy_Tools() #Define data type and location Catalogue_Dic = DataToTreat() Pattern = Catalogue_Dic['Datatype'] + '.fits' #Define figure format dz.FigConf(n_colors=6) #Define script name and location ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Few_Models/' ScriptPrefix = 'S_Ar_test' #4 metallicities 0.004, 0.008, 0.02, 0.05 #5 ages 5.0, 5.5, 6.0, 6.5, 7.0, 7.5 Model_dict, Legends_dict, Colors_dict = Figure_Legends_Colors(dz.ColorVector)
for j in range(len(List_Abundances)): abundance = List_Abundances[j] Empty_Array[j+1] = pv.GetParameter_ObjLog(CodeName, FileFolder, Parameter = abundance, Assumption = 'float') #If the abundance was measure store it if Empty_Array[j+1] == None: All_observed = False if All_observed: Valid_objects.append(array(Empty_Array, copy=True)) return array(Valid_objects) pv = myPickle() dz = Plot_Conf() ct = Cloudy_Tools() diags = pn.Diagnostics() #Define data type and location Catalogue_Dic = DataToTreat() Pattern = Catalogue_Dic['Datatype'] + '.fits' #Define figure format dz.FigConf(n_colors=3) print 'Colors initial' print dz.ColorVector[2], len(dz.ColorVector[2]) #Define script name and location # ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Few_Models/' ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Ionization_Models/'
from collections import OrderedDict from numpy import log10 as nplog10, zeros, min, max, linspace, array, concatenate, isfinite, greater from pandas import Series from Math_Libraries.bces_script import bces from Plotting_Libraries.dazer_plotter import Plot_Conf from cloudy_library.cloudy_methods import Cloudy_Tools dz = Plot_Conf() ct = Cloudy_Tools() #Define script name and location ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Ionization_Models_Hbeta_trans/' #Orion nebula has a metallicity of 2/3 solar Grid_Values = OrderedDict() Grid_Values['age'] = ['5.0', '5.5', '6.0', '6.5', '7.0', '7.5'] Grid_Values['zStars'] = ['-2.4', '-2.1', '-1.7', '-1.31'] Grid_Values['zGas'] = ['0.1', '0.31', '0.62'] Grid_Values['u'] = ['-4.0', '-3.5', '-3.0', '-2.5', '-2.0', '-1.5'] #Dictionary of dictionaries Grid_frame = ({k : Series(v) for k, v in Grid_Values.iteritems()}) #Trick to create a frame with different lengths # Grid_frame = DataFrame({k : Series(v) for k, v in Grid_Values.iteritems()}) #Generate the scripts with the lines we want to print the flux
FilesFolder = '/home/vital/Dropbox/Astrophysics/Lore/PopStar/' TableAddressn100 = 'mnras0403-2012-SD2_clusterTable2.txt' Frame_MetalsEmission = pd.read_csv(FilesFolder + TableAddressn100, delim_whitespace = True) nH = 10.0 #cm^-3 c = 29979245800.0 #cm/s pc_to_cm = 3.0856776e18 #cm/pc Frame_MetalsEmission['logR_cm'] = nplog10(Frame_MetalsEmission['logR'] * pc_to_cm) Frame_MetalsEmission['Q'] = nplog10(power(10, Frame_MetalsEmission['logU']) * 4 * pi * c * nH * power(Frame_MetalsEmission['logR'] * pc_to_cm, 2)) return Frame_MetalsEmission ct = Cloudy_Tools() #Define script name and location ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Total_Q_R_Grid/' Grid_Values = OrderedDict() Grid_Values['age'] = ['5.', '5.48', '5.7', '5.85', '6.', '6.18', '6.3', '6.4', '6.51', '6.57', '6.63', '6.68', '6.72' ] Grid_Values['clus_mass'] = ['12000.', '20000.', '60000.', '100000.', '200000.'] Grid_Values['zGas'] = ['0.0001', '0.0004', '0.004', '0.008'] Grid_Values['zStars'] = ['-2.1'] # Grid_Values = OrderedDict() # Grid_Values['age'] = ['5.'] # Grid_Values['clus_mass'] = ['100000.', '150000.', '200000.'] # Grid_Values['zGas'] = ['0.0001', '0.0004', '0.004', '0.008'] # Grid_Values['zStars'] = ['-2.1']
from numpy import log10 as nplog10 from collections import OrderedDict from pandas import Series from cloudy_library.cloudy_methods import Cloudy_Tools ct = Cloudy_Tools() #Define script name and location ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Total_Grid_SAL2/' #Orion nebula has a metallicity of 2/3 solar Grid_Values = OrderedDict() Solar_abundances = OrderedDict() Solar_abundances['Li'] = -8.69 Solar_abundances['Be'] = -10.58 Solar_abundances['B'] = -9.21 Solar_abundances['C'] = -3.61 Solar_abundances['N'] = -4.07 Solar_abundances['O'] = -3.31 Solar_abundances['Ne'] = -4.00 Solar_abundances['F'] = -7.52 Solar_abundances['Ne'] = -4.0 Solar_abundances['Na'] = -5.67 Solar_abundances['Mg'] = -4.46 Solar_abundances['Al'] = -5.53 Solar_abundances['Si'] = -4.46 Solar_abundances['P'] = -6.50 Solar_abundances['S'] = -4.74 Solar_abundances['Cl'] = -6.72 Solar_abundances['Ar'] = -5.60
S3_abund = S3_atom.getIonAbundance(int_ratio = (Line_dict['9068.62A'] + Line_dict['9532A']), tem=TSIII, den=NSII, to_eval = 'L(9069)+L(9531)', Hbeta = Line_dict['4861.36A']) S4_abund = S4_atom.getIonAbundance(int_ratio = (Line_dict['10.51m']), tem=TOIII, den=NSII_2, wave = 105000., Hbeta = Line_dict['4861.36A']) #Calculate the logaritmic axis for the plot x_axis = nplog10(Ar4_abund/Ar3_abund) y_axis = nplog10(S4_abund/S3_abund) if (isinf(x_axis) == False) & (isinf(y_axis) == False): return x_axis, y_axis else: return None, None dz = Plot_Conf() ct = Cloudy_Tools() diags = pn.Diagnostics() #Set atomic data and objects pn.atomicData.setDataFile('s_iii_coll_HRS12.dat') diags = pn.Diagnostics() Ar3 = pn.Atom('Ar', 3) Ar4 = pn.Atom('Ar', 4) S3 = pn.Atom('S', 3) S4 = pn.Atom('S', 4) #Declare the number of colors dz.FigConf(n_colors = 7) #Define script name and location ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Total_Q_R_Grid2/'
wave=105000., Hbeta=Line_dict['4861.36A']) #Calculate the logaritmic axis for the plot x_axis = nplog10(Ar4_abund / Ar3_abund) y_axis = nplog10(S4_abund / S3_abund) if (isinf(x_axis) == False) & (isinf(y_axis) == False): return x_axis, y_axis else: return None, None dz = Plot_Conf() ct = Cloudy_Tools() diags = pn.Diagnostics() #Set atomic data and objects pn.atomicData.setDataFile('s_iii_coll_HRS12.dat') diags = pn.Diagnostics() Ar3 = pn.Atom('Ar', 3) Ar4 = pn.Atom('Ar', 4) S3 = pn.Atom('S', 3) S4 = pn.Atom('S', 4) colors_list = [ '#0072B2', '#009E73', '#D55E00', '#CC79A7', '#F0E442', '#56B4E9', '#bcbd22', '#7f7f7f', '#FFB5B8' ]
for j in range(len(List_Abundances)): abundance = List_Abundances[j] Empty_Array[j+1] = pv.GetParameter_ObjLog(CodeName, FileFolder, Parameter = abundance, Assumption = 'float') #If the abundance was measure store it if Empty_Array[j+1] == None: All_observed = False if All_observed: Valid_objects.append(array(Empty_Array, copy=True)) return array(Valid_objects) pv = myPickle() dz = Plot_Conf() ct = Cloudy_Tools() diags = pn.Diagnostics() #Define data type and location Catalogue_Dic = DataToTreat() Pattern = Catalogue_Dic['Datatype'] + '.fits' #Define figure format dz.FigConf(n_colors=6) #Define script name and location # ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Few_Models/' ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Ionization_Models_Hbeta/' ScriptPrefix = 'S_Ar_test' #4 metallicities 0.004, 0.008, 0.02, 0.05