db.style package¶
Submodules¶
db.style.false_colour module¶
A collection of Python functions for creating false colour representations of objects
-
db.style.false_colour.
calculate_false_colour_num
(val_flt, max_flt, min_flt, max_colours_flt)[source]¶ Calculates a colour number via interpolation
Parameters: - val_flt – value used to calculate colour number
- min_flt – lower bound of value
- max_flt – upper bound of value
- max_colours_flt – maximum number of colours
Returns: integer colour number
-
db.style.false_colour.
interpolate
(x_flt, xmin_flt, xmax_flt, ymin_flt, ymax_flt)[source]¶ Given x, linearly interpolates a y-value
Parameters: - x_flt – floating point number to be interpolated
- xmin_flt – minimum value within x_flt’s range
- xmax_flt – maximum value within x_flt’s range
- ymin_flt – minimum possible value to output
- ymax_flt – maximum possible value to output
Returns: interpolated y-value, float
-
db.style.false_colour.
make_false_colour_tup
(i_flt, imin_flt, imax_flt)[source]¶ - This creates a false colour map, returns an RGBA tuple.
- Maps a floating point value that varies between a min and max value to an RGBA tuple
Parameters: - i_flt – floating point value to be mapped
- imax_flt – maximum range of the floating point value
- imin_flt – minimum range of the floating point value
Returns: returns an RGBA float tuple (R,G,B,A)
db.style.style module¶
Contains the STYLE class
-
class
db.style.style.
STYLE
[source]¶ Bases:
object
Container class for style (colour, shading etc.) of objects
-
__colour_table
= None¶ colour table dictionary, integer keys, (R,G,B,A) 4-float tuple values
-
__is_single_colour
= None¶ Boolean, True if rgba_tup has been set, and colour table has not been set
-
__label_table
= None¶ label table dict, keys are integers, values are strings
-
__rgba_tup
= None¶ If one colour is specified then it is stored here as an (R,G,B,A) 4 float tuple
-
add_rgba_tup
(val)[source]¶ Sets the single colour for objects of only one colour :param val: single colour, (R,G,B,A) 4-float tuple
-
add_tables
(colour_table, label_table)[source]¶ Add a colour table and a label table :param colour_table: new colour table value :param label_table: new colour table value
-
get_colour_table
(idx=0)[source]¶ Get the colour table :returns: dictionary, integer keys, (R,G,B,A) 4-float tuple values
-
get_label_table
(idx=0)[source]¶ Get the label table :returns: dictionary, integer keys, string values
-