gavo.stc.dm module

Definition of the structure of the internal representation (the AST).

For now, we want to be able to capture what STC-S can do (and a bit more). This means that we do not support generic coordinates (yet), elements, xlink and all the other stuff.

class gavo.stc.dm.AllSky(fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None)[source]

Bases: _Geometry

adaptDepUnits()[source]
adaptValuesWith(converter)[source]
asSMoc(order=6)[source]
getTransformed(sTrafo, destFrame)[source]
class gavo.stc.dm.Box(boxsize=None, center=None, fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None)[source]

Bases: _Geometry

adaptValuesWith(converter)[source]
getTransformed(sTrafo, destFrame)[source]

returns a Polygon corresponding to this Box after rotation.

class gavo.stc.dm.Circle(center=None, fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, radius=None, size=None, ucd=None)[source]

Bases: _Geometry

adaptValuesWith(converter)[source]
asSMoc(order)[source]
classmethod fromPg(frame, sCircle)[source]
getTransformed(sTrafo, destFrame)[source]
pgClass

alias of SCircle

class gavo.stc.dm.Convex(fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None, vectors=())[source]

Bases: _Geometry

adaptValuesWith(converter)[source]
getTransformed(sTrafo, destFrame)[source]
class gavo.stc.dm.CooWiggle(id=None, origUnit=None, ucd=None, values=())[source]

Bases: _WiggleSpec

A wiggle given in coordinates.

The values attributes stores them just like coordinates are stored.

adaptValuesWith(unitConverter)[source]
getValues()[source]
inexactAttrs = {'values'}
class gavo.stc.dm.CoordSys(id=None, libraryId=None, name=None, redshiftFrame=None, spaceFrame=None, spectralFrame=None, timeFrame=None, ucd=None)[source]

Bases: ASTNode

is an astronomical coordinate system.

class gavo.stc.dm.Difference(children=(), fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None)[source]

Bases: _Compound

class gavo.stc.dm.Ellipse(center=None, fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, posAngle=None, size=None, smajAxis=None, sminAxis=None, ucd=None)[source]

Bases: _Geometry

adaptValuesWith(converter)[source]
getTransformed(sTrafo, destFrame)[source]
class gavo.stc.dm.Intersection(children=(), fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None)[source]

Bases: _MultiOpCompound

class gavo.stc.dm.MatrixWiggle(id=None, matrices=(), origUnit=None, ucd=None)[source]

Bases: _WiggleSpec

A matrix for specifying wiggle.

The matrix/matrices are stored as sequences of sequences; see stcxgen._wrapMatrix for details.

adaptValuesWith(unitConverter)[source]
class gavo.stc.dm.Not(children=(), fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None)[source]

Bases: _Compound

class gavo.stc.dm.Polygon(fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None, vertices=())[source]

Bases: _Geometry

adaptValuesWith(converter)[source]
asSMoc(order=6)[source]
classmethod fromPg(frame, sPoly)[source]
getTransformed(sTrafo, destFrame)[source]
pgClass

alias of SPoly

gavo.stc.dm.PositionInterval

alias of SpaceInterval

class gavo.stc.dm.RadiusWiggle(id=None, origUnit=None, radii=(), ucd=None)[source]

Bases: _WiggleSpec

An wiggle given as a radius.

If unit adaption is necessary and the base value is a vector, the radii are assumed to be of the dimension of the first vector component.

adaptValuesWith(unitConverter)[source]
getValues()[source]
inexactAttrs = {'radii'}
class gavo.stc.dm.RedshiftCoo(error=None, frame=None, id=None, name=None, pixSize=None, resolution=None, size=None, ucd=None, unit=None, value=None, velTimeUnit=None)[source]

Bases: _Coordinate, _RedshiftMixin

class gavo.stc.dm.RedshiftFrame(dopplerDef=None, id=None, name=None, refPos=None, type=None, ucd=None)[source]

Bases: _CoordFrame

nDim = 1
class gavo.stc.dm.RedshiftInterval(fillFactor=None, frame=None, id=None, lowerLimit=None, name=None, origUnit=None, ucd=None, upperLimit=None)[source]

Bases: _CoordinateInterval

cType

alias of RedshiftType

class gavo.stc.dm.RedshiftType[source]

Bases: _CooTypeSentinel

posAttr = 'redshift'
class gavo.stc.dm.RefPos(id=None, planetaryEphemeris=None, standardOrigin=None, ucd=None)[source]

Bases: ASTNode

is a reference position.

Right now, this is just a wrapper for a RefPos id, as defined by STC-S, or None for Unknown.

class gavo.stc.dm.STCSpec(areas=(), astroSystem=None, freq=None, freqAs=(), id=None, place=None, redshift=None, redshiftAs=(), systems=(), time=None, timeAs=(), ucd=None, velocity=None, velocityAs=())[source]

Bases: ASTNode

is an STC specification, i.e., the root of an STC tree.

binarize()[source]

returns self with any compound present brought to a binary tree.

This will return self if nothing needs to change.

buildIdMap()[source]
debinarize()[source]

returns self with any compound present brought to a binary tree.

This will return self if nothing needs to change.

getColRefs()[source]

returns a list of column references embedded in this AST.

polish()[source]

does global fixups when parsing is finished.

This method has to be called after the element is complete. The standard parsers do this.

For convenience, it returns the instance itself.

stripUnits()[source]

removes all unit specifications from this AST.

This is intended for non-standalone STC, e.g., in VOTables, where external unit specifications are present. Removing the units prevents “bleeding out” of conflicting in-STC specifications (that mostly enter through defaulting).

This ignores the immutability of nodes and is in general a major pain.

property sys
class gavo.stc.dm.SpaceCoo(epoch=None, error=None, frame=None, id=None, name=None, pixSize=None, resolution=None, size=None, ucd=None, unit=(), value=None, yearDef=None)[source]

Bases: _Coordinate, _SpatialMixin

pgClass

alias of SPoint

class gavo.stc.dm.SpaceFrame(equinox=None, flavor='SPHERICAL', id=None, nDim=None, name=None, refFrame=None, refPos=None, ucd=None)[source]

Bases: _CoordFrame

asTriple()[source]

returns a triple defining the space frame for spherc’s purposes.

This is for the computation of coordinate transforms. Since we only do coordinate transforms for spherical coordinate systems, this will, for now, raise STCValueErrors if everything but 2 or 3D SPHERICAL flavours. The other cases need more thought anyway.

getEquinox()[source]

returns a datetime.datetime instance for the frame’s equinox.

It will return None if no equinox is given, and it may raise an STCValueError if an invalid equinox string has been set.

class gavo.stc.dm.SpaceInterval(fillFactor=None, frame=None, id=None, lowerLimit=None, name=None, origUnit=None, ucd=None, upperLimit=None)[source]

Bases: _CoordinateInterval

cType

alias of SpaceType

classmethod fromPg(frame, pgBox)[source]
getTransformed(sTrafo, destFrame)[source]
getValues()[source]
pgClass

alias of SBox

class gavo.stc.dm.SpaceType[source]

Bases: _CooTypeSentinel

posAttr = 'place'
class gavo.stc.dm.SpectralCoo(error=None, frame=None, id=None, name=None, pixSize=None, resolution=None, size=None, ucd=None, unit=None, value=None)[source]

Bases: _Coordinate, _OneDMixin

cType

alias of SpectralType

class gavo.stc.dm.SpectralFrame(id=None, name=None, refPos=None, ucd=None)[source]

Bases: _CoordFrame

nDim = 1
class gavo.stc.dm.SpectralInterval(fillFactor=None, frame=None, id=None, lowerLimit=None, name=None, origUnit=None, ucd=None, upperLimit=None)[source]

Bases: _CoordinateInterval

cType

alias of SpectralType

class gavo.stc.dm.SpectralType[source]

Bases: _CooTypeSentinel

posAttr = 'freq'
class gavo.stc.dm.TimeCoo(error=None, frame=None, id=None, name=None, pixSize=None, resolution=None, size=None, ucd=None, unit=None, value=None)[source]

Bases: _Coordinate, _OneDMixin

cType

alias of TimeType

iterTransformed(converter)[source]
class gavo.stc.dm.TimeFrame(id=None, name=None, refPos=None, timeScale=None, ucd=None)[source]

Bases: _CoordFrame

nDim = 1
class gavo.stc.dm.TimeInterval(fillFactor=None, frame=None, id=None, lowerLimit=None, name=None, origUnit=None, ucd=None, upperLimit=None)[source]

Bases: _CoordinateInterval

adaptValuesWith(converter)[source]
cType

alias of TimeType

class gavo.stc.dm.TimeType[source]

Bases: _CooTypeSentinel

posAttr = 'time'
class gavo.stc.dm.Union(children=(), fillFactor=None, frame=None, geoColRef=None, id=None, name=None, origUnit=None, size=None, ucd=None)[source]

Bases: _MultiOpCompound

class gavo.stc.dm.VelocityCoo(epoch=None, error=None, frame=None, id=None, name=None, pixSize=None, resolution=None, size=None, ucd=None, unit=(), value=None, velTimeUnit=(), yearDef=None)[source]

Bases: _Coordinate, _VelocityMixin

class gavo.stc.dm.VelocityInterval(fillFactor=None, frame=None, id=None, lowerLimit=None, name=None, origUnit=None, ucd=None, upperLimit=None)[source]

Bases: _CoordinateInterval

cType

alias of VelocityType

class gavo.stc.dm.VelocityType[source]

Bases: _CooTypeSentinel

posAttr = 'velocity'
gavo.stc.dm.binarizeCompound(compound)[source]

returns compound as a binary tree.

For unions and intersections, compounds consisting of more than two operands will be split up into parts of two arguments each.

gavo.stc.dm.debinarizeCompound(compound)[source]

returns compound with flattened operators.

gavo.stc.dm.fromPgSphere(refFrame, pgGeom)[source]

Returns an AST for a pgsphere object as defined in utils.pgsphere.

This interprets the pgSphere box as a coordinate interval, which is wrong but probably what most VO protocols expect.