------------------------------------------------------------------------
WISE photometry
------------------------------------------------------------------------

WISE was a MIDEX mission (PI: Ned Wright) and mapped the sky at 3.4
(W1), 4.6 (W2), 12 (W3) and 22 (W4) microns with angular resolution
of [6.1,6.4,6.5,12] arc-seconds and 5sigma sensitivity of [0.08,0.11,1,6]
mJy in clean regions. The sensitivity improves towards the ecliptic 
plane owing to the scanning pattern (and also lower zodiacal light).
The WISE catalog has 563 million entries.

WISE photometry is the same as that for Spitzer (Vega!, groan).

-----------------------------------------------
Band	lambad(micron)	Flux(Jy)	AB_mag
-----------------------------------------------
W1	3.4		310		2.699
W2	4.6		172		3.339
W3	12		31.7		5.174
W4	22		8.4		6.620
-----------------------------------------------
To convert WISE Vega mag to the AM system: add the above offset to
the reported WISE mags.


------------------------------------------------------------------------
I. Retrieving WISE photometry for objects found in a search of the cone
------------------------------------------------------------------------

We seek to build a Unix bash script which returns W1-W4 photometry
(and associated errors) for a given RA, DEC and cone radius.  We
will make use of "application programming interface" (API) that
IPAC, as with any fine data establishment, provides with.

Following a bit of nosing of IPAC/IRSA around I found a few simple
examples of API calls.  API calls are made to curl (or wget) and
consist of a SINGLE line.  Below I display an example API (from
IRSA tutorial) but have split the call into several lines. If you
want to test it you need to "rejoin" the lines into a single line.

The call below seeks WISE objects at RA=00h42m44.32s DEC=41d16m08.5s
and cone search radius of 300 arc-seconds. It ouputs an an ASCII
table (instead of some god-awful VO or XML output). By studying
this call you can figure out how to make a simple API call.  Note
that anything inside a [...] is the default value.

The bit that is complicated is "selcols" (for select columns). This
feature essentially selects which columns should be sent to the
output.  You need to know the names of the columns in the data base.


$ curl -o search_results.tbl
"https://irsa.ipac.caltech.edu/cgi-bin/Gator/nph-query?
catalog=allwise_p3as_psd&
spatial=cone&
radius=300&
radunits=arcsec&
objstr=00h+42m+44.32s+41d+16m+08.5s&
size=300&
outfmt=1&
selcols=ra,dec,w1mpro,w2mpro,w3mpro,w4mpro"

Notes:
catalog  = allwise_p3as_psd (AllWISE)
	   neowiser_p1bs_psd (NEOWISE)
spatial  = cone,box,polygon,Upload, None=All-sky searrch
radius   = radius of cone search [10 arsec]
radunits = units of cone search: arcsec,arcmin,deg  [arcsec])
objstr   = target_name or coordinates of search center
selcol   = select columns for output (need to know names of columns)
outfmt   = 0:HTML,1:ASCII,2:SVC,3:VO,6:XML [0]

------------------------------------------------------------------------
II. A simple bash API script to retrieve WISE photometry
------------------------------------------------------------------------

See attached program "photWISE"

------------------------------------------------------------------------
III. Usage
------------------------------------------------------------------------


$ photWISE 20h43m19.03s +44d38m20.4 5 c
\ORIGIN  = 'IPAC Infrared Science Archive (IRSA), Caltech/JPL'
\DATETIME= '2020-11-24 17:19:00'
\DataTag = 'ADS/IRSA.Gator#2020/1124/171900_9705'
\DATABASE= 'AllWISE Source Catalog (allwise_p3as_psd)'
\EQUINOX = 'J2000'
\SKYAREA = 'within 5 arcsec of  ra=310.82929 dec=+44.63900 Eq J2000 '
\StatusFile = '/workspace/TMP_YTzQ1S_9705/Gator/irsa/9705/log.9705.html'
\SQL     = 'WHERE (no constraints) 
\SQL     = 'SELECT (12 column names follow in next row.)'
|          ra|         dec|          clon|          clat|  w1mpro|    w1snr|  w2mpro|    w2snr|  w3mpro|    w3snr|  w4mpro|    w4snr|           dist|       angle|
  310.8277422   44.6389351   20h43m18.66s   44d38m20.17s   10.868      47.3   10.724      51.5   10.326      10.2    8.905       2.6        3.971682   266.628089 



$ photWISE 20h43m19.03s +44d38m20.4
number of sources  1
|          ra|         dec|          clon|          clat|  w1mpro|    w1snr|  w2mpro|    w2snr|  w3mpro|    w3snr|  w4mpro|    w4snr|           dist|       angle|
  310.8277422   44.6389351   20h43m18.66s   44d38m20.17s   10.868      47.3   10.724      51.5   10.326      10.2    8.905       2.6        3.971682   266.628089