Package gavo :: Package stc :: Module stcxgen
[frames] | no frames]

Module stcxgen

source code

Converting ASTs to/from STC-X.

The basic idea for conversion to STC-X is that for every ASTNode in dm, there is a serialize_<classname> function returning some xmlstan. In general they should handle the case when their argument is None and return None in that case.

Traversal is done manually (i.e., by each serialize_X method) rather than globally since the children in the AST may not have the right order to keep XSD happy, and also since ASTs are actually a bit more complicated than trees (e.g., coordinate frames usually have multiple parents).

Classes
  Context
is a generation context.
Functions
 
addId(node)
adds a synthetic id attribute to node unless it's already there.
source code
 
strOrNull(val) source code
 
isoformatOrNull(val) source code
 
serialize_RefPos(node, context) source code
 
serialize_SpaceFrame(node, context) source code
 
serialize_TimeFrame(node, context) source code
 
serialize_SpectralFrame(node, context) source code
 
serialize_RedshiftFrame(node, context) source code
 
serialize_CoordSys(node, context) source code
 
serialize_TimeCoo(node, context) source code
 
serialize_RedshiftCoo(node, context) source code
 
serialize_SpectralCoo(node, context) source code
 
serialize_SpaceCoo(node, context) source code
 
serialize_VelocityCoo(node, context) source code
 
serialize_TimeInterval(node, context) source code
 
serialize_SpectralInterval(node, context) source code
 
serialize_RedshiftInterval(node, context) source code
 
serialize_SpaceInterval(node, context) source code
 
serialize_VelocityInterval(node, context) source code
 
serialize_AllSky(node, context) source code
 
serialize_Circle(node, context) source code
 
serialize_Ellipse(node, context) source code
 
serialize_Box(node, context) source code
 
serialize_Polygon(node, context) source code
 
serialize_Convex(node, context) source code
 
serialize_MultiCompound(node, context) source code
 
serialize_Intersection(node, context) source code
 
serialize_Union(node, context) source code
 
serialize_Difference(node, context) source code
 
serialize_Not(node, context) source code
 
makeAreas(rootNode, context)
serializes the areas contained in rootNode.
source code
 
nodeToStan(astNode)
returns xmlstan for an AST node.
source code
 
astToStan(rootNode, stcRoot)
returns STC stan for the AST rootNode wrapped in the stcRoot element.
source code
 
getSTCXProfile(rootNode) source code
Variables
  wiggleClasses = {'error': [(<class 'gavo.stc.stcx.dynamicallyD...
  __package__ = 'gavo.stc'
Function Details

makeAreas(rootNode, context)

source code 

serializes the areas contained in rootNode.

This requires all kinds of insane special handling.

astToStan(rootNode, stcRoot)

source code 

returns STC stan for the AST rootNode wrapped in the stcRoot element.

The first coordinate system defined in the AST is always used for the embedded coordinates and areas.


Variables Details

wiggleClasses

Value:
{'error': [(<class 'gavo.stc.stcx.dynamicallyDefined'>, None, None),
           (<class 'gavo.stc.stcx.dynamicallyDefined'>,
            <class 'gavo.stc.stcx.dynamicallyDefined'>,
            <class 'gavo.stc.stcx.dynamicallyDefined'>),
           (<class 'gavo.stc.stcx.dynamicallyDefined'>,
            <class 'gavo.stc.stcx.dynamicallyDefined'>,
            <class 'gavo.stc.stcx.dynamicallyDefined'>)],
 'pixSize': [(<class 'gavo.stc.stcx.dynamicallyDefined'>, None, None),\
...