59 lines
1.3 KiB
Python
59 lines
1.3 KiB
Python
import os
|
|
|
|
tex_template = """
|
|
\\begin{{figure}}[!htb]
|
|
\\centering
|
|
\\includegraphics[width=.75\\linewidth]{{./results-benchmark/{filename}}}
|
|
\\caption{{{caption}}}
|
|
\\label{{fig:{label}}}
|
|
\\end{{figure}}
|
|
"""
|
|
|
|
caption_template = '{chart} benchmark result of {device} device with {browser} browser on dataset "{data}" {highQual}.'
|
|
|
|
devices = {
|
|
'win': 'Windows',
|
|
}
|
|
|
|
browsers = {
|
|
'ffox': 'Firefox',
|
|
'chro': 'Chrome',
|
|
'edge': 'Edge',
|
|
'safa': 'Safari'
|
|
}
|
|
|
|
data = {
|
|
'simplify': 'Simplify.js example',
|
|
'bavaria': 'Bavaria outline'
|
|
}
|
|
|
|
chart = {
|
|
'vs': 'Simplify.wasm vs. Simplify.js',
|
|
'stack': 'Simplify.wasm runtime analysis'
|
|
}
|
|
|
|
highQual = {
|
|
'true': 'with high Quality mode',
|
|
'false': 'without high Quality mode'
|
|
}
|
|
|
|
|
|
for filename in os.listdir(os.path.dirname(os.path.realpath(__file__))):
|
|
if not filename.endswith('.png'):
|
|
continue
|
|
label = filename.split('.')[0]
|
|
|
|
parts = label.split('_')
|
|
caption = caption_template.format(
|
|
device=devices[parts[0]],
|
|
browser=browsers[parts[1]],
|
|
data=data[parts[2]],
|
|
chart=chart[parts[3]],
|
|
highQual=highQual[parts[4]]
|
|
)
|
|
|
|
content = tex_template.format(
|
|
filename=filename, caption=caption, label=label)
|
|
with open(label + '.tex', 'w') as file:
|
|
file.write(content)
|