pyCAPS
pyCAPS: A Python Extension Module for CAPS
|
Defines a CAPS viewer object. More...
Public Member Functions | |
def | __init__ (self, browserName=None, portNumber=7681, oneBias=True, html="file:/$ESP_ROOT/lib/capsViewer.html") |
Initialize the viewer object. More... | |
def | startServer (self, enableCheck=True) |
Start the server. More... | |
def | addVertex (self, xyz, name=None) |
Add a vertex set. More... | |
def | addIndex (self, connectivity, name=None) |
Add a element connectivity set. More... | |
def | addLineIndex (self, connectivity, name=None) |
Add a element connectivity set with the intention of creating graphical lines on triangular primitives. More... | |
def | addColor (self, colorData, minColor=None, maxColor=None, numContour=0, reverseMap=False, colorMap="blues", name=None) |
Add color/scalar data set. More... | |
def | addLineColor (self, colorData, minColor=None, maxColor=None, numContour=0, reverseMap=False, colorMap="blues", name=None) |
Add color/scalar data set for the graphical lines on triangular primitives. More... | |
def | createPrimitive (self, type, items=None, name=None) |
Create a generic graphic primitive. More... | |
def | createPoint (self, items=None, name=None) |
Create a point graphic primitive. More... | |
def | createLine (self, items=None, name=None, turnOn=True) |
Create a line graphic primitive. More... | |
def | createTriangle (self, items=None, name=None, turnOn=True) |
Create a triangular graphic primitive. More... | |
def | clearItems (self) |
Clear the "current" list of "wvData items (objects)". More... | |
def | addDataSet (self, dataSet) |
Add a _capsDataSet (see _capsDataSet) object(s). More... | |
def | addBound (self, bound, dataSetType="both") |
Alias to addDataBound. | |
def | addDataBound (self, bound, dataSetType="both") |
Add a _capsBound (see _capsBound) object(s). More... | |
def | addTecplot (self, filename) |
Add a Tecplot file. More... | |
def | addUnstructMesh (self, meshFile) |
Add a unstructured mesh file. More... | |
Defines a CAPS viewer object.
A capsViewer object is a Pythonized version of Bob Haimes's "wv: A General Web-based 3D Viewer" API. wv's goal is "to generate a visual tool targeted for the 3D needs found within the MDAO process. A WebBrowser-based approach is considered, in that it provides the broadest possible platform for deployment."
def __init__ | ( | self, | |
browserName = None , |
|||
portNumber = 7681 , |
|||
oneBias = True , |
|||
html = "file:/$ESP_ROOT/lib/capsViewer.html" |
|||
) |
Initialize the viewer object.
See webviewer.py for an example use case.
browserName | Name of browser to load (default - None). If left as None the system level default browser will be used. |
portNumber | Port number to start the server listening on (default - 7681). |
oneBias | Flag to indicate the index biasing of the data. Options: 1 bias (default - True) or 0 bias (False) indexed. |
html | Specify an alternative HTML file to launch when starting the server, see startServer (default - "file:/$ESP_ROOT/lib/capsViewer.html") |
def addColor | ( | self, | |
colorData, | |||
minColor = None , |
|||
maxColor = None , |
|||
numContour = 0 , |
|||
reverseMap = False , |
|||
colorMap = "blues" , |
|||
name = None |
|||
) |
Add color/scalar data set.
See webviewer.py for an example use case.
colorData | A list of color/scalar data to be applied at each node (e.g. [ node1_Color, node2_Color, node3_Color, etc.]). Cell-centered coloring isn't currently supported. |
minColor | Minimum color value to use for scaling (default - None). If None, the minimum value is determined automatically from the colorData provided. When plotting multiple color/data sets a minimum value should be provided to ensure that all data is scaled the same. |
maxColor | Maximum color value to use for scaling (default - None). If None, the maximum value is determined automatically from the colorData provided. When plotting multiple color/data sets a maximum value should be provided to ensure that all data is scaled the same. |
numContour | Number of contour levels to use in the color map (default - 0 for a continuous color map). |
reverseMap | Reverse or invert the color map (default - False). |
colorMap | Name of color map to use of visualization. Options: "blues" (default), "reds", "greys" (or "grays"), "blue_red" (or "bwr"), "jet", "rainbow", "hot", "cool". |
name | Name of color set (default - None). |
def addDataBound | ( | self, | |
bound, | |||
dataSetType = "both" |
|||
) |
Add a _capsBound (see _capsBound) object(s).
bound | A single or list of instances of _capsBound objects. |
dataSetType | Specifies which type of data sets in the bound should be added, source or destination. Options: "source", "destination, or "both" (default) - values are case insensitive. |
def addDataSet | ( | self, | |
dataSet | |||
) |
Add a _capsDataSet (see _capsDataSet) object(s).
A graphic primitive will be created automatically for each data set. Note, however, if multiple data sets share the same vertex set (see _capsVertexSet) the data in the repeated vertex sets will be appended into a single primitive.
dataSet | A single or list of instances of _caspDataSet objects. |
def addIndex | ( | self, | |
connectivity, | |||
name = None |
|||
) |
Add a element connectivity set.
See webviewer.py for an example use case.
connectivity | A list of lists of connectivity information (e.g. [ [node1, node2, node3], [node2, node3, node7, node8], etc. ]). Elements that >3 edges will internally be decomposed into triangles. Note that whether or not the connectivity information is one biased was specified during capsViewer initialization (see capsViewer.__init__ ), no further checks are currently made. |
name | Name of connectivity set (default - None). |
def addLineColor | ( | self, | |
colorData, | |||
minColor = None , |
|||
maxColor = None , |
|||
numContour = 0 , |
|||
reverseMap = False , |
|||
colorMap = "blues" , |
|||
name = None |
|||
) |
Add color/scalar data set for the graphical lines on triangular primitives.
(addLineIndex ). See webviewer.py for an example use case.
colorData | A list of color/scalar data to be applied at each node (e.g. [ node1_Color, node2_Color, node3_Color, etc.]). |
minColor | Minimum color value to use for scaling (default - None). If None, the minimum value is determined automatically from the colorData provided. When plotting multiple color/data sets a minimum value should be provided to ensure that all data is scaled the same. |
maxColor | Maximum color value to use for scaling (default - None). If None, the maximum value is determined automatically from the colorData provided. When plotting multiple color/data sets a maximum value should be provided to ensure that all data is scaled the same. |
numContour | Number of contour levels to use in the color map (default - 0 for a continuous color map). |
reverseMap | Reverse or invert the color map (default - False). |
colorMap | Name of color map to use of visualization. Options: "blues" (default), "reds", "greys" (or "grays"), "blue_red" (or "bwr"), "jet", "rainbow", "hot", "cool". |
name | Name of color set (default - None). |
def addLineIndex | ( | self, | |
connectivity, | |||
name = None |
|||
) |
Add a element connectivity set with the intention of creating graphical lines on triangular primitives.
See webviewer.py for an example use case.
connectivity | A list of lists of connectivity information (e.g. [ [node1, node2, node3], [node2, node3, node7, node8], etc. ]). Note that whether or not the connectivity information is one biased was specified during capsViewer initialization (see capsViewer.__init__ ), no further checks are currently made. |
name | Name of line set (default - None). |
def addTecplot | ( | self, | |
filename | |||
) |
Add a Tecplot file.
filename | Name of Tecplot file to load. |
def addUnstructMesh | ( | self, | |
meshFile | |||
) |
Add a unstructured mesh file.
Note that in most cases the mesh's name (see capsUnstructMesh.$name) will be used for the name of the primitive.
meshFile | Name of unstructured mesh file to load or an instance of a capsUnstructMesh(see capsUnstructMesh) object. |
def addVertex | ( | self, | |
xyz, | |||
name = None |
|||
) |
Add a vertex set.
See webviewer.py for an example use case.
xyz | A list of lists of x,y, z values (e.g. [ [x2, y2, z2], [x2, y2, z2],[x3, y3, z3], etc. ] ) |
name | Name of vertex set (default - None). |
def clearItems | ( | self | ) |
Clear the "current" list of "wvData items (objects)".
def createLine | ( | self, | |
items = None , |
|||
name = None , |
|||
turnOn = True |
|||
) |
Create a line graphic primitive.
items | List of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used! |
name | Name of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique. |
def createPoint | ( | self, | |
items = None , |
|||
name = None |
|||
) |
Create a point graphic primitive.
items | List of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used! |
name | Name of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique. |
def createPrimitive | ( | self, | |
type, | |||
items = None , |
|||
name = None |
|||
) |
Create a generic graphic primitive.
type | Type of primitive to create. Options: "point", "line", or "triangle" (case insensitive) |
items | List of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used! |
name | Name of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique. |
def createTriangle | ( | self, | |
items = None , |
|||
name = None , |
|||
turnOn = True |
|||
) |
Create a triangular graphic primitive.
See webviewer.py for an example use case.
items | List of "wvData items (objects)" used to create the triangle (default - None). If none are provided all current items added will be used! |
name | Name of graphic primitive (default - GPrim_#, where # is 1 + number of primitives previously loaded). Important: If specified, the name must be unique. |
def startServer | ( | self, | |
enableCheck = True |
|||
) |
Start the server.
The port number specified when initializing the viewer object will be used (see capsViewer.__init__ ). Note that the server will continue to run as long as the browser is still connected, once the connection is broken the capViewer object should be deleted! See webviewer.py for an example use case.
enableCheck | Enable checks to ensure all primitives have the same number colors and that the limits for each color are initially the same. |