glucifer.objects module

Module Summary

classes:

glucifer.objects.ColourBar The ColourBar drawing object draws a colour bar for the provided colour map.
glucifer.objects.VectorArrows This drawing object class draws vector arrows corresponding to the provided vector field.
glucifer.objects.Points This drawing object class draws a swarm of points.
glucifer.objects.Sampler The Sampler class provides functionality for sampling a field at a number of provided vertices.
glucifer.objects.Surface This drawing object class draws a surface using the provided scalar field.
glucifer.objects.Volume This drawing object class draws a volume using the provided scalar field.
glucifer.objects.Mesh This drawing object class draws a mesh.
glucifer.objects.Contours This drawing object class draws contour lines in a cross section using the provided scalar field.
glucifer.objects.ColourMap The ColourMap class provides functionality for mapping colours to numerical values.
glucifer.objects.CrossSection This drawing object class defines a cross-section plane, derived classes plot data over this cross section
glucifer.objects.Drawing This is the base class for all drawing objects but can also be instantiated as is for direct/custom drawing.
glucifer.objects.IsoSurface This drawing object class draws an isosurface using the provided scalar field.

Module Details

classes:

class glucifer.objects.ColourBar(colourMap, *args, **kwargs)[source]

Bases: glucifer.objects.Drawing

The ColourBar drawing object draws a colour bar for the provided colour map.

Parameters:colourMap (glucifer.objects.ColourMap) – Colour map for which the colour bar will be drawn.
class glucifer.objects.VectorArrows(mesh, fn, resolution=[16, 16, 16], autoscale=True, *args, **kwargs)[source]

Bases: glucifer.objects._GridSampler3D

This 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 glucifer.objects.Points(swarm, fn_colour=None, fn_mask=None, fn_size=None, colourVariable=None, colourBar=True, *args, **kwargs)[source]

Bases: glucifer.objects.Drawing

This drawing object class draws a swarm of points.

See parent class for further parameter details. Also see property docstrings.

Parameters:
class glucifer.objects.Sampler(mesh, fn, *args, **kwargs)[source]

Bases: glucifer.objects.Drawing

The Sampler class provides functionality for sampling a field at a number of provided vertices.

Parameters:
class glucifer.objects.Surface(mesh, fn, drawSides='xyzXYZ', colourBar=True, *args, **kwargs)[source]

Bases: glucifer.objects.CrossSection

This 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 glucifer.objects.Volume(mesh, fn, resolution=[64, 64, 64], colourBar=True, *args, **kwargs)[source]

Bases: glucifer.objects._GridSampler3D

This 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.
class glucifer.objects.Mesh(mesh, nodeNumbers=False, segmentsPerEdge=1, *args, **kwargs)[source]

Bases: glucifer.objects.Drawing

This 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 glucifer.objects.Contours(mesh, fn, labelFormat='', unitScaling=1.0, interval=0.33, limits=(0.0, 0.0), *args, **kwargs)[source]

Bases: glucifer.objects.CrossSection

This 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 glucifer.objects.ColourMap(colours='diverge', valueRange=None, logScale=False, discrete=False, **kwargs)[source]

Bases: underworld._stgermain.StgCompoundComponent

The 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 glucifer.objects.CrossSection(mesh, fn, crossSection='', resolution=[100, 100, 1], colourBar=True, offsetEdges=None, onMesh=False, *args, **kwargs)[source]

Bases: glucifer.objects.Drawing

This 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.
crossSection

Cross Section definition, eg;: z=0.

Type:crossSection (str)
class glucifer.objects.Drawing(name=None, colours=None, colourMap='', colourBar=False, valueRange=None, logScale=False, discrete=False, *args, **kwargs)[source]

Bases: underworld._stgermain.StgCompoundComponent

This 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 (glucifer.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
colourBar

return colour bar of drawing object, create if doesn’t yet exist.

Type:colourBar (object)
colourMap

return colour map of drawing object

Type:colourMap (object)
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
point(pos=(0.0, 0.0, 0.0))[source]

Draws a point

Parameters:pos (tuple) – X,Y,Z position to place the point
vector(position=(0.0, 0.0, 0.0), vector=(0.0, 0.0, 0.0))[source]

Draws a vector

Parameters:
  • position (tuple) – X,Y,Z position to centre vector on
  • vector (tuple) – X,Y,Z vector value
class glucifer.objects.IsoSurface(mesh, fn, fn_colour=None, resolution=[64, 64, 64], colourBar=True, isovalue=None, *args, **kwargs)[source]

Bases: glucifer.objects.Volume

This 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.