| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!-- mixin definition for tables implementing the siap interface(s) --> |
| 3 |
|
| 4 |
<resource resdir="__system" schema="dc"> |
| 5 |
|
| 6 |
<STREAM id="SIAPbase"> |
| 7 |
<FEED source="//products#tablecols"/> |
| 8 |
<column name="centerAlpha" ucd="pos.eq.ra" |
| 9 |
type="double precision" unit="deg" |
| 10 |
displayHint="sf=2" verbLevel="0" tablehead="Ctr. RA" |
| 11 |
description="Approximate center of image, RA"/> |
| 12 |
<column name="centerDelta" ucd="pos.eq.dec" |
| 13 |
tablehead="Ctr. Dec" |
| 14 |
type="double precision" unit="deg" |
| 15 |
displayHint="sf=2" verbLevel="0" |
| 16 |
description="Approximate center of image, Dec"/> |
| 17 |
<column name="imageTitle" ucd="meta.title" |
| 18 |
type="text" tablehead="Title" verbLevel="0" |
| 19 |
description="Synthetic name of the image"/> |
| 20 |
<column name="instId" ucd="meta.id;instr" |
| 21 |
type="text" tablehead="Instrument" verbLevel="15" |
| 22 |
description="Identifier of the originating instrument"/> |
| 23 |
<column name="dateObs" ucd="time;obs.exposure" |
| 24 |
type="double precision" unit="d" tablehead="Obs. date" |
| 25 |
verbLevel="0" description="Epoch at midpoint of observation" |
| 26 |
displayHint="type=humanDate" |
| 27 |
xtype="mjd"/> |
| 28 |
<column name="nAxes" ucd="pos.wcs.naxes" |
| 29 |
type="integer" verbLevel="20" tablehead="#axes" |
| 30 |
description="Number of axes in data"> |
| 31 |
<values nullLiteral="-1"/> |
| 32 |
</column> |
| 33 |
<column name="pixelSize" ucd="pos.wcs.naxis" |
| 34 |
type="integer[]" verbLevel="15" tablehead="Axes Lengths" |
| 35 |
description="Number of pixels along each of the axes" |
| 36 |
unit="pixel"/> |
| 37 |
<column name="pixelScale" ucd="pos.wcs.scale" |
| 38 |
type="real[]" verbLevel="12" tablehead="Scales" |
| 39 |
description="The pixel scale on each image axis" |
| 40 |
unit="deg/pixel"/> |
| 41 |
<column name="refFrame" type="text" |
| 42 |
ucd="pos.frame" |
| 43 |
tablehead="Ref. Frame" |
| 44 |
description="Coordinate system reference frame" |
| 45 |
verbLevel="20"/> |
| 46 |
<column name="wcs_equinox" |
| 47 |
ucd="time.equinox" |
| 48 |
tablehead="Equinox" |
| 49 |
description="Equinox of the given coordinates" unit="yr" |
| 50 |
verbLevel="20"/> |
| 51 |
<column name="wcs_projection" ucd="pos.wcs.ctype" |
| 52 |
type="text" verbLevel="20" |
| 53 |
tablehead="Proj." description="FITS WCS projection type"/> |
| 54 |
<column name="wcs_refPixel" |
| 55 |
ucd="pos.wcs.crpix" |
| 56 |
type="real[]" verbLevel="20" |
| 57 |
tablehead="Ref. pixel" description="WCS reference pixel" |
| 58 |
unit="pixel"/> |
| 59 |
<column name="wcs_refValues" |
| 60 |
ucd="pos.wcs.crval" |
| 61 |
type="double precision[]" |
| 62 |
verbLevel="20" tablehead="Ref. values" |
| 63 |
description="World coordinates at WCS reference pixel" |
| 64 |
unit="deg"/> |
| 65 |
<column name="wcs_cdmatrix" |
| 66 |
ucd="pos.wcs.cdmatrix" |
| 67 |
verbLevel="20" |
| 68 |
type="real[]" tablehead="CD matrix" |
| 69 |
description="FITS WCS CDij matrix" unit="deg/pixel"/> |
| 70 |
<column name="bandpassId" ucd="instr.bandpass" |
| 71 |
tablehead="Bandpass" description="Free-form name of the bandpass used" |
| 72 |
type="text" verbLevel="10"/> |
| 73 |
<column name="bandpassUnit" |
| 74 |
description="Unit of bandpass specifications (always m)." |
| 75 |
tablehead="Bandpass unit" |
| 76 |
type="text" verbLevel="20"/> |
| 77 |
<column name="bandpassRefval" |
| 78 |
unit="m" ucd="instr.bandpass;stat.median" |
| 79 |
verbLevel="20" tablehead="Band Ref." |
| 80 |
description="Characteristic quantity for the bandpass of the image"/> |
| 81 |
<column name="bandpassHi" |
| 82 |
unit="m" ucd="instr.bandpass;stat.max" |
| 83 |
verbLevel="20" tablehead="Band upper" |
| 84 |
description="Upper limit of the bandpass (in BandPass_Unit units)"/> |
| 85 |
<column name="bandpassLo" |
| 86 |
unit="m" ucd="instr.bandpass;stat.min" |
| 87 |
verbLevel="20" tablehead="Band lower" |
| 88 |
description="Lower limit of the bandpass (in BandPass_Unit units)"/> |
| 89 |
<column name="pixflags" |
| 90 |
ucd="meta.code" |
| 91 |
verbLevel="20" |
| 92 |
type="text" tablehead="P. Flags" |
| 93 |
description="Flags specifying the processing done (C-original; F-resampled; Z-fluxes valid; X-not resampled; V-for display only"/> |
| 94 |
</STREAM> |
| 95 |
|
| 96 |
<mixinDef id="pgs"> |
| 97 |
<doc> |
| 98 |
A table mixin for simple support of SIAP. |
| 99 |
|
| 100 |
The columns added into the tables include |
| 101 |
|
| 102 |
- (certain) FITS WCS headers |
| 103 |
- imageTitle (interpolateString should come in handy for these) |
| 104 |
- instId -- some id for the instrument used |
| 105 |
- dateObs -- MJD of the "characteristic" observation time |
| 106 |
- the bandpass* values. You're on your own with them... |
| 107 |
- the values of the product mixin. |
| 108 |
- mimetype -- the mime type of the product. |
| 109 |
- the coverage, centerAlpha and centerDelta, nAxes, |
| 110 |
pixelSize, pixelScale, wcs* fields calculated by the |
| 111 |
computePGS macro. |
| 112 |
|
| 113 |
(their definition is in the siap system RD) |
| 114 |
|
| 115 |
Tables mixing in pgs can be used for SIAP querying and |
| 116 |
automatically mix in the products table mixin. |
| 117 |
|
| 118 |
To feed these tables, use the //siap#computePGS and |
| 119 |
//siap#setMeta procs. Since you are dealing with products, |
| 120 |
you will also need the //products#define rowgen in your grammar. |
| 121 |
</doc> |
| 122 |
<FEED source="//products#hackProductsData"/> |
| 123 |
|
| 124 |
<events> |
| 125 |
<stc> |
| 126 |
Polygon ICRS [coverage] Position "centerAlpha" "centerDelta" |
| 127 |
SpectralInterval "bandpassLo" "bandpassHi" Spectral "bandpassRefval" |
| 128 |
unit m |
| 129 |
</stc> |
| 130 |
<dm> |
| 131 |
(votable:Coords) { |
| 132 |
time: { |
| 133 |
frame: { |
| 134 |
timescale: TT |
| 135 |
refPosition: UNKNOWN |
| 136 |
time0: MJD-origin |
| 137 |
} |
| 138 |
location: @dateObs |
| 139 |
} |
| 140 |
} |
| 141 |
</dm> |
| 142 |
<FEED source="//products#tableRules"/> |
| 143 |
<FEED source="//siap#SIAPbase"/> |
| 144 |
<column name="coverage" type="spoly" unit="deg" |
| 145 |
description="Field covered by the image"/> |
| 146 |
<index columns="coverage" name="pgspos" method="GIST"/> |
| 147 |
<FEED source="//scs#splitPosIndex" lat="centerDelta" |
| 148 |
long="centerAlpha" columns="centerAlpha,centerDelta"/> |
| 149 |
</events> |
| 150 |
</mixinDef> |
| 151 |
|
| 152 |
|
| 153 |
<procDef type="apply" id="computeInputBase"> |
| 154 |
<doc> |
| 155 |
Computes WCS information for SIA tables from FITS WCS keys. |
| 156 |
|
| 157 |
It takes no arguments but expects WCS-like keywords in rowdict, i.e., |
| 158 |
CRVAL1, CRVAL2 (interpreted as float deg), CRPIX1, CRPIX2 (pixel |
| 159 |
corresponding to CRVAL1, CRVAL2), CUNIT1, CUNIT2 (pixel scale unit, |
| 160 |
we bail out if it isn't deg and assume deg when it's not present), |
| 161 |
CDn_n (the transformation matrix; substitutable by CDELTn), NAXISn |
| 162 |
(the image size). |
| 163 |
|
| 164 |
Records without or with insufficient wcs keys are furnished with |
| 165 |
all-NULL wcs info if the missingIsError setup parameter is False, |
| 166 |
else they bomb out with a DataError (the default). |
| 167 |
</doc> |
| 168 |
<setup> |
| 169 |
<par name="missingIsError" description="Throw an exception when |
| 170 |
no WCS information can be located.">True</par> |
| 171 |
<par name="naxis" description="Comma-separated list of integer |
| 172 |
axis indices (1=first) to be considered for WCS">"1,2"</par> |
| 173 |
<code> |
| 174 |
from gavo.protocols import siap |
| 175 |
|
| 176 |
wcskeys = ["centerAlpha", "centerDelta", |
| 177 |
"nAxes", "pixelSize", "pixelScale", "wcs_projection", |
| 178 |
"wcs_refPixel", "wcs_refValues", "wcs_cdmatrix", "wcs_equinox"] |
| 179 |
|
| 180 |
naxis = [int(v) for v in naxis.split(",")] |
| 181 |
|
| 182 |
class PixelGauge(object): |
| 183 |
"""is a container for information about pixel sizes. |
| 184 |
|
| 185 |
It is constructed with an wcs.WCS instance and an (x, y) |
| 186 |
pair of pixel coordinates that should be close to the center |
| 187 |
of the frame. |
| 188 |
""" |
| 189 |
def __init__(self, wcs, centerPix): |
| 190 |
self.centerPos = coords.pix2sky(wcs, centerPix) |
| 191 |
self.pixelScale = coords.getPixelSizeDeg(wcs) |
| 192 |
offCenterPos = coords.pix2sky(wcs, |
| 193 |
(centerPix[0]+1, centerPix[1]+1)) |
| 194 |
|
| 195 |
|
| 196 |
def copyFromWCS(vars, wcs, result): |
| 197 |
"""adds the "simple" WCS keys from the wcstools instance wcs to |
| 198 |
the record result. |
| 199 |
""" |
| 200 |
result["mime"] = "application/fits" |
| 201 |
result["centerAlpha"], result["centerDelta" |
| 202 |
] = coords.getCenterFromWCSFields(wcs) |
| 203 |
result["nAxes"] = int(vars["NAXIS"]) |
| 204 |
axeInds = range(1, result["nAxes"]+1) |
| 205 |
dims = list(int(vars["NAXIS%d"%i]) |
| 206 |
for i in axeInds) |
| 207 |
pixelGauge = PixelGauge(wcs, (dims[0]/2., dims[1]/2.)) |
| 208 |
result["pixelSize"] = dims |
| 209 |
result["pixelScale"] = list(pixelGauge.pixelScale) |
| 210 |
|
| 211 |
result["wcs_projection"] = vars.get("CTYPE1") |
| 212 |
if result["wcs_projection"]: |
| 213 |
result["wcs_projection"] = result["wcs_projection"][5:8] |
| 214 |
result["wcs_refPixel"] = list(wcs.wcs.crpix) |
| 215 |
result["wcs_refValues"] = list(wcs.wcs.crval) |
| 216 |
result["wcs_cdmatrix"] = list( |
| 217 |
(wcs.wcs.get_pc()*wcs.wcs.get_cdelt()).ravel()) |
| 218 |
result["wcs_equinox"] = vars.get("EQUINOX", None) |
| 219 |
|
| 220 |
def nullOutWCS(result, additionalKeys): |
| 221 |
"""clears all wcs fields, plus the ones in additonalKeys. |
| 222 |
""" |
| 223 |
for key in wcskeys+additionalKeys: |
| 224 |
result[key] = None |
| 225 |
|
| 226 |
def addWCS(vars, result, additionalKeys, addCoverage): |
| 227 |
wcs = coords.getWCS(vars, naxis=naxis) |
| 228 |
if wcs is None: |
| 229 |
if missingIsError: |
| 230 |
raise base.DataError("No WCS information") |
| 231 |
else: |
| 232 |
nullOutWCS(result, additionalKeys) |
| 233 |
else: |
| 234 |
copyFromWCS(vars, wcs, result) |
| 235 |
addCoverage(vars, wcs, result) |
| 236 |
</code> |
| 237 |
</setup> |
| 238 |
|
| 239 |
</procDef> |
| 240 |
|
| 241 |
<procDef type="apply" id="computePGS" original="computeInputBase"> |
| 242 |
<code> |
| 243 |
additionalKeys = ["coverage"] |
| 244 |
|
| 245 |
def addCoverage(vars, wcs, result): |
| 246 |
result["coverage"] = coords.getSpolyFromWCSFields(wcs) |
| 247 |
|
| 248 |
try: |
| 249 |
addWCS(vars, result, additionalKeys, addCoverage) |
| 250 |
except KeyError: |
| 251 |
# presumably some basic FITS keyword missing |
| 252 |
if missingIsError: |
| 253 |
raise |
| 254 |
</code> |
| 255 |
</procDef> |
| 256 |
|
| 257 |
<procDef type="apply" id="setMeta"> |
| 258 |
<doc> |
| 259 |
sets siap meta *and* product table fields. |
| 260 |
|
| 261 |
These fields are common to all SIAP implementations. |
| 262 |
|
| 263 |
If you define the bandpasses yourself, do *not* change |
| 264 |
bandpassUnit and give all values in Meters. If you do change |
| 265 |
it, at least obscore would break, but probably more. |
| 266 |
For optical images, we recommend to fill out bandpassId and then |
| 267 |
let the //siap#getBandFromFilter apply compute the actual |
| 268 |
limits. If your band is not known, please supply the |
| 269 |
necessary information to the authors. |
| 270 |
|
| 271 |
Do *not* use ``idmaps="*"`` when using this procDef; it writes |
| 272 |
directly into result, and you would be clobbering what it does. |
| 273 |
</doc> |
| 274 |
<setup> |
| 275 |
<par key="title" late="True" description="image title. This |
| 276 |
should, in as few characters as possible, convey some idea what |
| 277 |
the image will show (e.g., instrument, object, bandpass">None</par> |
| 278 |
<par key="instrument" late="True" description="a short identifier |
| 279 |
for the instrument used">str(rd.getMeta("instrument"))</par> |
| 280 |
<par key="dateObs" late="True" description="the midpoint of the |
| 281 |
observation; this can either be a datetime instance, or |
| 282 |
a float>1e6 (a julian date) or something else (which is then |
| 283 |
interpreted as an MJD)">None</par> |
| 284 |
<par key="bandpassId" late="True" description="a rough indicator |
| 285 |
of the bandpass, like Johnson bands">None</par> |
| 286 |
<par key="bandpassUnit" late="True" description="The unit of |
| 287 |
the bandpassRefval and friends (just don't touch this)">"m"</par> |
| 288 |
<par key="bandpassRefval" late="True" description="characteristic |
| 289 |
frequency or wavelength of the exposure (you usually want to use |
| 290 |
//siap#getBandFromFilter to fill this).">None</par> |
| 291 |
<par key="bandpassHi" late="True" description="lower value of |
| 292 |
wavelength or frequency (you usually want to use |
| 293 |
//siap#getBandFromFilter to fill this).">None</par> |
| 294 |
<par key="bandpassLo" late="True" description="upper value of |
| 295 |
the wavelength or frequency (you usually want to use |
| 296 |
//siap#getBandFromFilter to fill this).">None</par> |
| 297 |
<par key="refFrame" late="True" description="reference frame |
| 298 |
of the coordinates (change at your peril)">'ICRS'</par> |
| 299 |
<par key="pixflags" late="True" description="processing flags |
| 300 |
(C atlas image or cutout, F resampled, X computed without |
| 301 |
interpolation, Z pixel flux |
| 302 |
calibrated, V unspecified visualisation for presentation only)" |
| 303 |
>None</par> |
| 304 |
</setup> |
| 305 |
<code> |
| 306 |
if bandpassUnit!="m": |
| 307 |
base.ui.NotifyWarning("//siap#setMeta has bandpassUnit!=m." |
| 308 |
" That's going to be trouble at the very least.") |
| 309 |
result["dateObs"] = toMJD(dateObs) |
| 310 |
result["imageTitle"] = title |
| 311 |
result["instId"] = instrument |
| 312 |
result["bandpassId"] = bandpassId |
| 313 |
result["bandpassUnit"] = bandpassUnit |
| 314 |
result["bandpassRefval"] = bandpassRefval |
| 315 |
result["bandpassHi"] = bandpassHi |
| 316 |
result["bandpassLo"] = bandpassLo |
| 317 |
result["refFrame"] = refFrame |
| 318 |
result["pixflags"] = pixflags |
| 319 |
</code> |
| 320 |
</procDef> |
| 321 |
|
| 322 |
<procDef type="apply" id="getBandFromFilter"> |
| 323 |
<doc> |
| 324 |
sets the bandpassId, bandpassUnit, bandpassRefval, bandpassHi, |
| 325 |
and bandpassLo from a set of standard band Ids. |
| 326 |
|
| 327 |
The bandpass ids known are contained in a file supplied by |
| 328 |
DaCHS that you should consult for supported values by running |
| 329 |
``dachs admin dumpDF data/filters.txt``. |
| 330 |
|
| 331 |
If you pass in an unknown filter name, no keys will be generated, |
| 332 |
but no diagnostics will be emitted either. Make sure to dachs info |
| 333 |
on the imported table if you expect no NULLs in the bandpass |
| 334 |
columns. |
| 335 |
|
| 336 |
All values filled in here are in meters. |
| 337 |
|
| 338 |
If this is used, it must run after //siap#setMeta since |
| 339 |
setMeta clobbers our result fields. |
| 340 |
</doc> |
| 341 |
<setup imports="gavo.base"> |
| 342 |
<par key="sourceCol" description="Name of the column containing |
| 343 |
the filter name; leave at default None to take the band from |
| 344 |
result['bandpassId'], where such information would be left |
| 345 |
by siap#setMeta.">None</par> |
| 346 |
<code> |
| 347 |
_filterMap, _aliases = base.getFilterMap() |
| 348 |
|
| 349 |
def setBandpass(result, filterId): |
| 350 |
if not _filterMap: |
| 351 |
parseFilterMap() |
| 352 |
try: |
| 353 |
short, mid, long = _filterMap[_aliases.get(filterId, filterId)] |
| 354 |
except KeyError: # nothing known, do nothing |
| 355 |
return |
| 356 |
result["bandpassId"] = filterId |
| 357 |
result["bandpassUnit"] = "m" |
| 358 |
result["bandpassRefval"] = mid |
| 359 |
result["bandpassLo"] = short |
| 360 |
result["bandpassHi"] = long |
| 361 |
</code> |
| 362 |
</setup> |
| 363 |
<code> |
| 364 |
if sourceCol is None: |
| 365 |
val = result['bandpassId'] |
| 366 |
else: |
| 367 |
val = vars[sourceCol] |
| 368 |
setBandpass(result, val) |
| 369 |
</code> |
| 370 |
</procDef> |
| 371 |
|
| 372 |
<condDesc id="siapCondBase" joiner="AND"> |
| 373 |
<!-- This just contains some components the real SIAP conditions build |
| 374 |
upon. Do not inherit from this, do not instantiate it. --> |
| 375 |
<phraseMaker> |
| 376 |
<setup id="baseSetup"> |
| 377 |
<code> |
| 378 |
from gavo import rscdef |
| 379 |
from gavo.protocols import siap |
| 380 |
|
| 381 |
def interpretFormat(inPars, sqlPars): |
| 382 |
# Interprets a SIA FORMAT parameter. METADATA is caught by the |
| 383 |
# SIAP renderer, which of the magic values leaves ALL and |
| 384 |
# GRAPHIC to us. |
| 385 |
fmt = inPars.get("FORMAT") |
| 386 |
if fmt=="image/fits": |
| 387 |
fmt = "application/fits" |
| 388 |
if fmt is None or fmt=="ALL": |
| 389 |
return "" |
| 390 |
elif fmt=="GRAPHIC": |
| 391 |
return "mime IN %%(%s)s"%base.getSQLKey("format", |
| 392 |
base.getConfig("web", "graphicMimes"), sqlPars) |
| 393 |
else: |
| 394 |
return "mime=%%(%s)s"%base.getSQLKey( |
| 395 |
"format", fmt, sqlPars) |
| 396 |
|
| 397 |
def getQueriedTable(inputKeys): |
| 398 |
"""tries to infer the table queried from the inputKeys passed to |
| 399 |
the condDesc. |
| 400 |
|
| 401 |
This will return None if it cannot find this parent table. |
| 402 |
""" |
| 403 |
try: |
| 404 |
res = inputKeys[0].parent.parent.queriedTable |
| 405 |
except (AttributeError, IndexError): |
| 406 |
traceback.print_exc() |
| 407 |
return None |
| 408 |
if not isinstance(res, rscdef.TableDef): |
| 409 |
return None |
| 410 |
return res |
| 411 |
</code> |
| 412 |
</setup> |
| 413 |
</phraseMaker> |
| 414 |
|
| 415 |
<inputKey id="base_POS" name="POS" type="text" |
| 416 |
multiplicity="single" |
| 417 |
ucd="pos.eq" |
| 418 |
description="ICRS Position, RA,DEC decimal degrees (e.g., 234.234,-32.46)" |
| 419 |
tablehead="Position" required="True"> |
| 420 |
</inputKey> |
| 421 |
|
| 422 |
<inputKey name="SIZE" type="text" unit="deg" id="base_SIZE" |
| 423 |
multiplicity="single" |
| 424 |
description="Size in decimal degrees (e.g., 0.2 or 1,0.1)" |
| 425 |
tablehead="Field size" required="True"> |
| 426 |
</inputKey> |
| 427 |
|
| 428 |
<inputKey name="INTERSECT" id="base_INTERSECT" type="text" description= |
| 429 |
"Relation of image and specified Region of Interest." |
| 430 |
multiplicity="single" |
| 431 |
tablehead="Intersection type" required="False"> |
| 432 |
<values default="OVERLAPS" id="base_INTERSECT_values"> |
| 433 |
<option title="Image overlaps RoI">OVERLAPS</option> |
| 434 |
<option title="Image covers RoI">COVERS</option> |
| 435 |
<option title="RoI covers image">ENCLOSED</option> |
| 436 |
<option title="The given position is shown on image">CENTER</option> |
| 437 |
</values> |
| 438 |
</inputKey> |
| 439 |
|
| 440 |
<inputKey name="FORMAT" id="base_FORMAT" type="text" required="False" |
| 441 |
description="Requested format of the image data" |
| 442 |
multiplicity="single" |
| 443 |
tablehead="Image format"> |
| 444 |
</inputKey> |
| 445 |
</condDesc> |
| 446 |
|
| 447 |
<condDesc id="protoInput" required="True" joiner="AND"> |
| 448 |
<inputKey original="base_POS" required="True" std="True"> |
| 449 |
<property name="onlyForRenderer">siap.xml</property> |
| 450 |
</inputKey> |
| 451 |
<inputKey original="base_SIZE" required="True" std="True"> |
| 452 |
<property name="onlyForRenderer">siap.xml</property> |
| 453 |
</inputKey> |
| 454 |
<inputKey original="base_INTERSECT" std="True" |
| 455 |
>OVERLAPS<property name="onlyForRenderer">siap.xml</property> |
| 456 |
</inputKey> |
| 457 |
<inputKey original="base_FORMAT" std="True" |
| 458 |
>GRAPHIC<property name="onlyForRenderer">siap.xml</property> |
| 459 |
</inputKey> |
| 460 |
<phraseMaker> |
| 461 |
<setup original="baseSetup"/> |
| 462 |
<code> |
| 463 |
yield siap.getQuery(getQueriedTable(inputKeys), inPars, outPars) |
| 464 |
yield interpretFormat(inPars, outPars) |
| 465 |
</code> |
| 466 |
</phraseMaker> |
| 467 |
</condDesc> |
| 468 |
|
| 469 |
<condDesc id="humanInput" joiner="AND"> |
| 470 |
<inputKey original="base_POS" name="hPOS" |
| 471 |
description="ICRS Position, RA,DEC, or Simbad object (e.g., 234.234,-32.45)"> |
| 472 |
<property name="notForRenderer">siap.xml</property> |
| 473 |
</inputKey> |
| 474 |
<inputKey original="base_SIZE" name="hSIZE"> |
| 475 |
<property name="notForRenderer">siap.xml</property> |
| 476 |
<values default="0.5"/> |
| 477 |
</inputKey> |
| 478 |
<inputKey original="base_INTERSECT" name="hINTERSECT"> |
| 479 |
<property name="notForRenderer">siap.xml</property> |
| 480 |
<values original="base_INTERSECT_values" default="OVERLAPS"/> |
| 481 |
</inputKey> |
| 482 |
<inputKey original="base_FORMAT" name="hFORMAT" widgetFactory='Hidden' |
| 483 |
>GRAPHIC<property name="notForRenderer">siap.xml</property> |
| 484 |
</inputKey> |
| 485 |
|
| 486 |
<phraseMaker> |
| 487 |
<setup original="baseSetup"/> |
| 488 |
<code> |
| 489 |
pos = inPars["hPOS"] |
| 490 |
try: |
| 491 |
ra, dec = base.parseCooPair(pos) |
| 492 |
except ValueError: |
| 493 |
data = base.caches.getSesame("web").query(pos) |
| 494 |
if not data: |
| 495 |
raise base.ValidationError("%r is neither a RA,DEC pair nor" |
| 496 |
" a simbad resolvable object"%inPars.get("hPOS", "Not given"), |
| 497 |
"hPOS") |
| 498 |
ra, dec = float(data["RA"]), float(data["dec"]) |
| 499 |
inPars = { |
| 500 |
"POS": "%f, %f"%(ra, dec), "SIZE": inPars["hSIZE"], |
| 501 |
"INTERSECT": inPars["hINTERSECT"], "FORMAT": inPars.get("hFORMAT")} |
| 502 |
yield siap.getQuery(getQueriedTable(inputKeys), inPars, outPars) |
| 503 |
yield interpretFormat(inPars, outPars) |
| 504 |
</code> |
| 505 |
</phraseMaker> |
| 506 |
</condDesc> |
| 507 |
|
| 508 |
</resource> |