Spectral

class pyvo.registry.Spectral(spec)[source]

Bases: Constraint

A RegTAP constraint on the spectral coverage of resources.

This is a RegTAP 1.2 extension not yet available on all Registries (in 2022). Worse, not too many resources bother declaring this at this point. For robustness, it might be preferable to use the Waveband constraint for the time being..

This constraint accepts quantities, i.e., values with units, and will convert them to RegTAP’s representation (which is Joule of particle energy) if it can. This ought to work for wavelengths, frequencies, and energies. Plain numbers are interpreted as particle energies in Joule.

RegTAP uses the observer frame at the solar system barycenter, but it is probably wise to use constraints suitably relaxed such that frame and reference position (within reason) do not matter.

To find resources covering the messenger particle energy 5 eV:

>>> from astropy import units as u
>>> from pyvo import registry
>>> resources =  registry.Spectral(5*u.eV)

To find resources overlapping the band between 5000 and 6000 Ångström:

>>> resources =  registry.Spectral((5000*u.Angstrom, 6000*u.Angstrom))

To find resources having data in the FM band:

>>> resources =  registry.Spectral((88*u.MHz, 102*u.MHz))
Parameters
specastropy.Quantity or a 2-tuple of astropy.Quantity-s

A spectral point or interval to cover. This must be a wavelength, a frequency, or an energy, or a pair of such quantities, in which case the argument is interpreted as an interval. All resources overlapping the interval are returned. Plain floats are interpreted as messenger energy in Joule.

Attributes Summary

takes_sequence

Methods Summary

get_search_condition(service)

Formats this constraint to an ADQL fragment.

Attributes Documentation

takes_sequence = True

Methods Documentation

get_search_condition(service)[source]

Formats this constraint to an ADQL fragment.

This takes the service the constraint is being executed on as an argument because constraints may be written differently depending on the service’s features or refuse to run altogether.

Parameters
serviceTAPService

The RegTAP service the query is supposed to be run on (that is relevant because we adapt to the features available on given services).

Returns
str

A string ready for inclusion into a WHERE clause.