Source

yt.hub_examples / upload_images.py

from yt.mods import *
from yt.utilities.minimal_representation import MinimalImageCollectionData

class ImageCollection(object):
    def __init__(self, pf, name):
        self.pf = pf
        self.name = name
        self.images = []
        self.image_metadata = []

    def add_image(self, fn, descr):
        self.image_metadata.append(descr)
        self.images.append((fn, na.fromfile(fn, dtype='c')))

pf = load("MYDATA")
pc = PlotCollection(pf)
pc.add_projection("Density", 0, "Density")
pc.add_phase_sphere(1.0, '1', ["Density", "Temperature", "CellMassMsun"],
                    weight=None)
fns = pc.save()
ic = ImageCollection(pf, "Simple Plots")
ic.add_image(fns[0], "Density-Density projection along x")
ic.add_image(fns[1], "Density, Temperature, Mass, 100AU")

micd = MinimalImageCollectionData(ic)
micd.upload()