| 369 | |
| 370 | |
| 371 | def serialize_records(records, system_specs, filename): |
| 372 | with open(filename, 'w+') as fd: |
| 373 | s = "| Town | Sensors | Weather | # of Vehicles | # of Walkers | Samples | Mean FPS | Std FPS |\n" |
| 374 | s += "| ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- |\n" |
| 375 | fd.write(s) |
| 376 | |
| 377 | for sensor_key in sorted(records.keys()): |
| 378 | list_records = records[sensor_key] |
| 379 | for record in list_records: |
| 380 | s = "| {} | {} | {} | {} | {} | {} | {:03.2f} | {:03.2f} |\n".format(record['town'], |
| 381 | record['sensors'], |
| 382 | record['weather'], |
| 383 | record['n_vehicles'], |
| 384 | record['n_walkers'], |
| 385 | record['samples'], |
| 386 | record['fps_mean'], |
| 387 | record['fps_std']) |
| 388 | fd.write(s) |
| 389 | |
| 390 | s = "\n| Global mean FPS | Global std FPS |\n" |
| 391 | s += "| **{:03.2f}** | **{:03.2f}** |\n".format(*get_total(records)) |
| 392 | fd.write(s) |
| 393 | |
| 394 | s = "Table: {}.\n".format(system_specs) |
| 395 | fd.write(s) |
| 396 | |
| 397 | |
| 398 | def get_total(records): |