coprocessing Module

This module is designed for use in co-processing Python scripts. It provides a class, Pipeline, which is designed to be used as the base-class for Python pipeline. Additionally, this module has several other utility functions that are approriate for co-processing.

class paraview.coprocessing.CoProcessor[source]

Bases: object

Base class for co-processing Pipelines. paraview.cpstate Module can be used to dump out ParaView states as co-processing pipelines. Those are typically subclasses of this. The subclasses must provide an implementation for the CreatePipeline() method.

CoProcessor maintains user-defined information for the Cinema generation in

__CinemaTracks. This information includes track parameter values, data array names, etc. __CinemaTracks holds this information in the following structure:

{ proxy_reference
: { ‘ControlName’ : [value_1, value_2, ..., value_n],
‘arraySelection’ : [‘ArrayName_1’, ..., ‘ArrayName_n’] } }

__CinemaTracks is populated when defining the co-processing pipline through paraview.cpstate. paraview.cpstate uses accessor instances to set values and array names through the RegisterCinemaTrack and AddArraysToCinemaTrack methods

of this class.

AddArraysToCinemaTrack(proxy, propertyName, arrayNames)[source]

Register user-defined target arrays by name.

CreatePipeline(datadescription)[source]

This methods must be overridden by subclasses to create the visualization pipeline.

CreateProducer(datadescription, inputname)[source]

Creates a producer proxy for the grid. This method is generally used in CreatePipeline() call to create producers.

CreateView(proxy_ctor, filename, freq, fittoscreen, magnification, width, height)[source]

**** DEPRECATED!!! Use RegisterView instead **** Create a CoProcessing view for image capture with extra meta-data such as magnification, size and frequency.

CreateWriter(proxy_ctor, filename, freq)[source]

**** DEPRECATED!!! Use RegisterWriter instead **** Creates a writer proxy. This method is generally used in CreatePipeline() to create writers. All writes created as such will write the output files appropriately in WriteData() is called.

DoLiveVisualization(datadescription, hostname, port)[source]

This method execute the code-stub needed to communicate with ParaView for live-visualization. Call this method only if you want to support live-visualization with your co-processing module.

EnableLiveVisualization(enable, frequency=1)[source]

Call this method to enable live-visualization. When enabled, DoLiveVisualization() will communicate with ParaView server if possible for live visualization. Frequency specifies how often the communication happens (default is every second).

Finalize()[source]
LoadRequestedData(datadescription)[source]

Call this method in RequestDataDescription co-processing pass to mark the datadescription with information about what fields and grids are required for this pipeline for the given timestep, if any.

Default implementation uses the update-frequencies set using SetUpdateFrequencies() to determine if the current timestep needs to be processed and then requests all fields. Subclasses can override this method to provide addtional customizations.

RegisterCinemaTrack(name, proxy, smproperty, valrange)[source]

Register a point of control (filter’s property) that will be varied over in a cinema export.

RegisterView(view, filename, freq, fittoscreen, magnification, width, height, cinema=None)[source]

Register a view for image capture with extra meta-data such as magnification, size and frequency.

RegisterWriter(writer, filename, freq)[source]

Registers a writer proxy. This method is generally used in CreatePipeline() to register writers. All writes created as such will write the output files appropriately in WriteData() is called.

RescaleDataRange(view, time)[source]

DataRange can change across time, sometime we want to rescale the color map to match to the closer actual data range.

SetUpdateFrequencies(frequencies)[source]

Set the frequencies at which the pipeline needs to be updated. Typically, this is called by the subclass once it has determined what timesteps co-processing will be needed to be done. frequencies is a map, with key->string name of for the simulation input, and value is a list of frequencies.

UpdateCinema(view, datadescription, specLevel)[source]

called from catalyst at each timestep to add to the cinema database

UpdateProducers(datadescription)[source]

This method will update the producers in the pipeline. If the pipeline is not created, it will be created using self.CreatePipeline().

WriteData(datadescription)[source]

This method will update all writes present in the pipeline, as needed, to generate the output data files, respecting the write-frequencies set on the writers.

WriteImages(datadescription, rescale_lookuptable=False)[source]

This method will update all views, if present and write output images, as needed.

WriterParametersProxy(writer, filename, freq)[source]

Creates a client only proxy that will be synchronized with ParaView Live, allowing a user to set the filename and frequency.

paraview.coprocessing.IsInModulo(timestep, frequencyArray)[source]

Return True if the given timestep is in one of the provided frequency. This can be interpreted as follow:

isFM = IsInModulo(timestep, [2,3,7])

is similar to:

isFM = (timestep % 2 == 0) or (timestep % 3 == 0) or (timestep % 7 == 0)