glucifer.objects module

Module Summary

classes:

glucifer.objects.ColourBar The ColourBar drawing object draws a colour bar for the provided colour map.
glucifer.objects.SurfaceOnMesh This drawing object class draws a surface using the provided scalar field.
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.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.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
glucifer.objects.Drawing This is the base class for all drawing objects but can also be instantiated as is for direct/custom drawing.

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.SurfaceOnMesh(mesh, fn, drawSides='xyzXYZ', colours=None, colourMap=None, colourBar=True, valueRange=None, logScale=False, discrete=False, *args, **kwargs)[source]

Bases: glucifer.objects.CrossSection

This drawing object class draws a surface using the provided scalar field. This object differs from the Surface class in that it samples the mesh nodes directly, as opposed to sampling across a regular grid. This class should be used in particular where a mesh has been deformed.

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

Notes

The interface to this object will be revised in future versions.

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.VectorArrows(mesh, fn, resolutionI=16, resolutionJ=16, resolutionK=16, *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 compared with the arrow length. Must be in [0.,1.].
  • scaling (float) – Scaling for entire arrow.
  • glyphs (int) – Type of glyph to render for vector arrow. 0: Line, 1 or more: 3d arrow, higher number => better quality.
  • resolutionI (unsigned) – Number of samples in the I direction.
  • resolutionJ (unsigned) – Number of samples in the J direction.
  • resolutionK (unsigned) – Number of samples in the K direction.
class glucifer.objects.Points(swarm, fn_colour=None, fn_mask=None, fn_size=None, colourVariable=None, colours=None, colourMap=None, colourBar=True, valueRange=None, logScale=False, discrete=False, *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.Surface(mesh, fn, drawSides='xyzXYZ', colours=None, colourMap=None, colourBar=True, valueRange=None, logScale=False, discrete=False, *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, resolutionI=64, resolutionJ=64, resolutionK=64, colours=None, colourMap=None, colourBar=True, valueRange=None, logScale=False, discrete=False, *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.
  • resolutionI (unsigned) – Number of samples in the I direction.
  • resolutionJ (unsigned) – Number of samples in the J direction.
  • resolutionK (unsigned) – Number of samples in the K direction.
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.ColourMap(colours='#288FD0 #fbfb9f #FF7520', 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”] This should not be specified if ‘colourMap’ is specified.
  • 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, colours=None, colourMap=None, colourBar=True, valueRange=None, logScale=False, discrete=False, offsetEdges=None, *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 (unsigned) – Surface rendered sampling resolution.
crossSection

crossSection (str) – Cross Section definition, eg;: z=0.

class glucifer.objects.Drawing(name=None, colours=None, colourMap=None, 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

colourBar (dict) – 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
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