|
@@ -1,6 +1,7 @@ |
|
|
"""Classes for producing videos""" |
|
|
"""Classes for producing videos""" |
|
|
|
|
|
|
|
|
from abc import ABC |
|
|
from abc import ABC |
|
|
|
|
|
import json |
|
|
import logging |
|
|
import logging |
|
|
import os |
|
|
import os |
|
|
import subprocess |
|
|
import subprocess |
|
@@ -139,3 +140,15 @@ class VisualisationProducer(Producer): |
|
|
# save the plot |
|
|
# save the plot |
|
|
plt.savefig("/tmp/visualisation.png") |
|
|
plt.savefig("/tmp/visualisation.png") |
|
|
plt.close() |
|
|
plt.close() |
|
|
|
|
|
|
|
|
|
|
|
class JSONProducer(Producer): |
|
|
|
|
|
"""Produce JSON output""" |
|
|
|
|
|
def __init__(self, features): |
|
|
|
|
|
if not features: |
|
|
|
|
|
raise ValueError("No features provided") |
|
|
|
|
|
self.features = features |
|
|
|
|
|
|
|
|
|
|
|
def produce(self): |
|
|
|
|
|
# FIXME: config option for output path |
|
|
|
|
|
with open("/tmp/features.json", "w") as jsonfile: |
|
|
|
|
|
jsonfile.write(json.dumps(self.features, cls=PipelineJSONEncoder, indent=4)) |