gavo.protocols.soda module

Helper functions for SODA manipulators.

This primarily comprises various WCS helpers. It is built on base.coords, which is where you’ll get the wcsFields.

Note that this must not use things from protocols.datalink, as it is imported from there. Essentially, use this space for helpers for SODA manipulations that are generic enough to be kept outside of the RD but not generic enough to go do base.coords.

class gavo.protocols.soda.DatalinkFault(code, pubDID, message, exceptionClass, semantics, description=None)[source]

Bases: object

A datalink error (“fault”, as it’s called in the spec).

These are usually constructed using one of the classmethods

  • AuthenticationFault – Not authenticated (and authentication required)

  • AuthorizationFault – Not authorized (to access the resource)

  • NotFoundFault – Unknown ID value

  • UsageFault – Invalid input (e.g. no ID values)

  • TransientFault – Service is not currently able to function

  • FatalFault – Service cannot perform requested action

  • Fault – General error (not covered above)

all of which take the pubDID that caused the failure and a human-oriented error message.

classmethod AuthenticationFault(pubDID, message, semantics='', description=None)
classmethod AuthorizationFault(pubDID, message, semantics='', description=None)
classmethod FatalFault(pubDID, message, semantics='', description=None)
classmethod Fault(pubDID, message, semantics='', description=None)
classmethod NotFoundFault(pubDID, message, semantics='', description=None)
classmethod TransientFault(pubDID, message, semantics='', description=None)
classmethod UsageFault(pubDID, message, semantics='', description=None)

returns an error row for the datalink response.

exception gavo.protocols.soda.DeliverNow[source]

Bases: gavo.utils.excs.ExecutiveAction

can be raised by data functions to abort all further processing and return the current to the client.

exception gavo.protocols.soda.EmptyData[source]

Bases: gavo.utils.excs.ExecutiveAction

raise this when you notice you won’t have any data to return.

responseCode = 204
responsePayload = ''
exception gavo.protocols.soda.FormatNow[source]

Bases: gavo.utils.excs.ExecutiveAction

can be raised by data functions to abort all further processing and format the current

gavo.protocols.soda.addPolygonSlices(descriptor, poly, srcPar='Unknown')[source]

adds slicings in descriptor.slices for a pgsphere.SPoly poly.

srcPar is the name of the parameter that generated the polygon (for making error messages)

gavo.protocols.soda.doAxisCutout(descriptor, args)[source]

updates on a FITS descriptor, interpreting the parameters defined by iter*AxisKeys, passed in in args.

This is the main implementation of //soda#fits_doWCSCutout


furnishes a soda fits descriptor with skyWCS and spatialAxes attributes if necessary.

This is usually called by the functions needing this automatically, and it’s a no-op if it has already run.

skyWCS will be None after this function as run if no usable WCS is found; otherwise, it will be a astropy.wcs.WCS instance. Additionally, spatialAxes will be a sequence of 1-based axis indices, and an empty dictionary axisNames is available to be filled by metaMakers. It will then map the SODA parameter name to either a FITS axis index or to the special WCSLONG, WCSLAT values.

gavo.protocols.soda.iterOtherAxisKeys(descriptor, axisMetaOverrides)[source]

yields inputKeys for all non-spatial WCS axes.

descriptor must be a FITSDescriptor.

gavo.protocols.soda.iterSpatialAxisKeys(descriptor, axisMetaOverrides)[source]

yields SODA inputKeys for spatial cutouts along the spatial coordinate axes.

This can be nothing if descriptor doesn’t have a skyWCS attribute or if it’s None.