Commits

Matthew Turk committed 55e0a34

Initial sample scripts

Comments (0)

Files changed (3)

+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()
+from yt.mods import *
+
+pf = load("MYDATA")
+pf._mrep.upload()
+proj = pf.h.proj(0, "Density", weight="Density")
+proj._mrep.upload()

upload_vertices.py

+from yt.mods import *
+from yt.utilities.minimal_representation import MinimalRepresentation
+
+class MinimalVerticesRepresentation(MinimalRepresentation):
+
+    _attr_list = ("vertices", "output_hash", "field")
+    type = "vertices"
+
+    def __init__(self, arr, pf, field):
+        self.vertices = arr
+        self.output_hash = pf._hash()
+        self.field = field
+
+    def _generate_post(self):
+        nobj = self._return_filtered_object(("vertices",))
+        metadata = nobj._attrs
+        chunks = [(self.field, self.vertices)]
+        return (metadata, ('vertex_data', chunks))
+
+pf = load("MYDATA")
+pf._mrep.upload()
+dd = pf.h.all_data()
+iso = dd.extract_isocontours("Density", 1e-27)
+
+MVR = MinimalVerticesRepresentation(iso, pf, "Density")
+MVR.upload()