def write_latex_table_set1(self,isotopes_for_table,data,headers=['this is a test','to write strings in the first col'],file_name_table_species_wind = 'isotopic_table_set1.2_prodfac.txt',case_label_and_first_column = ['specie','1.65 Msun','2 Msun','3 Msun','5 Msun','15 Msun','20 Msun','25 Msun',]):
'''
Table write method from Paper1 scripts (from Marco)
isotopes_for_table - isotopes for table (first column), preferable stable
data - 2d array e.g. [tab_w_1p65,tab_w_2,tab_w_3,tab_w_5,tab_w_15,tab_w_20,tab_w_25]
'''
# headers and format
form_str='%7.3E'
sep_string=' & '
all_data=[]
all_data.append(isotopes_for_table)
for i in range(len(data)):
datal=list(form_str%data[i][j] for j in range(len(data[i])))
all_data.append(datal)
### attempt to add the trailing '\\' to a latex table
final_col=len(isotopes_for_table)*[r'\\ ']
case_label_and_first_column.append(r'\\ ')
all_data.append(final_col)
att.write(file_name_table_species_wind,headers,case_label_and_first_column,all_data,sep=sep_string)
评论列表
文章目录