lux.processor package

Submodules

lux.processor.Compiler module

class lux.processor.Compiler.Compiler[source]

Bases: object

Given a intent with underspecified inputs, compile the intent into fully specified visualizations for visualization.

static compile_intent(ldf: lux.core.frame.LuxDataFrame, _inferred_intent: List[lux.vis.Clause.Clause]) → lux.vis.VisList.VisList[source]

Compiles input specifications in the intent of the ldf into a collection of lux.vis objects for visualization. 1) Enumerate a collection of visualizations interested by the user to generate a vis list 2) Expand underspecified specifications(lux.Clause) for each of the generated visualizations. 3) Determine encoding properties for each vis

Parameters:
  • ldf (lux.core.frame) – LuxDataFrame with underspecified intent.
  • vis_collection (list[lux.vis.Vis]) – empty list that will be populated with specified lux.Vis objects.
Returns:

vis_collection – vis list with compiled lux.Vis objects.

Return type:

list[lux.Vis]

static compile_vis(ldf: lux.core.frame.LuxDataFrame, vis: lux.vis.Vis.Vis) → lux.vis.Vis.Vis[source]

Root method for compiling visualizations

Parameters:
Returns:

Compiled Vis object

Return type:

Vis

static determine_encoding(ldf: lux.core.frame.LuxDataFrame, vis: lux.vis.Vis.Vis)[source]

Populates Vis with the appropriate mark type and channel information based on ShowMe logic Currently support up to 3 dimensions or measures

Parameters:
  • ldf (lux.core.frame) – LuxDataFrame with underspecified intent
  • vis (lux.vis.Vis) –
Returns:

Return type:

None

Notes

Implementing automatic encoding from Tableau’s VizQL Mackinlay, J. D., Hanrahan, P., & Stolte, C. (2007). Show Me: Automatic presentation for visual analysis. IEEE Transactions on Visualization and Computer Graphics, 13(6), 1137–1144. https://doi.org/10.1109/TVCG.2007.70594

static enforce_specified_channel(vis: lux.vis.Vis.Vis, auto_channel: Dict[str, str])[source]

Enforces that the channels specified in the Vis by users overrides the showMe autoChannels.

Parameters:
  • vis (lux.vis.Vis) – Input Vis without channel specification.
  • auto_channel (Dict[str,str]) – Key-value pair in the form [channel: attributeName] specifying the showMe recommended channel location.
Returns:

vis – Vis with channel specification combining both original and auto_channel specification.

Return type:

lux.vis.Vis

Raises:

ValueError – Ensures no more than one attribute is placed in the same channel.

static enumerate_collection(_inferred_intent: List[lux.vis.Clause.Clause], ldf: lux.core.frame.LuxDataFrame) → lux.vis.VisList.VisList[source]

Given specifications that have been expanded thorught populateOptions, recursively iterate over the resulting list combinations to generate a vis list.

Parameters:ldf (lux.core.frame) – LuxDataFrame with underspecified intent.
Returns:VisList – vis list with compiled lux.Vis objects.
Return type:list[lux.Vis]
static populate_data_type_model(ldf, vlist)[source]

Given a underspecified Clause, populate the data_type and data_model information accordingly

Parameters:
  • ldf (lux.core.frame) – LuxDataFrame with underspecified intent
  • vis_collection (list[lux.vis.Vis]) – List of lux.Vis objects that will have their underspecified Clause details filled out.
static populate_wildcard_options(_inferred_intent: List[lux.vis.Clause.Clause], ldf: lux.core.frame.LuxDataFrame) → dict[source]

Given wildcards and constraints in the LuxDataFrame’s intent, return the list of available values that satisfies the data_type or data_model constraints.

Parameters:ldf (LuxDataFrame) – LuxDataFrame with row or attributes populated with available wildcard options.
Returns:intent – a dictionary that holds the attributes and filters generated from wildcards and constraints.
Return type:Dict[str,list]
static remove_all_invalid(vis_collection: lux.vis.VisList.VisList) → lux.vis.VisList.VisList[source]

Given an expanded vis list, remove all visualizations that are invalid. Currently, the invalid visualizations are ones that contain two of the same attribute, no more than two temporal attributes, or overlapping attributes (same filter attribute and visualized attribute). :param vis_collection: empty list that will be populated with specified lux.Vis objects. :type vis_collection: list[lux.vis.Vis]

Returns:vis list with compiled lux.Vis objects.
Return type:lux.vis.VisList

lux.processor.Parser module

class lux.processor.Parser.Parser[source]

Bases: object

The parser takes in the user’s input specifications (with string description fields), then generates the Lux internal specification through lux.Clause.

static parse(intent: List[Union[str, lux.vis.Clause.Clause]]) → List[lux.vis.Clause.Clause][source]

Given the string description from a list of input Clauses (intent), assign the appropriate clause.attribute, clause.filter_op, and clause.value.

Parameters:intent (List[Clause]) – Underspecified list of lux.Clause objects.
Returns:Parsed list of lux.Clause objects.
Return type:List[Clause]

lux.processor.Validator module

class lux.processor.Validator.Validator[source]

Bases: object

Contains methods for validating lux.Clause objects in the intent.

static validate_intent(intent: List[lux.vis.Clause.Clause], ldf: lux.core.frame.LuxDataFrame) → None[source]

Validates input specifications from the user to find inconsistencies and errors.

Parameters:ldf (lux.core.frame) – LuxDataFrame with underspecified intent.
Returns:
Return type:None
Raises:ValueError – Ensures input intent are consistent with DataFrame content.

Module contents