2019-08-15 18:09:21 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2019-08-07 15:34:59 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
tex_template = """
|
2019-08-15 18:09:21 +02:00
|
|
|
\\begin{{figure}}[!htb]
|
2019-08-07 15:34:59 +02:00
|
|
|
\\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',
|
2019-08-08 21:25:39 +02:00
|
|
|
'mac': 'MacBook Pro',
|
|
|
|
'ubu': 'Ubuntu',
|
2019-08-15 19:01:31 +02:00
|
|
|
'iph': 'iPhone',
|
|
|
|
'ipad': 'iPad'
|
2019-08-07 15:34:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
browsers = {
|
|
|
|
'ffox': 'Firefox',
|
|
|
|
'chro': 'Chrome',
|
|
|
|
'edge': 'Edge',
|
|
|
|
'safa': 'Safari'
|
|
|
|
}
|
|
|
|
|
|
|
|
data = {
|
|
|
|
'simplify': 'Simplify.js example',
|
|
|
|
'bavaria': 'Bavaria outline'
|
|
|
|
}
|
|
|
|
|
|
|
|
chart = {
|
|
|
|
'vs': 'Simplify.wasm vs. Simplify.js',
|
2019-08-08 21:25:39 +02:00
|
|
|
'stack': 'Simplify.wasm runtime analysis',
|
|
|
|
'jsstack': 'Turf.js simplify'
|
2019-08-07 15:34:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
highQual = {
|
2019-08-08 21:25:39 +02:00
|
|
|
'true': 'with high quality mode',
|
|
|
|
'false': 'without high quality mode'
|
2019-08-07 15:34:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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)
|