element_abundance_check = isnull(catalogue_df.loc[objName, element_abundance_key]) print objName, element, element_abundance_check if element_abundance_check is False: if (validity_entry not in ['ignored', 'NO_excess', 'Wide Component']): regressions_employed.append(element) else: print 'Fallo', objName, element name_superscript = r'\textsuperscript{{{regrens}}}'.format(regrens = ', '.join(regressions_employed)) entry_name = r'{text}{expo}'.format(text=catalogue_df.loc[objName].quick_index, expo=name_superscript) objData = catalogue_df.loc[objName] abundValues = objData[metals_list].values objData[metals_list] = 12.0 + unumpy.log10(abundValues) HeI_HI_entry = dz.format_for_table(catalogue_df.loc[objName, 'HeII_HII_from_O' + ext_data], rounddig=3, rounddig_er=2) Ymass_O_entry = dz.format_for_table(catalogue_df.loc[objName, 'Ymass_O' + ext_data], rounddig=3, rounddig_er=2) Ymass_S_entry = dz.format_for_table(catalogue_df.loc[objName, 'Ymass_S' + ext_data], rounddig=3, rounddig_er=2) print objName, objData[['OI_HI' + ext_data]].values, objData[['OI_HI' + ext_data]].isnull().values.any(), regressions_employed row = [entry_name] + [HeI_HI_entry, Ymass_O_entry, Ymass_S_entry] row += list(objData[['OI_HI' + ext_data, 'NI_HI' + ext_data, 'SI_HI' + ext_data]].values) dz.addTableRow(row, last_row = False if catalogue_df.index[-1] != objName else True, rounddig=3, rounddig_er=1) # dz.generate_pdf() dz.generate_pdf(output_address=pdf_address)
#Establish table format dz.latex_header(table_address = FileFolder + CodeName + Table_Name, TitleColumn = ['', '', 'HII Galaxy', CodeName, '']) #Loop through all the emission recordings objlines = obj_lines_frame.index.values for j in range(len(objlines)): if '_w' not in objlines[j]: #Loop through the columns and prepare the data to store for k in range(len(Object_row)): thekey = data_keys[k] if thekey == 'Emission': format_index = where(dz.LinesLogFormat_dict['0'] == objlines[j])[0][0] wavelength = dz.format_for_table(obj_lines_frame.iloc[j]['TheoWavelength'], rounddig = 4) ion = dz.LinesLogFormat_dict['3'][format_index] Object_row[k] = r'${wavelength}$ ${ion}$'.format(wavelength = wavelength, ion = ion) elif thekey == 'f_lambda': Object_row[k] = dz.format_for_table(obj_lines_frame.iloc[j]['line_f'], rounddig = 4) elif thekey == 'Eqw': Eqw = obj_lines_frame.iloc[j]['line_Int'] / ufloat(obj_lines_frame.iloc[j]['Continuum_Median'], obj_lines_frame.iloc[j]['Continuum_sigma']) # print objlines[j], obj_lines_frame.iloc[j]['line_Int'].nominal_value, ufloat(obj_lines_frame.iloc[j]['Continuum_Median'], obj_lines_frame.iloc[j]['Continuum_sigma']).nominal_value, Eqw.nominal_value Object_row[k] = dz.format_for_table(Eqw, rounddig = 3) elif thekey == 'Flux_undim': value = obj_lines_frame.iloc[j]['line_Flux'] * 1000.0 / Hbeta_Flux Object_row[k] = dz.format_for_table(value, rounddig = 3)
TitleColumn=['', '', 'HII Galaxy', CodeName, '']) #Loop through all the emission recordings objlines = obj_lines_frame.index.values for j in range(len(objlines)): if '_w' not in objlines[j]: #Loop through the columns and prepare the data to store for k in range(len(Object_row)): thekey = data_keys[k] if thekey == 'Emission': format_index = where( dz.LinesLogFormat_dict['0'] == objlines[j])[0][0] wavelength = dz.format_for_table( obj_lines_frame.iloc[j]['TheoWavelength'], rounddig=4) ion = dz.LinesLogFormat_dict['3'][format_index] Object_row[k] = r'${wavelength}$ ${ion}$'.format( wavelength=wavelength, ion=ion) elif thekey == 'f_lambda': Object_row[k] = dz.format_for_table( obj_lines_frame.iloc[j]['line_f'], rounddig=4) elif thekey == 'Eqw': Eqw = obj_lines_frame.iloc[j]['line_Int'] / ufloat( obj_lines_frame.iloc[j]['Continuum_Median'], obj_lines_frame.iloc[j]['Continuum_sigma']) # print objlines[j], obj_lines_frame.iloc[j]['line_Int'].nominal_value, ufloat(obj_lines_frame.iloc[j]['Continuum_Median'], obj_lines_frame.iloc[j]['Continuum_sigma']).nominal_value, Eqw.nominal_value Object_row[k] = dz.format_for_table(Eqw, rounddig=3)
#Load lines frame lineslog_frame = dz.load_lineslog_frame(lineslog_address) #Perform the reddening correction cHbeta = catalogue_df.loc[objName, cHbeta_type] dz.deredden_lines(lineslog_frame, reddening_curve=red_curve, cHbeta=cHbeta, R_v=R_v) #Sulfur ratios if set(lineslog_frame.index) >= set(['S3_9069A', 'S3_9531A']): s3_ratio = lineslog_frame.loc[ 'S3_9531A'].line_Int / lineslog_frame.loc['S3_9069A'].line_Int s3_color = colorChooser(s3_ratio.nominal_value, dz.S3_ratio) s3_entry = r'\textcolor{' + s3_color + '}{' + dz.format_for_table( s3_ratio, rounddig=3) + '}' else: s3_entry = '-' #Oxygen ratios if set(lineslog_frame.index) >= set(['O3_4959A', 'O3_5007A']): O3_ratio = lineslog_frame.loc[ 'O3_5007A'].line_Int / lineslog_frame.loc['O3_4959A'].line_Int O3_color = colorChooser(O3_ratio.nominal_value, dz.O3_5000_ratio) O3_entry = r'\textcolor{' + O3_color + '}{' + dz.format_for_table( O3_ratio, rounddig=3) + '}' else: O3_entry = '-' #Fill the table if (catalogue_df.loc[objName].T_low
column_code].values) # Special treatment for the equivalent length: Using flux continua_reduc = group_dict[str(objName) + '_df'].loc[label, 'con_dered'] Eqw_special = row_i[2] / continua_reduc if Eqw_special >= 5.0: rounddig = 3 rounddig_er = 3 else: rounddig = 1 rounddig_er = 1 row_i[0] = dz.format_for_table(Eqw_special, rounddig=rounddig, rounddig_er=rounddig_er) row_i[1] = row_i[1] / group_dict[str(objName) + '_Hbeta_F'] * norm_factor row_i[2] = row_i[2] / group_dict[str(objName) + '_Hbeta_I'] * norm_factor row = row + row_i dz.addTableRow(row, last_row=False) # Ascii row table_row[0] = ion table_row[1] = row_i[0].split('$\pm$')[0] table_row[2] = row_i[0].split('$\pm$')[1] flux_entry = dz.format_for_table(row_i[1])
row_i = ['-'] * 3 #By default empty cells if label in group_dict[str(obj) + '_dfemis'].index: row_i = list(group_dict[str(obj) + '_dfemis'].loc[label, column_code].values) #Special treatment for the equivalent length: Using flux continua_reduc = group_dict[str(obj) + '_df'].loc[label, 'con_dered'] Eqw_special = row_i[2] / continua_reduc if Eqw_special >= 5.0: rounddig = 3 rounddig_er = 3 else: rounddig = 1 rounddig_er = 1 row_i[0] = dz.format_for_table(Eqw_special, rounddig = rounddig, rounddig_er=rounddig_er) row_i[1] = row_i[1] / group_dict[str(obj) + '_Hbeta_F'] * norm_factor row_i[2] = row_i[2] / group_dict[str(obj) + '_Hbeta_I'] * norm_factor row = row + row_i 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)$']
dz.deredden_lines(reduc_linedf, reddening_curve=red_curve, cHbeta=cHbeta, R_v=R_v) dz.deredden_lines(emission_linedf, reddening_curve=red_curve, cHbeta=cHbeta, R_v=R_v) #Get Hbeta flux for normalization Hbeta_flux = reduc_linedf.loc['H1_4861A'].line_Flux Hbeta_Int = reduc_linedf.loc['H1_4861A'].line_Int #Generate pdf table_address = '{objfolder}{codeName}_WHT_linesLog_reduc'.format(objfolder = ouput_folder, codeName=objName) dz.create_pdfDoc(table_address, pdf_type='table') #Set the pdf format dz.pdf_insert_table(Headers) for line in reduc_linedf.index.values: ion = r'${}$'.format(lines_df.loc[line].notation) if '_w' not in line else r'$H\alpha$' row = list(reduc_linedf.loc[line, column_code].values) row[2] = row[2] / Hbeta_flux * norm_factor row[4] = row[4] / Hbeta_Int * norm_factor row = [r'{} {}'.format(row[0], ion)] + row[1:] dz.addTableRow(row, last_row = False if reduc_linedf.index[-1] != line else True) row = [r'$F(H\beta)$ $(erg\,cm^{-2} s^{-1} \AA^{-1})$', '', dz.format_for_table(Hbeta_flux, rounddig = 3, scientific_notation=True), '', dz.format_for_table(Hbeta_Int, rounddig = 3, scientific_notation=True)] dz.addTableRow(row, last_row = False) row = [r'$c(H\beta)$', '', cHbeta, '', ''] dz.addTableRow(row, last_row = True) dz.generate_pdf()