# # counter += 1 # # #Plot WMAP prediction # dz.data_plot(WMAP_coordinates[0].nominal_value, WMAP_coordinates[1].nominal_value, color = dz.colorVector['pink'], label='Planck prediction', markerstyle='o', x_error=WMAP_coordinates[0].std_dev, y_error=WMAP_coordinates[1].std_dev) # # #plotTitle = r'{title}: $Y_{{P}} = {n}_{{-{lowerlimit}}}^{{+{upperlimit}}}$'.format(title = Regresions_dict['title'][i], n = round_sig(n_Median,4, scien_notation=False), lowerlimit = round_sig(n_Median-n_16th,2, scien_notation=False), upperlimit = round_sig(n_84th-n_Median,2, scien_notation=False)) # dz.Axis.set_ylim(0.1,0.4) # dz.FigWording(Regresions_dict['x label'][i], Regresions_dict['y label'][i], '', loc='lower center', ncols_leg=2) # # output_pickle = '{objFolder}{element}_regression_2nd'.format(objFolder=output_folder, element = element) # dz.save_manager(output_pickle, save_pickle = False) for key in regr_dict: magnitude_entry = r'${}\pm{}$'.format( round_sig(regr_dict[key][0], 3, scien_notation=False), round_sig(regr_dict[key][1], 1, scien_notation=False)) print magnitude_entry # # Combined regressions # for i in range(len(Regresions_list)): # # regr_group = Regresions_list[i] # dim_group = len(regr_group) # ext_method = str(dim_group) # p0 = array([0.005] * dim_group + [0.25]) # # # Define lmfit model # params = Parameters() # for idx in range(dim_group): # params.add('m' + str(idx), value=0.005)
rounddig=2, scientific_notation=True) row_F += [ '', dz.format_for_table(group_dict[str(objName) + '_Hbeta_F'], rounddig=2, scientific_notation=True), dz.format_for_table(group_dict[str(objName) + '_Hbeta_I'], rounddig=2, scientific_notation=True) ] cHbeta_reduc, cHbeta_emis = catalogue_df.loc[ objName, 'cHbeta_reduc'], catalogue_df.loc[objName, 'cHbeta_emis'] cHbeta_reduc_entry = '{}$\pm${}'.format( round_sig(cHbeta_reduc.nominal_value, 2, scien_notation=False), round_sig(cHbeta_reduc.std_dev, 1, scien_notation=False)) cHbeta_emis_entry = '{}$\pm${}'.format( round_sig(cHbeta_emis.nominal_value, 2, scien_notation=False), round_sig(cHbeta_emis.std_dev, 1, scien_notation=False)) row_cHbeta += ['', cHbeta_emis_entry, ''] dz.addTableRow(row_F, last_row=False) dz.addTableRow(row_cHbeta, last_row=True) dz.table.add_hline() #dz.generate_pdf() dz.generate_pdf(output_address=pdf_address) # table_row = [''] * 7 # # table_row[0] = '$(erg\,cm^{-2} s^{-1} \AA^{-1})$'
n_Median_cf, n_std_df, n_16th_cf, n_84th_cf = np.median(curvefit_matrix[3, :]), np.std(curvefit_matrix[3, :]), np.percentile(curvefit_matrix[3, :],16), np.percentile(curvefit_matrix[3, :], 84) entry_key = r'$Y_{{P,\,{elemA}-{elemB}-{elemC}}}$'.format(elemA='O', elemB='N', elemC='S') # Save the results results_dict['ONS'] = np.array([entry_key, n_Median_cf, n_std_df, n_objects]) # Make the table pdf_address = tables_folder + 'yp_determinations' # dz.create_pdfDoc(pdf_address, pdf_type='table') headers = ['Element regression', 'Value', 'Number of objects'] dz.pdf_insert_table(headers) last_key = results_dict.keys()[-1] for key in results_dict: magnitude_entry = r'${}\pm{}$'.format(round_sig(results_dict[key][1], 3, scien_notation=False), round_sig(results_dict[key][2], 1, scien_notation=False)) row = [results_dict[key][0], magnitude_entry, str(int(results_dict[key][3]))] dz.addTableRow(row, last_row = False if last_key != last_key else True) dz.table.add_hline() for key in inter_regr_dict: magnitude_entry = r'${}\pm{}$'.format(inter_regr_dict[key][0], inter_regr_dict[key][1]) row = [key, magnitude_entry, inter_regr_dict[key][2]] dz.addTableRow(row, last_row = False if last_key != last_key else True) dz.table.add_hline() for key in exter_regr_dict: magnitude_entry = r'${}\pm{}$'.format(exter_regr_dict[key][0], exter_regr_dict[key][1]) row = [key, magnitude_entry, exter_regr_dict[key][2]] dz.addTableRow(row, last_row = False if last_key != last_key else True)
dz.addTableRow(row, last_row = False) else: print 'ESTA FALLA', wave dz.table.add_hline() #Add bottom rows with the Hbeta flux and reddening row_F, row_cHbeta = [r'$I(H\beta)$'], [r'$c(H\beta)$'] row_clean = ['$(erg\,cm^{-2} s^{-1} \AA^{-1})$'] + [''] * len(obj_group) * 3 for obj in obj_group: #row_F += ['', dz.format_for_table(group_dict[str(obj) + '_Hbeta_F'], rounddig = 2, scientific_notation=True), dz.format_for_table(group_dict[str(obj) + '_Hbeta_I'], rounddig = 2, scientific_notation=True)] row_F += ['', dz.format_for_table(group_dict[str(obj) + '_Hbeta_F'], rounddig = 2, scientific_notation=True), dz.format_for_table(group_dict[str(obj) + '_Hbeta_I'], rounddig = 2, scientific_notation=True)] cHbeta_reduc, cHbeta_emis = catalogue_df.loc[obj, 'cHbeta_reduc'], catalogue_df.loc[obj, 'cHbeta_emis'] cHbeta_reduc_entry = '{}$\pm${}'.format(round_sig(cHbeta_reduc.nominal_value, 2, scien_notation=False), round_sig(cHbeta_reduc.std_dev, 1, scien_notation=False)) cHbeta_emis_entry = '{}$\pm${}'.format(round_sig(cHbeta_emis.nominal_value, 2, scien_notation=False), round_sig(cHbeta_emis.std_dev, 1, scien_notation=False)) #row_cHbeta += ['', cHbeta_reduc_entry, cHbeta_emis_entry] row_cHbeta += ['', cHbeta_emis_entry, ''] print cHbeta_emis_entry dz.addTableRow(row_F, last_row = False) dz.addTableRow(row_clean, last_row = False) dz.addTableRow(row_cHbeta, last_row = True) dz.table.add_hline() dz.generate_pdf(output_address=pdf_address) # dz.generate_pdf() # from numpy import nanmean, nanstd, mean, concatenate, unique, sum, round, nan