From 6773d9e7341728419e57f54f8d6e51b05134a68b Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Fri, 8 Apr 2016 11:49:20 +0800 Subject: [PATCH] thumbnail: add example --- artiq/examples/master/repository/thumbnail.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 artiq/examples/master/repository/thumbnail.py diff --git a/artiq/examples/master/repository/thumbnail.py b/artiq/examples/master/repository/thumbnail.py new file mode 100644 index 000000000..ae7d24a3b --- /dev/null +++ b/artiq/examples/master/repository/thumbnail.py @@ -0,0 +1,21 @@ +import io + +import numpy as np +import matplotlib.pyplot as plt + +from artiq.experiment import * + + +class Thumbnail(EnvExperiment): + def build(self): + pass + + def run(self): + pass + + def analyze(self): + plt.plot([1, 2, 0, 3, 4]) + f = io.BytesIO() + plt.savefig(f, format="PNG") + f.seek(0) + self.set_dataset("thumbnail", np.void(f.read()))