gavo.stc.eq module¶
Determining equivalence for STC systems.
Frequenently, one needs to decide if two systems are “close enough” to work together, e.g., when building geometries or for ADQL geometry predicates. This code lets you define matching policies.
- class gavo.stc.eq.EquivalenceCondition[source]¶
Bases:
object
A base class for EquivalencePolicy elements.
An EquivalenceCondition has a check(sys1, sys2) -> boolean method. Everything else is up to the individual objects.
- class gavo.stc.eq.EquivalencePolicy(checkedKeys)[source]¶
Bases:
object
A policy specifying when two STC system objects are considered equivalent.
checkedKeys is a sequence of EquivalenceConditions or strings. If strings are passed, they are turned into KeysEquivalent conditions for the keys specified in the strings.
You can also pass entire STC trees to match.
- class gavo.stc.eq.KeysEquivalent(key)[source]¶
Bases:
EquivalenceCondition
An equivalence condition specifying a certain key being equal if non-None in both objects.
key is a dot-seperated sequence of attribute names within STC system objects.
- class gavo.stc.eq.RefFramesEquivalent[source]¶
Bases:
EquivalenceCondition
An equivalence condition tailored for reference frames.
It considers ICRS and FK5 J2000 equivalent.
- gavo.stc.eq.makeKeyGetter(key)[source]¶
returns a function getting key from an object.
key is dot-seperated sequence of python identifiers (this is checked; a ValueError is raised at generation time for malformed keys).
This function is used to generate functions accessing parts of STC trees. If any attribute within key does not exist, the generated functions return None.