Mappings Resources¶
Objects that map a data array to attributes for visualization
Doc links:
_BaseDataMapping
_BaseMapping
_BaseResource
_BaseUIDModel
HasProperties
MappingCategory
MappingContinuous
MappingDiscrete
-
class
lfview.resources.spatial.mappings.
_BaseMapping
(**kwargs)¶ Base class for all mapping types
Optional Properties:
- description (
ShortString
): Description of resource, a unicode string and less than 5000 characters - name (
ShortString
): Name or title of resource, a unicode string and less than 300 characters - uid (
String
): Unique object identifier, a unicode string
- description (
-
class
lfview.resources.spatial.mappings.
_BaseDataMapping
(**kwargs)¶ Base class for array-data mappings
Optional Properties:
- description (
ShortString
): Description of resource, a unicode string and less than 5000 characters - name (
ShortString
): Name or title of resource, a unicode string and less than 300 characters - uid (
String
): Unique object identifier, a unicode string
- description (
-
class
lfview.resources.spatial.mappings.
MappingContinuous
(**kwargs)¶ Mapping of continuous data to a continuous gradient
The most common use-case for continuous mappings is colormaps by specifying a N x 3 color gradient and a transfer function between data values and the gradient as sketched below.
Note: Visualization clients may have limited support for complicated transfer functions. For best results, use
mapping.data_controls = [0., 0, 1, 1]
or[1., 1, 0, 0]
. When combined withmapping.visibility = [False, True, True, True, False]
you get 5 color regions for your data:-Inf
todata_controls[0]
- Not visibledata_controls[0]
todata_controls[1]
- Low gradient valuedata_controls[1]
todata_controls[2]
- Gradient dynamic rangedata_controls[2]
todata_controls[3]
- High gradient valuedata_controls[3]
toInf
- Not visible
# gradient # 1 # - # -| x - - - - - - -> # gradient | / # controls | / # | / # -| <- - - - - - x # | # | # - # 0 # <------------|---|--------------> data # data_controls
Required Properties:
- data_controls (a list of
Float
): Data values for data/gradient inflection points; these values must be increasing and -inf/inf are implicit lower/upper values, a list (each item is a float) with length between 2 and 4 - gradient (
Array
instance or UID): Array defining the gradient, an instance of Array or a valid uid property of that class - gradient_controls (a list of
Float
): Normalized gradient values for data/gradient inflection points; length must equal len(data_controls), a list (each item is a float in range [0, 1]) with length between 2 and 4, Default: new instance of list - interpolate (
Boolean
): If True, interpolate the gradient values; if False, only use values explicitly in the gradient, a boolean, Default: False - visibility (a list of
Boolean
): True if region between control points is visible; length must equal len(data_controls) + 1, a list (each item is a boolean) with length between 3 and 5, Default: new instance of list
Optional Properties:
- description (
ShortString
): Description of resource, a unicode string and less than 5000 characters - name (
ShortString
): Name or title of resource, a unicode string and less than 300 characters - uid (
String
): Unique object identifier, a unicode string
-
class
lfview.resources.spatial.mappings.
MappingDiscrete
(**kwargs)¶ Mapping of continuous data to discrete intervals
These mappings are used to categorize continuous numeric data. Define the limits of the intervals by specifying end points, and specify if the end points are inclusive in the lower or upper bucket. Then assign values to each interval.
# values # # -- x - - - - -> # # -- x - - - o # # -- <- - - - - - o # # <------------|--------|------------> data # end_points
Required Properties:
- end_inclusive (a list of
Boolean
): True if corresponding end is inclusive for lower range and false if it is inclusive for upper range; must be specified for each interval, a list (each item is a boolean) with length between 0 and 255 - end_points (a list of
Float
): Data end values of discrete intervals; these also correspond to the start of the next interval. First start and final end are fixed at -inf and inf, respectively., a list (each item is a float) with length between 0 and 255 - values (a list of
Color
, a list ofFloat
, a list ofShortString
): Values corresponding to intervals, a list (each item is a color) with length between 0 and 256 or a list (each item is a float) with length between 0 and 256 or a list (each item is a unicode string and less than 300 characters) with length between 0 and 256 - visibility (a list of
Boolean
): True if interval is visible; must be specified for each interval, a list (each item is a boolean) with length between 0 and 256
Optional Properties:
- description (
ShortString
): Description of resource, a unicode string and less than 5000 characters - name (
ShortString
): Name or title of resource, a unicode string and less than 300 characters - uid (
String
): Unique object identifier, a unicode string
- end_inclusive (a list of
-
class
lfview.resources.spatial.mappings.
MappingCategory
(**kwargs)¶ Mapping of integer index values to categories
These mappings are used to define categories on
spatial.resources.spatial.data.DataCategory
as well as color and other visual aspects. Data array values correspond to indices which then map to the values. If an array value is not present in indices, it is assumed there is no data at that location.# values # # -- x # # -- x # # -- x # # | | | # indices
Required Properties:
- indices (a list of
Integer
): Array indices for values, a list (each item is an integer in range [0, inf]) with length between 0 and 256 - values (a list of
Color
, a list ofFloat
, a list ofShortString
): Values corresponding to indices, a list (each item is a color) with length between 0 and 256 or a list (each item is a float) with length between 0 and 256 or a list (each item is a unicode string and less than 300 characters) with length between 0 and 256 - visibility (a list of
Boolean
): True if category is visible, a list (each item is a boolean) with length between 0 and 256
Optional Properties:
- description (
ShortString
): Description of resource, a unicode string and less than 5000 characters - name (
ShortString
): Name or title of resource, a unicode string and less than 300 characters - uid (
String
): Unique object identifier, a unicode string
- indices (a list of