| 1 |
<!-- A template for a simple DaCHS SIAP (image search) service. |
| 2 |
To fill it out, search and replace %.*% |
| 3 |
|
| 4 |
Note that this doesn't expose all features of DaCHS. For advanced |
| 5 |
projects, you'll still have to read documentation... --> |
| 6 |
\tpldesc{Image collections via SIAP2 and TAP} |
| 7 |
|
| 8 |
<resource schema="\resdir" resdir="."> |
| 9 |
<meta name="creationDate">\now</meta> |
| 10 |
|
| 11 |
\commonmeta |
| 12 |
<table id="main" onDisk="True" adql="True"> |
| 13 |
<mixin have_bandpass_id="True">//siap2#pgs</mixin> |
| 14 |
<!-- Comment in the following element once you're ready to publish; |
| 15 |
it will add your data to the obscore view |
| 16 |
<mixin preview="NULL">//obscore#publishObscoreLike</mixin> |
| 17 |
--> |
| 18 |
%add non-standard columns if you think they are useful in discovery % |
| 19 |
</table> |
| 20 |
|
| 21 |
<coverage> |
| 22 |
<updater sourceTable="main"/> |
| 23 |
</coverage> |
| 24 |
|
| 25 |
<!-- if you have data that is continually added to, consider using |
| 26 |
updating="True" and an ignorePattern here; see also howDoI.html, |
| 27 |
incremental updating --> |
| 28 |
<data id="import"> |
| 29 |
<sources pattern="%resdir-relative pattern, like data/*.fits%"/> |
| 30 |
|
| 31 |
<!-- the fitsProdGrammar should do it for whenever you have |
| 32 |
halfway usable FITS files. If they're not halfway usable, |
| 33 |
consider running a processor to fix them first – you'll hand |
| 34 |
them out to users, and when DaCHS can't deal with them, chances |
| 35 |
are their clients can't either --> |
| 36 |
<fitsProdGrammar> |
| 37 |
<rowfilter procDef="//products#define"> |
| 38 |
<bind key="table">"\\schema.main"</bind> |
| 39 |
</rowfilter> |
| 40 |
</fitsProdGrammar> |
| 41 |
|
| 42 |
<make table="main"> |
| 43 |
<rowmaker> |
| 44 |
<!-- put vars here to pre-process FITS keys that you need to |
| 45 |
re-format in non-trivial ways. --> |
| 46 |
|
| 47 |
<apply procDef="//siap2#computePGS"/> |
| 48 |
|
| 49 |
<apply procDef="//siap2#setMeta"> |
| 50 |
<!-- if you have an optical filter known (or translatable) to |
| 51 |
what DaCHS knows (dachs adm dump data/filters.txt), enter |
| 52 |
it here and don't bind em_min and em_max. Otherwise, remove |
| 53 |
this and set em_min and em_max. --> |
| 54 |
<bind name="bandpassId">"%a bandpass id known to DaCHS%"</bind> |
| 55 |
|
| 56 |
<!-- DaCHS can deal with some time formats; otherwise, you |
| 57 |
may want to use parseTimestamp(@DATE_OBS, '%Y %m %d...'); |
| 58 |
you can also set t_min and t_max instead. If you don't |
| 59 |
you also have to fill t_exposure--> |
| 60 |
<bind key="dateObs">%something like @DATE_OBS%</bind> |
| 61 |
|
| 62 |
<!-- the remaining parameters are from obscore. Refer to |
| 63 |
the apply doc http://docs.g-vo.org/dachs/ref.html#siap2-setmeta |
| 64 |
or the obscore REC for more information on it in case of doubt. |
| 65 |
You can remove most of these bindings without becoming |
| 66 |
invalid; DaCHS will complain if you hit something vital. --> |
| 67 |
|
| 68 |
<bind key="dataproduct_type">"image"</bind> |
| 69 |
<bind key="dataproduct_subtype">None</bind> |
| 70 |
<bind key="calib_level">2</bind> |
| 71 |
<bind key="obs_collection">"%short and spiffy%"</bind> |
| 72 |
|
| 73 |
<!-- DaCHS will fill in obs_publisher_did here if you keep it None, |
| 74 |
which is probably what you normally want --> |
| 75 |
<bind key="obs_id">None</bind> |
| 76 |
|
| 77 |
<!-- titles are what users usually see in a selection, so |
| 78 |
try to combine band, dateObs, object..., like |
| 79 |
"MyData {} {} {}".format(@DATE_OBS, @TARGET, @FILTER) --> |
| 80 |
<bind key="obs_title">"%expressive expression%"</bind> |
| 81 |
<bind key="obs_publisher_did">\\standardPubDID</bind> |
| 82 |
<bind key="obs_creator_did">None</bind> |
| 83 |
<bind key="target_name">%expr for the target name%</bind> |
| 84 |
<bind key="target_class">"%vocabulary term%"</bind> |
| 85 |
|
| 86 |
<!-- forget about t_min and t_max for single exposures when you |
| 87 |
have dateObs and t_exposure --> |
| 88 |
<bind key="t_min">%expr for start of obs%</bind> |
| 89 |
<bind key="t_max">%expr for end of obs%</bind> |
| 90 |
<bind key="t_exptime">%expr for exposure time%</bind> |
| 91 |
<bind key="t_resolution">None</bind> |
| 92 |
|
| 93 |
<!-- forget about em_min and em_max when you have bandpassId--> |
| 94 |
<bind key="em_min">%expr for lower wl [m]%</bind> |
| 95 |
<bind key="em_max">%expr for upper wl [m]%</bind> |
| 96 |
<bind key="em_res_power">None</bind> |
| 97 |
<bind key="em_ucd">None</bind> |
| 98 |
<bind key="o_ucd">"phot.count"</bind> |
| 99 |
<bind key="pol_states">None</bind> |
| 100 |
<bind key="facility_name" |
| 101 |
>base.getMetaText(targetTable, "facility", default=None)</bind> |
| 102 |
<bind key="instrument_name" |
| 103 |
>base.getMetaText(targetTable, "instrument", default=None)</bind> |
| 104 |
|
| 105 |
<!-- s_xel are set by computePGS --> |
| 106 |
<bind key="t_xel">1</bind> |
| 107 |
<bind key="em_xel">1</bind> |
| 108 |
<bind key="pol_xel">None</bind> |
| 109 |
</apply> |
| 110 |
|
| 111 |
<!-- remove this unless you set bandpassId above --> |
| 112 |
<apply procDef="//siap2#getBandFromFilter"/> |
| 113 |
|
| 114 |
<!-- any custom columns need to be mapped here; do *not* use |
| 115 |
idmaps="*" with SIAP2 --> |
| 116 |
</rowmaker> |
| 117 |
</make> |
| 118 |
</data> |
| 119 |
|
| 120 |
<!-- if you want to build an attractive form-based service from |
| 121 |
SIAP, you probably want to tinker here quite a bit; if you |
| 122 |
don't want to serve a browser service, just remove the following |
| 123 |
element. --> |
| 124 |
<service id="browse" allowed="form"> |
| 125 |
<meta name="shortName">%short name for the browser service%</meta> |
| 126 |
<meta name="title">Browser interface to %whatever%</meta> |
| 127 |
<dbCore queriedTable="main"> |
| 128 |
<condDesc original="//siap2#humanInput"/> |
| 129 |
<condDesc> |
| 130 |
<inputKey original="target_name" showItems="10" multiplicity="multiple"> |
| 131 |
<values fromdb="target_name from \\schema.main order by target_name"/> |
| 132 |
</inputKey> |
| 133 |
</condDesc> |
| 134 |
<outputTable autoCols="target_name, access_estsize"> |
| 135 |
<column original="access_url"/> |
| 136 |
<column original="s_ra" displayHint="type=hms"/> |
| 137 |
<column original="s_dec" displayHint="type=dms"/> |
| 138 |
</outputTable> |
| 139 |
</dbCore> |
| 140 |
</service> |
| 141 |
|
| 142 |
<service id="i" allowed="form,siap2.xml"> |
| 143 |
<meta name="shortName">%up to 16 characters%</meta> |
| 144 |
|
| 145 |
<!-- other sia.types: Cutout, Mosaic, Atlas --> |
| 146 |
<meta name="sia.type">Pointed</meta> |
| 147 |
|
| 148 |
<meta name="testQuery.pos.ra">%ra one finds an image at%</meta> |
| 149 |
<meta name="testQuery.pos.dec">%dec one finds an image at%</meta> |
| 150 |
<meta name="testQuery.size.ra">0.1</meta> |
| 151 |
<meta name="testQuery.size.dec">0.1</meta> |
| 152 |
|
| 153 |
<!-- this is the VO publication --> |
| 154 |
<publish render="siap2.xml" sets="ivo_managed"/> |
| 155 |
<!-- this puts the service on the root page --> |
| 156 |
<publish render="form" sets="local,ivo_managed" service="browse"/> |
| 157 |
<!-- all publish elements only become active after you run |
| 158 |
dachs pub q --> |
| 159 |
|
| 160 |
<dbCore queriedTable="main"> |
| 161 |
<FEED source="//siap2#parameters"/> |
| 162 |
<!-- enable custom parameters like this: |
| 163 |
<condDesc buildFrom="dateObs"/> --> |
| 164 |
</dbCore> |
| 165 |
</service> |
| 166 |
|
| 167 |
<regSuite title="\resdir regression"> |
| 168 |
<!-- see http://docs.g-vo.org/DaCHS/ref.html#regression-testing |
| 169 |
for more info on these. --> |
| 170 |
|
| 171 |
<regTest title="\resdir SIAP serves some data"> |
| 172 |
<url POS="%CIRCLE ra dec size that has a bit of data%" |
| 173 |
>i/siap2.xml</url> |
| 174 |
<code> |
| 175 |
<!-- to figure out some good strings to use here, run |
| 176 |
dachs test -D tmp.xml q |
| 177 |
and look at tmp.xml --> |
| 178 |
self.assertHasStrings( |
| 179 |
"%some characteristic string returned by the query%", |
| 180 |
"%another characteristic string returned by the query%") |
| 181 |
</code> |
| 182 |
</regTest> |
| 183 |
|
| 184 |
<!-- add more tests: image actually delivered, form-based service |
| 185 |
renders custom widgets, etc. --> |
| 186 |
</regSuite> |
| 187 |
</resource> |