Data

In Steno3D, binding data to resources requires both a DataArray and a data binder. These binders are documented within each composite resource. The binders provide information about where the data maps to the mesh. In most cases the available mesh locations are ‘N’, nodes, and ‘CC’, cell centers. The easiest way to do this binding is to use a dictionary with entries ‘location’ (either ‘N’ or ‘CC’) and ‘data’ (the DataArray).

Additionally, a resource can have any number of associated data arrays; simply provide a list of these data binder dictionaries. Here is a code snippet to show data binding in action; this assumes the surface contains a mesh with 9 vertices and 4 faces (ie a 2x2 square grid).

>> ...
>> my_surface = steno3d.Surface(...)
>> ...
>> my_node_data = steno3d.DataArray(
       title='Nine Numbers',
       array=[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
   )
>> my_face_data = steno3d.DataArray(
       title='Four Numbers',
       array=[0.0, 1.0, 2.0, 3.0]
   )
>> my_surface.data = [
       dict(
           location='N',
           data=my_node_data
       ),
       dict(
           location='CC',
           data=my_face_data
        )
   ]

Mapping data to a mesh is staightforward for unstructured meshes (those defined by vertices, segments, triangles, etc); the order of the data array simply corresponds to the order of the associated mesh parameter. For grid meshes, however, mapping 1D data array to the 2D or 3D grid requires correctly ordered unwrapping. The default is C-style, row-major ordering, order='c'. To align data this way, you may start with a numpy array that is size (x, y) for 2D data or size (x, y, z) for 3D data then use numpy’s flatten() function with default order ‘C’. Alternatively, if your data uses Fortran- or Matlab-style, column-major ordering, you may specify data order='f'. For in-depth examples of binding data to resources please refer to the example notebooks.

class steno3d.data.DataArray(array=None, **kwargs)[source]

Data array with unique values at every point in the mesh

Required Properties:

  • array (Array): Data, unique values at every point in the mesh, a list or numpy array of <type ‘float’>, <type ‘int’> with shape (*)
  • order (StringChoice): Data array order, for data on grid meshes, either “c” or “f”, Default: c

Optional Properties:

  • colormap (a list of Color): Colormap applied to data range or categories, a list (each item is a color) with length between 1 and 256
  • description (String): Description of the model., a unicode string
  • title (String): Title of the model., a unicode string
class steno3d.data.DataCategory(array=None, **kwargs)[source]

Data array with indices and corresponding string categories

For locations with no data, use -1 for index. If colormap is unspecified, colors will be randomized.

Required Properties:

  • array (Array): Category index values at every point in the mesh, a list or numpy array of <type ‘int’> with shape (*)
  • order (StringChoice): Data array order, for data on grid meshes, either “c” or “f”, Default: c

Optional Properties:

  • categories (a list of String): List of string categories, a list (each item is a unicode string) with length between 1 and 256
  • colormap (a list of Color): Colormap applied to data range or categories, a list (each item is a color) with length between 1 and 256
  • description (String): Description of the model., a unicode string
  • title (String): Title of the model., a unicode string