#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) #Display figure # dz.display_fig() dz.savefig( '/home/vital/Dropbox/Astrophysics/Lore/PopStar_SEDs/SIV_Emissivity_den', extension='.png', reset_fig=True) #--------------------------Temperature case---------------------------------- #Plot the lines for line in S_Lines: y = S4.getEmissivity(tem_range, den, wave=line) y_1000_100 = S4.getEmissivity(tem, den, wave=line) dz.data_plot(tem_range, y / y_1000_100, label=str(line) + r' $\AA$ line', linestyle='--', linewidth=2) # dz.Axis.set_xscale('log') dz.Axis.tick_params(axis='both', labelsize=20.0)
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 #Increase the display range # dz.Axis.set_ylim(-0.4,0.4) #Insert labels and legends Title = "HII galaxy " + CodeName + " " + r'$c(H\beta)$' + ' coefficient calculation' y_Title = r'$log(I/I_{H\beta})_{th}-log(F/F_{H\beta})_{Obs}$' x_Title = r'$f(\lambda)-f(\lambda_{H\beta})$' dz.FigWording(x_Title, y_Title, Title) #Save data # pv.SaveManager(SavingName = pv.ScriptCode + '_' + CodeName + '_IntrinsicReddening', SavingFolder = FileFolder, ForceSave=True) # dz.display_fig() dz.savefig('/home/vital/Dropbox/Astrophysics/Papers/Elemental_RegressionsSulfur/Images/' + 'SHOC579_cHbeta') print 'All data treated', pv.display_errors()
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 #Increase the display range # dz.Axis.set_ylim(-0.4,0.4) #Insert labels and legends Title = "HII galaxy " + CodeName + " " + r'$c(H\beta)$' + ' coefficient calculation' y_Title = r'$log(I/I_{H\beta})_{th}-log(F/F_{H\beta})_{Obs}$' x_Title = r'$f(\lambda)-f(\lambda_{H\beta})$' dz.FigWording(x_Title, y_Title, Title) #Save data # pv.SaveManager(SavingName = pv.ScriptCode + '_' + CodeName + '_IntrinsicReddening', SavingFolder = FileFolder, ForceSave=True) # dz.display_fig() dz.savefig( '/home/vital/Dropbox/Astrophysics/Papers/Elemental_RegressionsSulfur/Images/' + 'SHOC579_cHbeta') print 'All data treated', pv.display_errors()
#----------------------Plotting abundances #Perform linear regression zero_vector = zeros(len(list_xvalues_clean_greater)) m ,n, m_err, n_err, covab = bces(list_xvalues_clean_greater, zero_vector, list_yvalues_clean_greater, zero_vector, zero_vector) x_regresion = linspace(0, max(list_xvalues_clean_greater), 50) y_regression = m[0] * x_regresion + n[0] LinearRegression_Label = r'Linear fitting'.format(n = round(n[0],2) ,nerr = round(n_err[0],2)) dz.data_plot(x_regresion, y_regression, label=LinearRegression_Label, linestyle='--', color=dz.ColorVector[1]) logSII_SIII_theo = m[0] * logArII_ArIII + n[0] dz.data_plot(nominal_values(logArII_ArIII), nominal_values(logSII_SIII_theo), color=dz.ColorVector[1], label='Observations', markerstyle='o', x_error=std_devs(logArII_ArIII), y_error=std_devs(logSII_SIII_theo)) # #Plot fitting formula formula = r"$log\left(Ar^{{+2}}/Ar^{{+3}}\right) = {m} \cdot log\left(S^{{+2}}/S^{{+3}}\right) + {n}$".format(m='m', n='n') formula2 = r"$m = {m} \pm {merror}; n = {n} \pm {nerror}$".format(m=round(m[0],3), merror=round(m_err[0],3), n=round(n[0],3), nerror=round(n_err[0],3)) dz.Axis.text(0.50, 0.15, formula, transform=dz.Axis.transAxes, fontsize=20) dz.Axis.text(0.50, 0.08, formula2, transform=dz.Axis.transAxes, fontsize=20) #Plot wording xtitle = r'$log(S^{+2}/S^{+3})$' ytitle = r'$log(Ar^{+2}/Ar^{+3})$' title = 'Argon - Sulfur ionic relation in Cloudy photoionization models' dz.FigWording(xtitle, ytitle, title, axis_Size = 20.0, title_Size = 20.0, legend_size=20.0, legend_loc='best') #Display figure # dz.display_fig() dz.savefig(output_address = '/home/vital/Dropbox/Astrophysics/Papers/Elemental_RegressionsSulfur/Cloudy_Models/ArIons_vs_SIons_Ionization_Obs') print 'Data treated'
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---------------------------------------- # FilesFolder = '/home/vital/Dropbox/Astrophysics/Data/Starburst_Spectra_z0.004/' # FilesPattern = '_txt_LinesLog_v3.txt' # # #Locate files on hard drive # FilesList = pv.Folder_Explorer(FilesPattern, FilesFolder, CheckComputer=False) # # # #Define figure format # dz.FigConf() # # #Lines to plot # H_Lines = ['H1_6563A', 'H1_3970A','H1_4102A','H1_4340A', 'H1_4861A'] # # H_Lines = ['He1_3188A','He1_4026A','He2_4686A','He1_5016A','He1_5876A','He1_6678A']
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' #Save the data SavingName = regression + '_MC_pyneb' dz.savefig(Catalogue_Dic['Data_Folder'] + SavingName, reset_fig = True) # pv.SaveManager(SavingName = SavingName, SavingFolder = Catalogue_Dic['Data_Folder'], ForceSave=True, savevectorfile=False) #Save PlotVector pv.ResetPlot() # #Plot the figure # from Plotting_Libraries.bayesian_data import bayes_plotter # bp = bayes_plotter() # bp.plot_Ownposteriors_histagram(n_dict.values(), ['Yp Sulfur', 'Yp Oxygen', 'Yp Nitrogen'], xlim=[0.22, 0.28]) # # bp.savefig(Catalogue_Dic['Data_Folder'] + 'Yp_Distribution') print 'Data treated'
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---------------------------------------- # FilesFolder = '/home/vital/Dropbox/Astrophysics/Data/Starburst_Spectra_z0.004/' # FilesPattern = '_txt_LinesLog_v3.txt' # # #Locate files on hard drive # FilesList = pv.Folder_Explorer(FilesPattern, FilesFolder, CheckComputer=False) # # # #Define figure format # dz.FigConf() # # #Lines to plot # H_Lines = ['H1_6563A', 'H1_3970A','H1_4102A','H1_4340A', 'H1_4861A'] # # H_Lines = ['He1_3188A','He1_4026A','He2_4686A','He1_5016A','He1_5876A','He1_6678A']
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='Linear 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.35, 0.15, formula, transform=dz.Axis.transAxes, fontsize=20) #Plot wording xtitle = r'$log\left(S^{{+2}}/S^{{+3}}\right)$' ytitle = r'$log\left(Ar^{{+2}}/Ar^{{+3}}\right)$' title = 'Argon - Sulfur ionic abundances\nfor a Z, Mass, log(t) cluster grid' dz.FigWording(xtitle, ytitle, title, loc='upper left') #Display figure # dz.display_fig() dz.savefig( output_address= '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/data/sulfur_argon_ionicAbundances', extension='.png') print 'Data treated otro'
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$' dz.FigWording(r'Wavelength $(\AA)$', 'Flux' + r'$(erg\,cm^{-2} s^{-1} \AA^{-1})$', title) #Display figure # dz.display_fig() dz.savefig( '/home/vital/Dropbox/Astrophysics/Papers/Elemental_RegressionsSulfur/Images/' + 'SHOC579_spectralComponents', extension='.png') # #---------------------Zanstra calibration------------------------------ # # pv = myPickle() # dz = Plot_Conf() # nebCalc = NebularContinuumCalculator() # nebCalc.DataRoot = '/home/vital/Dropbox/Astrophysics/Lore/NebularContinuum/' # # #Define operation # Catalogue_Dic = DataToTreat() # Pattern = Catalogue_Dic['Datatype'] + '_dered.fits' # Lineslog_extension = Catalogue_Dic['Datatype'] + '_dered_LinesLog_v3.txt' # # #Find and organize files from terminal command or .py file
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) #Display figure # dz.display_fig() dz.savefig('/home/vital/Dropbox/Astrophysics/Lore/PopStar_SEDs/SIV_Emissivity_den', extension = '.png', reset_fig=True) #--------------------------Temperature case---------------------------------- #Plot the lines for line in S_Lines: y = S4.getEmissivity(tem_range, den, wave=line) y_1000_100 = S4.getEmissivity(tem, den, wave=line) dz.data_plot(tem_range, y/y_1000_100, label=str(line) + r' $\AA$ line', linestyle='--', linewidth=2) # 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')
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) 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) Title = r'Sample declination versus equivalent width' Title_X = r'$Eqw$ $(H\beta)$' Title_Y = r'dec $(deg)$' dz.FigWording(Title_X, Title_Y, Title, legend_loc='best')
# 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$' dz.FigWording(r'Wavelength $(\AA)$', 'Flux' + r'$(erg\,cm^{-2} s^{-1} \AA^{-1})$', title) #Display figure # dz.display_fig() dz.savefig('/home/vital/Dropbox/Astrophysics/Papers/Elemental_RegressionsSulfur/Images/' + 'SHOC579_spectralComponents', extension='.png') # #---------------------Zanstra calibration------------------------------ # # pv = myPickle() # dz = Plot_Conf() # nebCalc = NebularContinuumCalculator() # nebCalc.DataRoot = '/home/vital/Dropbox/Astrophysics/Lore/NebularContinuum/' # # #Define operation # Catalogue_Dic = DataToTreat() # Pattern = Catalogue_Dic['Datatype'] + '_dered.fits' # Lineslog_extension = Catalogue_Dic['Datatype'] + '_dered_LinesLog_v3.txt' # # #Find and organize files from terminal command or .py file # FilesList = pv.Folder_Explorer(Pattern, Catalogue_Dic['Obj_Folder'], CheckComputer=False)
color=dz.ColorVector[1], label="Observations", markerstyle="o", x_error=std_devs(Temps), y_error=std_devs(logArII_ArIII), ) dz.FigWording(xtitle, ytitle, title, axis_Size=20.0, title_Size=20.0, legend_size=20.0, legend_loc="upper right") "ArIons_vs_TSIII_Obs" dz.Axis.set_xlim(5000, 20000) # Display figure # dz.display_fig() dz.savefig( output_address="/home/vital/Dropbox/Astrophysics/Papers/Elemental_RegressionsSulfur/Cloudy_Models/ArIons_vs_TSIII_Obs" ) print "Data treated" # #----------------------Plotting abundances # #Perform linear regression # zero_vector = zeros(len(list_xvalues_clean_greater)) # m ,n, m_err, n_err, covab = bces(list_xvalues_clean_greater, zero_vector, list_yvalues_clean_greater, zero_vector, zero_vector) # # # x_regresion = linspace(0, max(list_xvalues_clean_greater), 50) # y_regression = m[0] * x_regresion + n[0] # # # LinearRegression_Label = r'Linear fitting'.format(n = round(n[0],2) ,nerr = round(n_err[0],2)) # dz.data_plot(x_regresion, y_regression, label=LinearRegression_Label, linestyle='--', color=dz.ColorVector[1])
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) 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) Title = r'Sample declination versus equivalent width' Title_X = r'$Eqw$ $(H\beta)$'