Package gavo :: Package protocols :: Module soda
[frames] | no frames]

Module soda

source code

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.

Classes
  EmptyData
raise this when you notice you won't have any data to return.
  DatalinkFault
A datalink error ("fault", as it's called in the spec).
  FormatNow
can be raised by data functions to abort all further processing and format the current descriptor.data.
  DeliverNow
can be raised by data functions to abort all further processing and return the current descriptor.data to the client.
Functions
 
ensureSkyWCS(descriptor)
furnishes a soda fits descriptor with skyWCS and spatialAxes attributes if necessary.
source code
 
iterSpatialAxisKeys(descriptor, axisMetaOverrides)
yields SODA inputKeys for spatial cutouts along the spatial coordinate axes.
source code
 
iterOtherAxisKeys(descriptor, axisMetaOverrides)
yields inputKeys for all non-spatial WCS axes.
source code
 
addPolygonSlices(descriptor, poly, srcPar='Unknown')
adds slicings in descriptor.slices for a pgsphere.SPoly poly.
source code
 
doAxisCutout(descriptor, args)
updates descriptor.data on a FITS descriptor, interpreting the parameters defined by iter*AxisKeys, passed in in args.
source code
Variables
  DEFAULT_SEMANTICS = 'http://dc.g-vo.org/datalink#other'
  __package__ = 'gavo.protocols'
Function Details

ensureSkyWCS(descriptor)

source code 

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.

iterSpatialAxisKeys(descriptor, axisMetaOverrides)

source code 

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.

iterOtherAxisKeys(descriptor, axisMetaOverrides)

source code 

yields inputKeys for all non-spatial WCS axes.

descriptor must be a FITSDescriptor.

addPolygonSlices(descriptor, poly, srcPar='Unknown')

source code 

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)

doAxisCutout(descriptor, args)

source code 

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

This is the main implementation of //soda#fits_doWCSCutout