jimbraun / XCDF

XCDF: eXplicitly Compacted Data Format. See documentation at Read the Docs:
https://xcdf.readthedocs.io/en/latest/
Other
14 stars 8 forks source link

Histogram/select for vector-vector data is problematic #69

Closed jimbraun closed 8 years ago

jimbraun commented 8 years ago

This is relevant now that we have 2D vectors. The vector comparison logic in xcdf/utility/Histogram.h and xcdf/utility/Node.h is fuzzy and should be fixed. We currently support scalar-scalar, scalar-vector, and vector-vector (provided the two vectors are the same length) relations.

The following vector field relations should be supported:

  1. Relating any field to a scalar field. No check needed here. Draw each item from the vector and take the scalar value for each draw.
  2. Relating a 1D vector field to a 1D vector field: OK if fields have the same parent. We currently support this by checking that the two vectors are the same length. Draw once from either field for each entry. This is generally valid for comparing two fields that have the same parent.
  3. Relating a mD vector field to an nD vector field, where m>n. Only works if the nD field is a parent of the mD field. If this is the case, draw each item from the mD field and take the corresponding value from the nD field.

So basically:

  1. Check for a scalar. Output length will be length of the vector field.
  2. Check for a shared first-level parent. Output length will be the parent's value.
  3. Check if one field is a parent. Output length will be the length of the non-parent field.

Relations are not transitive, so when e.g. making a 2D histogram with a weight expression, both axes need to be compared against the weight expression, and the axes must be compared against each other.

jimbraun commented 8 years ago

There should be some parent machinery that a node's parent hierarchy is known when the node is constructed. This avoids costly runtime parent checking.

The hierarchy should be somehow available from NumericalExpression so it can be used when constructing histograms.