underworld.visualisation.objects module
This module provides different drawing objects for visualisation in Underworld.
Classes
The ColourBar drawing object draws a colour bar for the provided colour map. |
|
The ColourMap class provides functionality for mapping colours to numerical values. |
|
This drawing object class draws contour lines in a cross section using the provided scalar field. |
|
This drawing object class defines a cross-section plane, derived classes plot data over this cross section |
|
This is the base class for all drawing objects but can also be instantiated as is for direct/custom drawing. |
|
This drawing object class draws an isosurface using the provided scalar field. |
|
This drawing object class draws a mesh. |
|
This drawing object class draws a swarm of points. |
|
The Sampler class provides functionality for sampling a field at a number of provided vertices. |
|
This drawing object class draws a surface using the provided scalar field. |
|
This drawing object class draws vector arrows corresponding to the provided vector field. |
|
This drawing object class draws a volume using the provided scalar field. |
- class underworld.visualisation.objects.ColourBar(self, colourMap, *args, **kwargs)[source]
Bases:
DrawingThe ColourBar drawing object draws a colour bar for the provided colour map.
- Parameters:
colourMap (visualisation.objects.ColourMap) – Colour map for which the colour bar will be drawn.
- class underworld.visualisation.objects.ColourMap(self, colours='diverge', valueRange=None, logScale=False, discrete=False, **kwargs)[source]
Bases:
StgCompoundComponentThe ColourMap class provides functionality for mapping colours to numerical values.
- Parameters:
colours (str, list) – List of colours to use for drawing object colour map. Provided as a string or as a list of strings. Example, “red blue”, or [“red”, “blue”]
valueRange (tuple, list) – User defined value range to apply to colour map. Provided as a tuple of floats (minValue, maxValue). If none is provided, the value range will be determined automatically.
logScale (bool) – Bool to determine if the colourMap should use a logarithmic scale.
discrete (bool) – Bool to determine if a discrete colour map should be used. Discrete colour maps do not interpolate between colours and instead use nearest neighbour for colouring.
- class underworld.visualisation.objects.Contours(self, mesh, fn, labelFormat='', unitScaling=1.0, interval=0.33, limits=(0.0, 0.0), *args, **kwargs)[source]
Bases:
CrossSectionThis drawing object class draws contour lines in a cross section using the provided scalar field.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh over which cross section is rendered.
fn (underworld.function.Function) – Function used to determine values to render.
labelFormat (str) – Format string (printf style) used to print a contour label, eg: “ %g K”
unitScaling – Scaling factor to apply to value when printing labels
interval (float) – Interval between contour lines
limits (tuple, list) – User defined minimum and maximum limits for the contours. Provided as a tuple/list of floats (minValue, maxValue). If none is provided, the limits will be determined automatically.
- class underworld.visualisation.objects.CrossSection(self, mesh, fn, crossSection='', resolution=[100, 100, 1], colourBar=True, offsetEdges=None, onMesh=False, *args, **kwargs)[source]
Bases:
DrawingThis drawing object class defines a cross-section plane, derived classes plot data over this cross section
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh over which cross section is rendered.
fn (underworld.function.Function) – Function used to determine values to render.
crossSection (str) – Cross Section definition, eg. z=0.
resolution (list(unsigned)) – Surface sampling resolution.
onMesh (boolean) – Sample the mesh nodes directly, as opposed to sampling across a regular grid. This flag should be used in particular where a mesh has been deformed.
- property crossSection
Cross Section definition, eg;: z=0.
- Type:
crossSection (str)
- class underworld.visualisation.objects.Drawing(self, name=None, colours=None, colourMap='', colourBar=False, valueRange=None, logScale=False, discrete=False, *args, **kwargs)[source]
Bases:
StgCompoundComponentThis is the base class for all drawing objects but can also be instantiated as is for direct/custom drawing.
Note that the defaults here are often overridden by the child objects.
- Parameters:
colours (str, list.) – See ColourMap class docstring for further information
colourMap (visualisation.objects.ColourMap) – A ColourMap object for the object to use. This should not be specified if ‘colours’ is specified.
opacity (float) – Opacity of object. If provided, must take values from 0. to 1.
colourBar (bool) – Bool to determine if a colour bar should be rendered.
valueRange (tuple, list) – See ColourMap class docstring for further information
logScale (bool) – See ColourMap class docstring for further information
discrete (bool) – See ColourMap class docstring for further information
- property colourBar
return colour bar of drawing object, create if doesn’t yet exist.
- label(text, pos=(0.0, 0.0, 0.0), font='sans', scaling=1)[source]
Writes a label string
- Parameters:
text (str) – label text.
pos (tuple) – X,Y,Z position to place the label.
font (str) – label font (small/fixed/sans/serif/vector).
scaling (float) – label font scaling (for “vector” font only).
- line(start=(0.0, 0.0, 0.0), end=(0.0, 0.0, 0.0))[source]
Draws a line
- Parameters:
start (tuple) – X,Y,Z position to start line
end (tuple) – X,Y,Z position to end line
- class underworld.visualisation.objects.IsoSurface(self, mesh, fn, fn_colour=None, resolution=[64, 64, 64], colourBar=True, isovalue=None, *args, **kwargs)[source]
Bases:
VolumeThis drawing object class draws an isosurface using the provided scalar field.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh over which object is rendered.
fn (underworld.function.Function) – Function used to determine surface position. Function should return a vector of floats/doubles.
fn_colour (underworld.function.Function) – Function used to determine colour of surface.
resolution (list(unsigned)) – Number of samples in the I,J,K directions.
isovalue (float) – Isovalue to plot.
isovalues (list of float) – List of multiple isovalues to plot.
- class underworld.visualisation.objects.Mesh(self, mesh, nodeNumbers=False, segmentsPerEdge=1, *args, **kwargs)[source]
Bases:
DrawingThis drawing object class draws a mesh.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh to render.
nodeNumbers (bool) – Bool to determine whether global node numbers should be rendered.
segmentsPerEdge (unsigned) – Number of segments to render per cell/element edge. For higher order mesh, more segments are useful to render mesh curvature correctly.
- class underworld.visualisation.objects.Points(self, swarm, fn_colour=None, fn_mask=None, fn_size=None, colourVariable=None, colourBar=True, *args, **kwargs)[source]
Bases:
DrawingThis drawing object class draws a swarm of points.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
swarm (underworld.swarm.Swarm) – Swarm which provides locations for point rendering.
fn_colour (underworld.function.Function) – Function used to determine colour to render particle. This function should return float/double values.
fn_mask (underworld.function.Function) – Function used to determine if a particle should be rendered. This function should return bool values.
fn_size (underworld.function.Function) – Function used to determine size to render particle. This function should return float/double values.
- class underworld.visualisation.objects.Sampler(self, mesh, fn, *args, **kwargs)[source]
Bases:
DrawingThe Sampler class provides functionality for sampling a field at a number of provided vertices.
- Parameters:
vertices (list,array) – List of vertices to sample the field at, either a list or numpy array
mesh (underworld.mesh.FeMesh) – Mesh over which the values are sampled
fn (underworld.function.Function) – Function used to get the sampled values.
- class underworld.visualisation.objects.Surface(self, mesh, fn, drawSides='xyzXYZ', colourBar=True, onMesh=None, *args, **kwargs)[source]
Bases:
CrossSectionThis drawing object class draws a surface using the provided scalar field.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh over which cross section is rendered.
fn (underworld.function.Function) – Function used to determine values to render.
drawSides (str) – Sides (x,y,z,X,Y,Z) for which the surface should be drawn. For example, “xyzXYZ” would render the provided function across all surfaces of the domain in 3D. In 2D, this object always renders across the entire domain.
- class underworld.visualisation.objects.VectorArrows(self, mesh, fn, resolution=[16, 16, 16], autoscale=True, *args, **kwargs)[source]
Bases:
_GridSampler3DThis drawing object class draws vector arrows corresponding to the provided vector field.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh over which vector arrows are rendered.
fn (underworld.function.Function) – Function used to determine vectors to render. Function should return a vector of floats/doubles of appropriate dimensionality.
arrowHead (float) – The size of the head of the arrow. If > 1.0 is ratio to arrow radius If in range [0.,1.] is ratio to arrow length
scaling (float) – Scaling for entire arrow.
autoscale (bool) – Scaling based on field min/max
glyphs (int) – Type of glyph to render for vector arrow. 0: Line, 1 or more: 3d arrow, higher number => better quality.
resolution (list(unsigned)) – Number of samples in the I,J,K directions.
- class underworld.visualisation.objects.Volume(self, mesh, fn, resolution=[64, 64, 64], colourBar=True, *args, **kwargs)[source]
Bases:
_GridSampler3DThis drawing object class draws a volume using the provided scalar field.
See parent class for further parameter details. Also see property docstrings.
- Parameters:
mesh (underworld.mesh.FeMesh) – Mesh over which object is rendered.
fn (underworld.function.Function) – Function used to determine colour values. Function should return a vector of floats/doubles of appropriate dimensionality.
resolution (list(unsigned)) – Number of samples in the I,J,K directions.