gavo.protocols.scs module

IVOA cone search: Helper functions, a core, and misc.

class gavo.protocols.scs.SCSCore(parent, **kwargs)[source]

Bases: DBCore

A core performing cone searches.

This will, if it finds input parameters it can make out a position from, add a _r column giving the distance between the match center and the columns that a cone search will match against.

If any of the conditions for adding _r aren’t met, this will silently degrade to a plain DBCore.

You will almost certainly want a:

<FEED source="//scs#coreDescs"/>

in the body of this (in addition to whatever other custom conditions you may have).

attrSeq = [<gavo.base.complexattrs.StructListAttribute object>, <gavo.base.attrdef.BooleanAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.attrdef.IntAttribute object>, <gavo.rscdef.common.NamePathAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.base.parsecontext.ReferenceAttribute object>, <gavo.rscdef.common.RDAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>]
clearProperty(name)
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
hasProperty(name)
managedAttrs = {'condDesc': <gavo.base.complexattrs.StructListAttribute object>, 'condDescs': <gavo.base.complexattrs.StructListAttribute object>, 'distinct': <gavo.base.attrdef.BooleanAttribute object>, 'groupBy': <gavo.base.attrdef.UnicodeAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'inputTable': <gavo.base.complexattrs.StructAttribute object>, 'limit': <gavo.base.attrdef.IntAttribute object>, 'namePath': <gavo.rscdef.common.NamePathAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'outputTable': <gavo.base.complexattrs.StructAttribute object>, 'properties': <gavo.base.complexattrs.PropertyAttribute object>, 'property': <gavo.base.complexattrs.PropertyAttribute object>, 'queriedTable': <gavo.base.parsecontext.ReferenceAttribute object>, 'rd': <gavo.rscdef.common.RDAttribute object>, 'sortKey': <gavo.base.attrdef.UnicodeAttribute object>}
name_ = 'scsCore'
onElementComplete()[source]
property rd
resolveName(context, id)
setProperty(name, value)
gavo.protocols.scs.findNClosest(alpha, delta, tableDef, n, fields, searchRadius=5)[source]

returns the n objects closest around alpha, delta in table.

n is the number of items returned, with the closest ones at the top, fields is a sequence of desired field names, searchRadius is a radius for the initial q3c search and will need to be lowered for dense catalogues and possibly raised for sparse ones.

The last item of each row is the distance of the object from the query center in degrees.

gavo.protocols.scs.getConeColumns(td)[source]

returns the columns the cone search will use as positions in a tableDef.

This will raise an error if these are not present or not unique. Both new-style and old-style UCDs are accepted.

gavo.protocols.scs.getRadialCondition(td, ra, dec, sr, raColName=None, decColName=None)[source]

returns a sql literal for building a spatial query over the tableDef td.

ra, dec, and sr are as in SCS. While this function does some mild last-resort checking in case things break, you must not pass in untrusted content in there. It’s ok to pass in columns or expressions, though.

raCol and decCol are determined through UCDs if not given. This will preferentially use q3c and fall back to pgsphere if no q3c indices can be discerned on the columns.

In case no SCS UCDs are present, the function will also accept spoints with pos.eq;meta.main. This, of course, will not work with SCS itself (out of the box).

gavo.protocols.scs.parseHumanSpoint(cooSpec, colName=None)[source]

tries to interpret cooSpec as some sort of cone center.

Attempted interpretations include various forms of coordinate pairs and simbad objects; hence, this will in general cause network traffic.

If no sense can be made, a ValidationError on colName is raised.