def createComposite(self): try: simple.LoadDistributedPlugin("RGBZView", ns=globals()) self.analysis.register_analysis( "composite", "Composite rendering", "Performing composite on contour", '{time}/{theta}/{phi}/{filename}', cinema.CompositeImageExporter.get_data_type()) fng = self.analysis.get_file_name_generator("composite") # Create pipeline to compose color_type = [('POINT_DATA', "velocity")] luts = {"velocity": self.lut} filters = [input] filters_description = [{'name': 'catalyst'}] color_by = [color_type] # Data exploration ------------------------------------------------------------ camera_handler = cinema.ThreeSixtyCameraHandler( fng, None, [float(r) for r in range(0, 360, 72)], [float(r) for r in range(-60, 61, 45)], self.center_of_rotation, self.rotation_axis, self.distance) exporter = cinema.CompositeImageExporter( fng, filters, color_by, luts, camera_handler, [400, 400], filters_description, 0, 0) exporter.set_analysis(self.analysis) self.exporters.append(exporter) except: print "Skip RGBZView exporter"
def run(filename=None): """Create a dummy pipeline and save the coprocessing state in the filename specified, if any, else dumps it out on stdout.""" from paraview import simple, servermanager simple.LoadDistributedPlugin("CatalystScriptGeneratorPlugin") wavelet = simple.Wavelet(registrationName="Wavelet1") contour = simple.Contour() display = simple.Show() view = simple.Render() # create a new 'Parallel PolyData Writer' parallelPolyDataWriter0 = simple.ParallelPolyDataWriter() viewname = servermanager.ProxyManager().GetProxyName("views", view.SMProxy) script = DumpPipeline( export_rendering=True, simulation_input_map={"Wavelet1": "input"}, screenshot_info={viewname: ['image.png', '1', '1', '2', '400', '400']}) if filename: f = open(filename, "w") f.write(script) f.close() else: print "# *** Generated Script Begin ***" print script print "# *** Generated Script End ***"
def __init__(self, location, sceneConfig, cameraInfo, metadata={}, sections={}): DataSetBuilder.__init__(self, location, cameraInfo, metadata, sections) simple.LoadDistributedPlugin('RGBZView') self.view = simple.CreateView("RGBZView") self.view.ImageFormatExtension = 'png' # Only option for scalar data self.view.ViewSize = sceneConfig['size'] self.view.CenterAxesVisibility = 0 self.view.OrientationAxesVisibility = 0 self.view.UpdatePropertyInformation() # Initialize camera for key, value in sceneConfig['camera'].iteritems(): self.view.GetProperty(key).SetData(value) # Create a representation for all scene sources self.config = sceneConfig self.representations = [] for data in self.config['scene']: rep = simple.Show(data['source'], self.view) self.representations.append(rep) # Add directory path self.dataHandler.registerData(name='directory', rootFile=True, fileName='file.txt', categories=['trash']) self.offsetMap = {}
def __init__(self, isWriter=True, removePNG=True): simple.LoadDistributedPlugin('RGBZView') self.view = simple.CreateView('RGBZView') self.view.Background = [0.0, 0.0, 0.0] self.view.CenterAxesVisibility = 0 self.view.OrientationAxesVisibility = 0 self.reader = vtkPNGReader() self.cleanAfterMe = removePNG self.canWrite = isWriter
def __init__(self, simulationDirectory='', templateName='template', **kwargs): super(SandTankEngine, self).__init__() self.runName = os.path.basename(simulationDirectory) self.workdir = simulationDirectory self.pfbReader = None self.vtkReader = None self.lastProcessedTimestep = -1 self.lastEcoSLIMTimestep = -1 self.lastConfig = None self.templateName = templateName self.domain = None self.refreshRate = 0.5 # in seconds simple.LoadDistributedPlugin('ParFlow') self.reset()
import os, json from paraview import simple from paraview import smtesting from paraview import data_exploration as cinema smtesting.ProcessCommandLineArguments() work_directory = os.path.join(smtesting.TempDir, 'cinema') has_rgbz_view = True try: simple.LoadDistributedPlugin('RGBZView', ns=globals()) except: has_rgbz_view = False # === Data to explore and configuration ======================================= data_to_explore = simple.Wavelet() min = 63.96153259277344 max = 250.22056579589844 center_of_rotation = [0.0, 0.0, 0.0] rotation_axis = [0.0, 0.0, 1.0] angle_steps = (72, 60) distance = 60 lut = simple.GetLookupTableForArray("RTData", 1, RGBPoints=[ min, 0.23, 0.299, 0.754, (min + max) * 0.5, 0.865, 0.865, 0.865, max, 0.706, 0.016, 0.15 ],
p1.UnRegister(None) cls1 = c.ProxiesNS.getClass(p1) p2 = smpxm.NewProxy("animation_writers", "PNG") p2.UnRegister(None) cls2 = c.ProxiesNS.getClass(p2) assert cls1 is not cls2 #============================================================================== # create a proxy not in one of the standard proxy groups. assert not hasattr(c.ProxiesNS, "delivery_managers") dm = smpxm.NewProxy("delivery_managers", "RenderViewDeliveryManager") dm.UnRegister(None) cls = c.ProxiesNS.getClass(dm) assert cls is not None help(cls) try: simple.LoadDistributedPlugin("Moments") test_plugin = True except RuntimeError: print_warning("Moments plugin cannot be loaded. Skipping plugin testing") test_plugin = False if test_plugin: assert "MomentVectors" in dir(c.ProxiesNS.filters) mv = simple.MomentVectors()