Wave_dict['Hbeta']      = '4_2' 
Wave_dict['S3_10.5m']   = 105000 
  
#Define physical conditions
tem         = 10000
tem_range   = linspace(5000, 25000, 1000)
den         = 100
  
#Emissivities ranges
Hbeta_emis    = HI.getEmissivity(tem = tem_range, den = den, label = Wave_dict['Hbeta'])
S4_105m_emis  = S4.getEmissivity(tem = tem_range, den = den, wave = Wave_dict['S3_10.5m'])
t4_range      = tem_range/10000
  
#Plotting Pyneb Emis vs Temp
S4_emis_vector_pyneb    = log10((S4_105m_emis)/Hbeta_emis)
dz.data_plot(tem_range, S4_emis_vector_pyneb, label='PyNeb value: S4')
  
#Fitting characteristics
p_1, conv_curFit = Fitting_Emissivity(t4_range, S4_emis_vector_pyneb, A_0, B_0, C_0)
  
print 'Initial values', A_0, B_0, C_0
print 'Guessed values', p_1
  
#New fitting values
Vit_Emis = p_1[0] + p_1[1]/t4_range + p_1[2] * log10(t4_range)
dz.data_plot(tem_range, Vit_Emis, label='Vital fitting')
  
#Plot wording
xtitle  = r'$T_{e}$ $(K)$'
ytitle  = r'$log\left(\frac{E_{\left[SIII\right]9069}}{E_{H\beta}}\right)$'
title   = r'Sulfur emissivity comparison: 9069$\AA$ line, $ n_e = $' + str(den)
Exemple #2
0
                                      'Eqw',
                                      LinesLog_suffix='_txt_LinesLog_v3.txt')

        if Eqw == None:
            Age_dict[H_line][i] = Age
            Eqw_dict[H_line][i] = None
        else:
            Age_dict[H_line][i] = Age
            Eqw_dict[H_line][i] = Eqw * -1

#Generate plot
for k in range(len(H_Lines)):
    line = H_Lines[k]
    label = line.replace('_', ' ')

    dz.data_plot(Age_dict[line], Eqw_dict[line], label=label, markerstyle='o')

#Define figure wording
xtitle = r'Age $(Myr)$'
ytitle = r'Ew $(\AA)$'
title = 'Starburst recombination lines absorption Ew evolution'
dz.FigWording(xtitle,
              ytitle,
              title,
              axis_Size=30,
              title_Size=30,
              legend_size=25,
              legend_loc='best')
dz.Axis.set_xlim(0, 120)

#save_fig
print "longitudes", len(Objects), len(ArIII_HII_array), len(ArIV_HII_array), len(Temps), len(SIII_HII_array)

logArII_ArIII = umlog10(ArIII_HII_array / ArIV_HII_array)


for key in Model_dict.keys():

    # Declare scripting name
    ScriptName = ScriptPrefix + key + ".in"

    # Generate lines dictionary with the output data
    Line_dict = ct.load_predicted_lines(ScriptName, ScriptFolder)

    x_values, y_values, TSIII, TOIII = Ar_S_model(Line_dict, diags)
    #     dz.data_plot(x_values, y_values, color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')
    dz.data_plot(TSIII, y_values, color=Colors_dict[key], label=Legends_dict[key], markerstyle="o")

    list_xvalues = concatenate([list_xvalues, x_values])
    list_yvalues = concatenate([list_yvalues, y_values])
    list_TSIII = concatenate([list_TSIII, TSIII])
    list_TOIII = concatenate([list_TOIII, TOIII])

Not_infinite = isfinite(list_yvalues)

list_xvalues_clean = list_xvalues[Not_infinite]
list_yvalues_clean = list_yvalues[Not_infinite]
list_TSIII_clean = list_TSIII[Not_infinite]

list_xvalues_Above = greater(list_xvalues_clean, 0)

list_xvalues_clean_greater = list_xvalues_clean[list_xvalues_Above]
logArII_ArIII = umlog10(ArIII_HII_array / ArIV_HII_array)

for key in Model_dict.keys():

    #Declare scripting name
    ScriptName = ScriptPrefix + key + '.in'

    #Generate lines dictionary with the output data
    Line_dict = ct.load_predicted_lines(ScriptName, ScriptFolder)

    x_values, y_values, TSIII, TOIII = Ar_S_model(Line_dict, diags)
    #     dz.data_plot(x_values, y_values, color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')
    dz.data_plot(TSIII,
                 y_values,
                 color=Colors_dict[key],
                 label=Legends_dict[key],
                 markerstyle='o')

    list_xvalues = concatenate([list_xvalues, x_values])
    list_yvalues = concatenate([list_yvalues, y_values])
    list_TSIII = concatenate([list_TSIII, TSIII])
    list_TOIII = concatenate([list_TOIII, TOIII])

Not_infinite = isfinite(list_yvalues)

list_xvalues_clean = list_xvalues[Not_infinite]
list_yvalues_clean = list_yvalues[Not_infinite]
list_TSIII_clean = list_TSIII[Not_infinite]

list_xvalues_Above = greater(list_xvalues_clean, 0)
            #Get gradients
            cHbeta_all_MagEr, n_all_MagEr = LinfitLinearRegression(
                x_BlueRed, y_BlueRed)
            cHbeta_NoError, n_NoError = NumpyRegression(
                x_BlueRed, unumpy.nominal_values(y_BlueRed))

            #Trendline with all points and error
            Trendline_all = cHbeta_all_MagEr * x_BlueRed + n_all_MagEr

        #Trendline for he case we do not consider the error
        y_NoError_trend = cHbeta_NoError * x_BlueRed + n_NoError

        #Plot the data
        dz.data_plot(x_Blue,
                     unumpy.nominal_values(y_Blue),
                     label='Blue arm emission lines',
                     markerstyle='^',
                     y_error=unumpy.std_devs(y_Blue))
        dz.data_plot(x_BlueRed,
                     unumpy.nominal_values(Trendline_all),
                     label='Trend line: Including errors',
                     linestyle=':')
        dz.data_plot(x_Red,
                     unumpy.nominal_values(y_Red),
                     label='Red arm emission lines',
                     markerstyle='o',
                     y_error=unumpy.std_devs(y_Red))
        dz.data_plot(x_BlueRed,
                     unumpy.nominal_values(y_NoError_trend),
                     label='Trend line: Without including error',
                     linestyle='--')
Wave_dict['O3_5007A']   = 5007 

#Define physical conditions
tem         = 10000
tem_range   = linspace(5000, 25000, 1000)
den         = 100
 
#Emissivities ranges
Hbeta_emis              = HI.getEmissivity(tem = tem_range,   den = den, label = Wave_dict['Hbeta'])
S3_9069A_emis           = S3.getEmissivity(tem = tem_range, den = den, wave = Wave_dict['O3_4959A'])
S3_9531A_emis           = S3.getEmissivity(tem = tem_range, den = den, wave = Wave_dict['O3_5007A'])
t4_range                = tem_range/10000

#Plotting Pyneb Emis vs Temp
S3_emis_vector_pyneb    = log10((S3_9069A_emis + S3_9531A_emis)/Hbeta_emis)
dz.data_plot(tem_range, S3_emis_vector_pyneb, label='PyNeb Emissivity')

#Plotting Hagele Emis vs temp
Ep_Emis = 12 - 6.1868 - 1.2491/t4_range + 0.5816 * log10(t4_range)
dz.data_plot(tem_range, Ep_Emis, label='Enrique Perez Emissivity')

#Plot wording
xtitle  = r'$T_{e}$ $(K)$'
ytitle  = r'$log(E_{O^{2+}}/E_{H^{+}})$'
title   = r'Oxygen emissivity comparison, $ n_e = $' + str(den)
dz.FigWording(xtitle, ytitle, title, axis_Size = 20.0, title_Size = 20.0, legend_size=20.0)
 
#Display figure
dz.display_fig()
  
print 'Data treated'
                #Coloring scheme
                parameter_divider = zGas
                color = Grid_Values['zGas'].index(parameter_divider)
                label = r'$Z = {logage}$'.format(logage=Model_dict['zGas'])

                #Calculate the grid point abundances
                #x_values, y_values         = Ar_S_model(Line_dict, threshold = 4, z = float(Model_dict['zGas']))
                x_values, y_values = Ar_S_abundances_model(
                    Line_dict, diags, Ar3, Ar4, S3, S4, 3)

                if (x_values != None) and (y_values != None):
                    #color=dz.ColorVector[2][color],
                    dz.data_plot(x_values,
                                 y_values,
                                 label=label,
                                 markerstyle='o',
                                 color=colors_list[color])

                    x_linealFitting = hstack([x_linealFitting, x_values])
                    y_linealFitting = hstack([y_linealFitting, y_values])

#Lineal model
lineal_mod = LinearModel(prefix='lineal_')
Lineal_parameters = lineal_mod.guess(y_linealFitting, x=x_linealFitting)
x_lineal = linspace(0, np_max(x_linealFitting), 100)
y_lineal = Lineal_parameters[
    'lineal_slope'].value * x_lineal + Lineal_parameters[
        'lineal_intercept'].value
dz.data_plot(x_lineal,
             y_lineal,
           
        Eqw = pv.GetParameter_LineLog(CodeName, FileFolder, H_line, 'Eqw', LinesLog_suffix='_txt_LinesLog_v3.txt')
         
        if Eqw == None:
            Age_dict[H_line][i] = Age
            Eqw_dict[H_line][i] = None
        else:
            Age_dict[H_line][i] = Age
            Eqw_dict[H_line][i] = Eqw * -1
             
#Generate plot
for k in range(len(H_Lines)):
    line    = H_Lines[k]
    label   = line.replace('_',' ')
        
    dz.data_plot(Age_dict[line], Eqw_dict[line], label=label, markerstyle='o')
   
    
#Define figure wording
xtitle  = r'Age $(Myr)$'
ytitle  = r'Ew $(\AA)$'
title   = 'Starburst recombination lines absorption Ew evolution'
dz.FigWording(xtitle, ytitle, title, axis_Size=30, title_Size=30, legend_size=25, legend_loc='best')
dz.Axis.set_xlim(0, 120)

#save_fig
dz.display_fig()
dz.savefig('/home/vital/Dropbox/Astrophysics/Seminars/GTC_conference_2015/EWevolutin', extension='.eps')


# #-----------------------------------------STARBURST EQUIVALENT WIDTH Normalized Hydrogen EVOLUTION----------------------------------------
            z_values.append(0)
            g_mags.append(12)
            r_mags.append(12)
            



#------Plot magnitudes

x_values    = array(r_mags)
y_values    = array(g_mags)

dz.Axis.set_xlim(12 , 22)
dz.Axis.set_ylim(12 , 22)

dz.data_plot(x_values, y_values, color = dz.ColorVector[2][0], label='Candidate objects', markerstyle='o')
dz.text_plot(names, x_values, y_values, color = dz.ColorVector[1], fontsize = 11)
dz.Axis.axhline(y = 20, color=dz.ColorVector[2][1])
dz.Axis.axvline(x = 19, color=dz.ColorVector[2][1])

Title   = r'Sample SDSS model magnitudes' 
Title_X = r'r $(model)$'
Title_Y = r'g $(model)$'
dz.FigWording(Title_X, Title_Y, Title, legend_loc='best')
dz.savefig(output_address = Catalogue_Dic['Data_Folder'] + 'g_r_magnitudes', reset_fig = True)


#------Plot magnitudes

x_values    = array(Hbeta_values)
y_values    = array(Declination_values)
 
den = 100
den_range = linspace(10, 300, 100)

# Comment the second if you want all the lines to be plotted
# S_Lines=[105100, 1404.81, 1423.84, 1398.04, 1416.89, 290100.0, 1387.46, 1406.02, 112300, 183200]
# S_Lines=[1404.81, 1423.84, 1416.89, 1406.02, 112300]
S_Lines=[105000]


#--------------------------Density case----------------------------------
#Plot the lines
for line in S_Lines:
    y           = S4.getEmissivity(tem, den_range, wave = line)
    y_1000_100  = S4.getEmissivity(tem, den, wave = line)
    dz.data_plot(den_range, y/y_1000_100, label=str(line) + r' $\AA$ line')
    
# dz.Axis.set_xscale('log')
dz.Axis.tick_params(axis='both', labelsize=20.0)
dz.Axis.set_ylim(0.0,2.5)
# dz.Axis.patch.set_facecolor('white')
# dz.Fig.set_facecolor('black')
# dz.Fig.set_edgecolor('black')

#Plot wording
xtitle  = r'$n_{e}$ $(cm^{-3})$'
# ytitle  = r'j(T) [erg cm$^{-3}$ s${-1}$]'
ytitle  = 'Relative emissivity'
title   = 'HeI emissivities @ $T_e$={:.0f}'.format(tem)
dz.FigWording(xtitle, ytitle, title, axis_Size = 20.0, title_Size = 20.0, legend_size=20.0)
Exemple #11
0
                Line_dict = ct.load_predicted_lines_individual(
                    ScriptName, ScriptFolder)

                #Coloring scheme
                parameter_divider = zGas
                color = Grid_Values['zGas'].index(parameter_divider)
                label = r'$Z = {logage}$'.format(
                    logage=round(float(parameter_divider) * 0.02, 3))

                x_values, y_values = Ar_S_model(Line_dict, threshold=4)

                if (x_values != None) and (y_values != None):

                    dz.data_plot(x_values,
                                 y_values,
                                 color=dz.ColorVector[2][color],
                                 label=label,
                                 markerstyle='o')

                    x_linealFitting = hstack([x_linealFitting, x_values])
                    y_linealFitting = hstack([y_linealFitting, y_values])

#Lineal model
lineal_mod = LinearModel(prefix='lineal_')
Lineal_parameters = lineal_mod.guess(y_linealFitting, x=x_linealFitting)
x_lineal = linspace(np_min(x_linealFitting), np_max(x_linealFitting), 100)
y_lineal = Lineal_parameters[
    'lineal_slope'].value * x_lineal + Lineal_parameters[
        'lineal_intercept'].value
dz.data_plot(x_lineal,
             y_lineal,
     
    #Get stellar continuum
    StellarContinuumFits = CodeName + '_StellarContinuum.fits'
    Wave_Stellar, Int_Stellar, ExtraData        = pv.File2Data(FileFolder, StellarContinuumFits)
     
    Wave_StellarExtension                       = linspace(3000.0,3399.0,200)
    Int_StellarExtension                        = zeros(len(Wave_StellarExtension))
     
    Int_Stellar                                 = hstack((Int_StellarExtension,      Int_Stellar))
    Wave_Stellar                                = hstack((Wave_StellarExtension,    Wave_Stellar))
     
    Interpolation                               = interp1d(Wave_Stellar, Int_Stellar, kind = 'slinear')        
    Int_Stellar_Resampled                       = Interpolation(Wave)
     
    #Plotting the data:
    dz.data_plot(Wave, Flux, label = 'Dereddened spectrum')
    dz.data_plot(Wave, NebularFlux, label = 'Nebular spectrum')
    dz.data_plot(Wave_Stellar, Int_Stellar, label = 'Stellar spectrum', linestyle='--')
    dz.data_plot(Wave, Int_Stellar_Resampled + NebularFlux, label = 'Stellar + Nebular components')
    
#     dz.InsertFigure(FileFolder,  CodeName + '.png')
    
    arr_hand = read_png(FileFolder + CodeName + '.png')
    Image_Frame = OffsetImage(arr_hand, zoom=3)
    ab = AnnotationBbox(Image_Frame, [0.865,0.8], xybox=(10,-10), xycoords='figure fraction', boxcoords="offset points")
    dz.Axis.add_artist(ab)    
    
    dz.Axis.set_xlim(3600.0, 3900)
    dz.Axis.set_ylim(0, 1e-15)
    #Set plot labels
    title   = r'SHOC579 spectrum components$'
Legend_Global = 'PopStar Models:\n z = 0.004, 0.008, 0.02, 0.05,\n log(age) = 5.0, 5.5, 6.0, 6.5, 7.0, 7.5'

#----Models data
for key in Model_dict.keys():
    
    #Declare scripting name
    ScriptName = ScriptPrefix + key + '.in'
    
    #Generate the script
    ct.select_script('Argon_Sulfur_LinesModel_Ages', ScriptName, ScriptFolder, key = key, data_dict=Model_dict)
      
    #Generate lines dictionary with the output data
    Line_dict = ct.load_predicted_lines(ScriptName, ScriptFolder)
    
    x_values, y_values, TSIII, TOIII = Ar_S_model(Line_dict)
    dz.data_plot(x_values, TSIII,  color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')

    list_xvalues    = concatenate([list_xvalues, x_values])
    list_yvalues    = concatenate([list_yvalues, y_values])
    list_TSIII      = concatenate([list_TSIII, TSIII])
    list_TOIII      = concatenate([list_TOIII, TOIII])

Not_infinite = isfinite(list_yvalues)

list_xvalues_clean  = list_xvalues[Not_infinite]
list_yvalues_clean  = list_yvalues[Not_infinite]
list_TSIII_clean    = list_TSIII[Not_infinite]

list_xvalues_Above  = greater(list_xvalues_clean, -3)

list_xvalues_clean_greater  = list_xvalues_clean[list_xvalues_Above]
lambda_angs, incident, trans, diff_Out, net_trans, reflc, total = loadtxt(
    FilesFolder + File_con,
    skiprows=0,
    usecols=(0, 1, 2, 3, 4, 5, 6),
    unpack=True)
lambda_angs, incident, trans, diff_Out, net_trans, reflc, total = lambda_angs[::
                                                                              -1], incident[::
                                                                                            -1], trans[::
                                                                                                       -1], diff_Out[::
                                                                                                                     -1], net_trans[::
                                                                                                                                    -1], reflc[::
                                                                                                                                               -1], total[::
                                                                                                                                                          -1]

#Plotting .con continua
dz.data_plot(lambda_angs, incident, label='Incident continuum', linestyle='-')
# dz.data_plot(lambda_angs, trans, label='Transmitted continuum')
dz.data_plot(lambda_angs,
             net_trans,
             label='Net transmitted continuum',
             linestyle='-')
# dz.data_plot(lambda_angs, reflc, label='Reflected continuum', linestyle=':')
# dz.data_plot(lambda_angs, total, label='Total continuum', linestyle='--')

#Importing the punch emission
# lambda_angs, Flux_trans = loadtxt(FilesFolder + File_trans_punch, skiprows = 9, usecols = (0, 1), unpack = True)
# lambda_angsI, Flux_inci = loadtxt(FilesFolder + File_inci_punch, skiprows = 9, usecols = (0, 1), unpack = True)
# dz.data_plot(lambda_angs, Flux_trans, label='Transmitted punch', linestyle='--')
# dz.data_plot(lambda_angsI, Flux_inci, label='Incident punch', linestyle='--')

#Declaring Halpha, Hbeta regions and continua
    #Get stellar continuum
    StellarContinuumFits = CodeName + '_StellarContinuum.fits'
    Wave_Stellar, Int_Stellar, ExtraData = pv.File2Data(
        FileFolder, StellarContinuumFits)

    Wave_StellarExtension = linspace(3000.0, 3399.0, 200)
    Int_StellarExtension = zeros(len(Wave_StellarExtension))

    Int_Stellar = hstack((Int_StellarExtension, Int_Stellar))
    Wave_Stellar = hstack((Wave_StellarExtension, Wave_Stellar))

    Interpolation = interp1d(Wave_Stellar, Int_Stellar, kind='slinear')
    Int_Stellar_Resampled = Interpolation(Wave)

    #Plotting the data:
    dz.data_plot(Wave, Flux, label='Dereddened spectrum')
    dz.data_plot(Wave, NebularFlux, label='Nebular spectrum')
    dz.data_plot(Wave_Stellar,
                 Int_Stellar,
                 label='Stellar spectrum',
                 linestyle='--')
    dz.data_plot(Wave,
                 Int_Stellar_Resampled + NebularFlux,
                 label='Stellar + Nebular components')

    #     dz.InsertFigure(FileFolder,  CodeName + '.png')

    arr_hand = read_png(FileFolder + CodeName + '.png')
    Image_Frame = OffsetImage(arr_hand, zoom=3)
    ab = AnnotationBbox(Image_Frame, [0.865, 0.8],
                        xybox=(10, -10),
SIII_HII_array              = Abundances_Matrix[:,4]   
    
logArII_ArIII               = umlog10(ArIII_HII_array/ArIV_HII_array)

for key in Model_dict.keys():
    
    #Declare scripting name
    ScriptName = ScriptPrefix + key + '.in'
    
    #Generate lines dictionary with the output data
    Line_dict = ct.load_predicted_lines(ScriptName, ScriptFolder)
    
    print key, Colors_dict[key], Legends_dict[key]

    x_values, y_values, TSIII, TOIII = Ar_S_model(Line_dict, diags)
    dz.data_plot(x_values, y_values, color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')
#     dz.data_plot(TSIII, y_values,  color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')

    list_xvalues    = concatenate([list_xvalues, x_values])
    list_yvalues    = concatenate([list_yvalues, y_values])
    list_TSIII      = concatenate([list_TSIII, TSIII])
    list_TOIII      = concatenate([list_TOIII, TOIII])

Not_infinite = isfinite(list_yvalues)

list_xvalues_clean  = list_xvalues[Not_infinite]
list_yvalues_clean  = list_yvalues[Not_infinite]
list_TSIII_clean    = list_TSIII[Not_infinite]

list_xvalues_Above  = greater(list_xvalues_clean, 0)
Exemple #17
0
      
                ScriptName                  = Model_dict['Name'] + '.in'
                Line_dict                   = ct.load_predicted_lines_individual(ScriptName, ScriptFolder)
                  
                #Coloring scheme
                parameter_divider = zGas
                color = Grid_Values['zGas'].index(parameter_divider)
                label = r'$Z = {logage}$'.format(logage = Model_dict['zGas'])
                  
                #Calculate the grid point abundances
                #x_values, y_values         = Ar_S_model(Line_dict, threshold = 4, z = float(Model_dict['zGas']))
                x_values, y_values          = Ar_S_abundances_model(Line_dict, diags, Ar3, Ar4, S3, S4, 3)
                  
                if (x_values != None) and (y_values != None):
                  
                    dz.data_plot(x_values, y_values, color=dz.ColorVector[2][color], label=label, markerstyle='o')
     
                    x_linealFitting = hstack([x_linealFitting, x_values])
                    y_linealFitting = hstack([y_linealFitting, y_values])
  
#Lineal model
lineal_mod          = LinearModel(prefix='lineal_')
Lineal_parameters   = lineal_mod.guess(y_linealFitting, x=x_linealFitting)
x_lineal            = linspace(0, np_max(x_linealFitting), 100)
y_lineal            = Lineal_parameters['lineal_slope'].value * x_lineal + Lineal_parameters['lineal_intercept'].value
dz.data_plot(x_lineal, y_lineal, label='Lineal fitting', color = 'black', linestyle='-')
  
# #Plot fitting formula
formula = r"$log\left(Ar^{{+2}}/Ar^{{+3}}\right) = {m} \cdot log\left(S^{{+2}}/S^{{+3}}\right) + {n}$".format(m=round(Lineal_parameters['lineal_slope'].value,3),
                                                                                                            n=round(Lineal_parameters['lineal_intercept'].value, 3))
dz.Axis.text(0.50, 0.15, formula, transform=dz.Axis.transAxes, fontsize=20) 
            
            #Create vector only with blue ones
            x_BlueRed, y_BlueRed                            = x_Blue, y_Blue
            
            #Get gradients
            cHbeta_all_MagEr, n_all_MagEr                   = LinfitLinearRegression(x_BlueRed, y_BlueRed)            
            cHbeta_NoError, n_NoError                       = NumpyRegression(x_BlueRed, unumpy.nominal_values(y_BlueRed))            
            
            #Trendline with all points and error
            Trendline_all                                   = cHbeta_all_MagEr * x_BlueRed + n_all_MagEr
        
        #Trendline for he case we do not consider the error
        y_NoError_trend                                     = cHbeta_NoError * x_BlueRed + n_NoError
         
        #Plot the data
        dz.data_plot(x_Blue,        unumpy.nominal_values(y_Blue), label='Blue arm emission lines', markerstyle='^', y_error=unumpy.std_devs(y_Blue))        
        dz.data_plot(x_BlueRed,     unumpy.nominal_values(Trendline_all),   label='Trend line: Including errors',  linestyle=':')
        dz.data_plot(x_Red,         unumpy.nominal_values(y_Red),  label='Red arm emission lines', markerstyle='o', y_error=unumpy.std_devs(y_Red))       
        dz.data_plot(x_BlueRed,     unumpy.nominal_values(y_NoError_trend), label='Trend line: Without including error', linestyle='--')
        
        dz.text_plot(EmLine_blue, x_Blue, unumpy.nominal_values(y_Blue), x_pad = 0.95, y_pad = 1.10, fontsize=10)
        dz.text_plot(EmLine_Red, x_Red, unumpy.nominal_values(y_Red), x_pad = 0.95, y_pad = 1.10, fontsize=10)
        #Plot the data
        #Points not used for the treatment
#         d.TextPlotter(x_outbound,  unumpy.nominal_values(y_outbound), EmLine_outBound, x_pad = 0.95, y_pad = 1)
        dz.text_plot(EmLine_outBound, x_outbound, unumpy.nominal_values(y_outbound), fontsize=10)
        #--Blue arm
#         dz.data_plot(x_Blue,   unumpy.nominal_values(y_Blue),                                          'Blue arm',         pv.Color_Vector[2][2],      YError=unumpy.std_devs(y_Blue))        
#         dz.data_plot(x_Blue,   unumpy.nominal_values(cHbeta_blue_MagEr * x_Blue + n_blue_MagEr), label='Trend line blue', linestyle=':')
         
#       #--Red arm
    m_Median, m_16th, m_84th = median(m_dict[regression]), percentile(m_dict[regression],16), percentile(m_dict[regression],84)
    
    pv.SaveParameter_ObjLog('WHT_Catalogue_properties.txt', Catalogue_Dic['Data_Folder'], Parameter = 'Yp_'+Element+'_Inf',    Magnitude = n_Median, Error = '-', Log_extension='')       
    pv.SaveParameter_ObjLog('WHT_Catalogue_properties.txt', Catalogue_Dic['Data_Folder'], Parameter = 'Yp_'+Element+'_16th_p', Magnitude = n_16th, Error = '-', Log_extension='')       
    pv.SaveParameter_ObjLog('WHT_Catalogue_properties.txt', Catalogue_Dic['Data_Folder'], Parameter = 'Yp_'+Element+'_84th_p', Magnitude = n_84th, Error = '-', Log_extension='')       
    
    pv.SaveParameter_ObjLog('WHT_Catalogue_properties.txt', Catalogue_Dic['Data_Folder'], Parameter = 'Gradient_'+Element+'_Inf',     Magnitude = m_Median, Error = '-', Log_extension='')       
    pv.SaveParameter_ObjLog('WHT_Catalogue_properties.txt', Catalogue_Dic['Data_Folder'], Parameter = 'Gradient_'+Element+'_16th_p',  Magnitude = m_16th, Error = '-', Log_extension='')       
    pv.SaveParameter_ObjLog('WHT_Catalogue_properties.txt', Catalogue_Dic['Data_Folder'], Parameter = 'Gradient_'+Element+'_84th_p',  Magnitude = m_84th, Error = '-', Log_extension='')   

    Obj_Elem, Metal_abun, Ymass_Metal = Abundances_dict[regression][0], Abundances_dict[regression][1], Abundances_dict[regression][2]
    
    #Plotting the data
    element_label = r'$Y_{{P}} = {n}_{{-{lowerlimit}}}^{{+{upperlimit}}}$'.format(n = round(n_Median,4), lowerlimit = round(n_Median-n_16th,4), upperlimit = round(n_84th-n_Median,4))

    dz.data_plot(nominal_values(Metal_abun), nominal_values(Ymass_Metal), color = dz.ColorVector[2][j], label=element_label, markerstyle='o', x_error=std_devs(Metal_abun), y_error=std_devs(Ymass_Metal))
    dz.data_plot(Y_WMAP_coord[0].nominal_value, Y_WMAP_coord[1].nominal_value, color = dz.ColorVector[2][len(Regression_list) + 1], label='WMAP prediction', markerstyle='o', x_error=Y_WMAP_coord[0].std_dev, y_error=Y_WMAP_coord[1].std_dev)
    dz.text_plot(Obj_Elem, nominal_values(Metal_abun), nominal_values(Ymass_Metal), color = dz.ColorVector[1], x_pad = 0.95, y_pad = 1)
        
    #Plot the linear trendlines
    x_regression_range = linspace(0.0, max(Metal_matrix[:,0])*1.10, 20)
    y_regression_range = m_Median * x_regression_range + n_Median    
    label_S = r'Median value: $' + round_sig(n_Median, n=4, scien_notation=False) + '_{-' + round_sig(n_Median - n_16th, n=4, scien_notation=False) + '}^{+' + round_sig(n_84th - n_Median, n=4, scien_notation=False) + '}$'

    dz.data_plot(x_regression_range, y_regression_range, label = 'Linear regression', color = dz.ColorVector[2][j], linestyle = '--')
    dz.FigWording(Titles_wording[regression][2], Titles_wording[regression][3], Titles_wording[regression][1],legend_loc='best')
    
    #Set legends
#     dz.Axis.set_xlim(0.0, x_regression_range[-1]*1.10)
    
    print 'bien'
    ScriptName = ScriptPrefix + key + '.in'
    
    #Generate the script
    ct.select_script('Argon_Sulfur_LinesModel_Ages', ScriptName, ScriptFolder, key = key, data_dict=Model_dict)
      
    #Run the cloudy script
#     ct.run_script(ScriptName, ScriptFolder)
#       
    #Plot the .out cloudy file
#     ct.open_output(ScriptName, ScriptFolder)

    #Generate lines dictionary with the output data
    Line_dict = ct.load_predicted_lines(ScriptName, ScriptFolder)
    
    x_values, y_values, TSIII, TOIII = Ar_S_model(Line_dict)
    dz.data_plot(x_values, y_values, color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')
#     dz.data_plot(x_values, TSIII,  color=Colors_dict[key], label=Legends_dict[key], markerstyle='o')

    list_xvalues    = concatenate([list_xvalues, x_values])
    list_yvalues    = concatenate([list_yvalues, y_values])
    list_TSIII      = concatenate([list_TSIII, TSIII])
    list_TOIII      = concatenate([list_TOIII, TOIII])

Not_infinite = isfinite(list_yvalues)

list_xvalues_clean  = list_xvalues[Not_infinite]
list_yvalues_clean  = list_yvalues[Not_infinite]
list_TSIII_clean    = list_TSIII[Not_infinite]

list_xvalues_Above  = greater(list_xvalues_clean, 0)
 
den = 0
den_range = linspace(0, 300, 200)

# Comment the second if you want all the lines to be plotted
HeI_Lines=[3889.0, 4026.0, 4471.0, 5876.0, 6678.0, 7065.0, 10830.0]


print 'Emissivity', HeI.getEmissivity(tem, 1, wave=3889.0)

#--------------------------Density case----------------------------------
#Plot the lines
for line in HeI_Lines:
    y_1000_100     = HeI.getEmissivity(tem, den_range, wave=line)
    y              = HeI.getEmissivity(tem, den, wave=line)
    dz.data_plot(den_range, y_1000_100/y, label=str(line) + r' $\AA$ line')4
       
# dz.Axis.set_xscale('log')
dz.Axis.tick_params(axis='both', labelsize=20.0)
dz.Axis.set_ylim(0.0,2.5)
# dz.Axis.patch.set_facecolor('white')
# dz.Fig.set_facecolor('black')
# dz.Fig.set_edgecolor('black')
   
#Plot wording
xtitle  = r'$n_{e}$ $(cm^{-3})$'
# ytitle  = r'j(T) [erg cm$^{-3}$ s${-1}$]'
ytitle  = 'Relative emissivity'
title   = 'HeI emissivities @ $T_e$={:.0f}'.format(tem)
dz.FigWording(xtitle, ytitle, title, axis_Size = 20.0, title_Size = 20.0, legend_size=20.0)
   
Exemple #22
0
tem_range = linspace(10000, 25000, 100)

den = 100
den_range = linspace(10, 300, 100)

# Comment the second if you want all the lines to be plotted
# S_Lines=[105100, 1404.81, 1423.84, 1398.04, 1416.89, 290100.0, 1387.46, 1406.02, 112300, 183200]
# S_Lines=[1404.81, 1423.84, 1416.89, 1406.02, 112300]
S_Lines = [105000]

#--------------------------Density case----------------------------------
#Plot the lines
for line in S_Lines:
    y = S4.getEmissivity(tem, den_range, wave=line)
    y_1000_100 = S4.getEmissivity(tem, den, wave=line)
    dz.data_plot(den_range, y / y_1000_100, label=str(line) + r' $\AA$ line')

# dz.Axis.set_xscale('log')
dz.Axis.tick_params(axis='both', labelsize=20.0)
dz.Axis.set_ylim(0.0, 2.5)
# dz.Axis.patch.set_facecolor('white')
# dz.Fig.set_facecolor('black')
# dz.Fig.set_edgecolor('black')

#Plot wording
xtitle = r'$n_{e}$ $(cm^{-3})$'
# ytitle  = r'j(T) [erg cm$^{-3}$ s${-1}$]'
ytitle = 'Relative emissivity'
title = 'HeI emissivities @ $T_e$={:.0f}'.format(tem)
dz.FigWording(xtitle,
              ytitle,
Exemple #23
0
        else:
            z_values.append(0)
            g_mags.append(12)
            r_mags.append(12)

#------Plot magnitudes

x_values = array(r_mags)
y_values = array(g_mags)

dz.Axis.set_xlim(12, 22)
dz.Axis.set_ylim(12, 22)

dz.data_plot(x_values,
             y_values,
             color=dz.ColorVector[2][0],
             label='Candidate objects',
             markerstyle='o')
dz.text_plot(names, x_values, y_values, color=dz.ColorVector[1], fontsize=11)
dz.Axis.axhline(y=20, color=dz.ColorVector[2][1])
dz.Axis.axvline(x=19, color=dz.ColorVector[2][1])

Title = r'Sample SDSS model magnitudes'
Title_X = r'r $(model)$'
Title_Y = r'g $(model)$'
dz.FigWording(Title_X, Title_Y, Title, legend_loc='best')
dz.savefig(output_address=Catalogue_Dic['Data_Folder'] + 'g_r_magnitudes',
           reset_fig=True)

#------Plot magnitudes