MCPcopy Create free account
hub / github.com/WizardOfMenlo/stir / format_table

Function format_table

graph_script.py:258–273  ·  view source on GitHub ↗
(table, rates, round_precision=None)

Source from the content-addressed store, hash-verified

256
257
258def format_table(table, rates, round_precision=None):
259 result = []
260 for row in table:
261 new_row = []
262 for i in range(len(row)):
263 if row[i] is None:
264 new_row.append('-')
265 else:
266 stir_time, fri_time = row[i]
267 ratio = round(fri_time / stir_time, 2)
268 stir_time = round(stir_time, round_precision)
269 fri_time = round(fri_time, round_precision)
270 new_row.append('$\\frac{{ {} }}{{ {} }} \\approx {} \\times $'.format(fri_time, stir_time, ratio))
271 result.append(new_row)
272
273 return '\\\\\n'.join([' & '.join(["$\\sfrac{{1}}{{{}}}$".format(2**rate)] + row) for rate,row in zip(rates, result)])
274
275
276

Callers 1

make_latex_tablesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected