<resource schema="sasmirala">
	<meta name="creationDate">2013-09-27T00:12:00</meta>
	<meta name="schema-rank">100</meta>
	<meta name="title">Sasmirala: Subarcsecond mid-infrared atlas of local AGN</meta>

	<meta name="creator">Asmus, D.; Hoenig, S.F.; Gandhi, P.; Smette, A.;
		Duschl, W.J.</meta>

	<meta name="subject">active-galactic-nuclei</meta>
	<meta name="subject">seyfert-galaxies</meta>
	<meta name="subject">infrared-photometry</meta>

	<meta name="source">2014MNRAS.439.1648A</meta>
	<meta name="facility">ESO VLT, Gemini North &amp; South, Subaru, Spitzer,
		IRAS</meta>
	<meta name="instrument">VISIR, T-ReCS, Michelle, COMICS, IRAC, IRS, MIPS,
	IRAS</meta>
	<meta name="coverage.waveband">Infrared</meta>
	<meta name="_copyright">
		If you use this atlas please cite the Asmus et al. work given under
		the "source" metadata item.
	</meta>

	<meta name="_intro">
		This catalog provides access to data and mid-infrared images obtained at
		ground-based 8-meter class telescopes with public archives
		(Gemini/Michelle, Gemini/T-ReCS, Subaru/COMICS, and VLT/VISIR).
	</meta>

	<meta name="description">
		The Subarcsecond mid-infrared (MIR) atlas of local active galactic nuclei
		(AGN) is a collection of all available N- and Q-band images obtained at
		ground-based 8-meter class telescopes with public archives
		(Gemini/Michelle, Gemini/T-ReCS, Subaru/COMICS, and VLT/VISIR). It includes
		in total 895 images, of which 60% are perviously unpublished.  These
		correspond to 253 local AGN with a median redshift of 0.016.  The atlas
		contains the uniformly processed and calibrated images and nuclear
		photometry obtained through Gauss and PSF fitting for all objects and
		filters. This also includes measurements of the nuclear extensions.  In
		addition, the classifications of extended emission (if present) and derived
		nuclear monochromatic 12 and 18 micron continuum fluxes are available.
		Finally, flux ratios with the circumnuclear MIR emission (measured by
		Spitzer) and total MIR emission of the galaxy (measured by IRAS) are
		presented.
	</meta>

	<table id="objects" onDisk="True" mixin="//scs#q3cindex" adql="True"
			primary="name">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="title">Sasmirala Basic Object Properties</meta>
		<meta name="description">Basic object properties and nuclear 12 and 18
			micron continuum fluxes/ratios.</meta>

		<stc>
			Position ICRS "raj2000" "dej2000"
		</stc>

		<column name="name" type="text"
				ucd="meta.id;meta.main"
				tablehead="Object"
				description="Common object name"
				verbLevel="1">
				<values fromdb="name from sasmirala.objects order by name"/>
		</column>
		<column name="raj2000" type="double precision"
			unit="deg" ucd="pos.eq.ra;meta.main"
			tablehead="RA"
			description="Right Ascension J2000.0"
			verbLevel="1" displayHint="sf=6"/>
		<column name="dej2000" type="double precision"
			unit="deg" ucd="pos.eq.dec;meta.main"
			tablehead="Dec"
			description="Declination J2000.0"
			verbLevel="1" displayHint="sf=6"/>
		<column name="prodlink" type="text"
			tablehead="Info"
			description="Link to a web page with images, bibliography, and
				other details on the source."
			verbLevel="10"
			displayHint="type=url">
			<property name="anchorText">[Details]</property>
		</column>
		<column name="z"
			unit="" ucd="src.redshift"
			tablehead="z"
			description="Redshift"
			verbLevel="10"/>
		<column name="d"
			unit="Mpc" ucd=""
			tablehead="Dist"
			description="Distance"
			verbLevel="10"
			note="d"/>
		<column name="cls" type="text"
			ucd="src.class"
			tablehead="Class"
			description="Optical classification (References for the collected
				optical AGN classifications are given in App. B of
				2014MNRAS.439.1648A)"
			verbLevel="15"/>
		<column name="u_agn" type="boolean" required="True"
			ucd="meta.code"
			tablehead="Doubt?"
			description="Classification as AGN uncertain?"
			verbLevel="15"/>
		<column name="batid" type="integer"
			ucd="meta.id"
			tablehead="BAT id"
			description="BAT ID from 9-month catalog (from Winter et al, 2009,
				2009ApJ...690.1322W)"
			verbLevel="15">
			<values nullLiteral="-1"/>
		</column>
		<column name="n_ext" type="text"
			ucd="meta.code;src.morph"
			tablehead="Ext. Cls"
			description="Nuclear morphology at subarcsecond resolution"
			verbLevel="5"
			note="e">
			<values>
				<option title="point-like">-</option>
				<option title="possibly extended">o</option>
				<option title="unknown extension">?</option>
				<option title="spherically extended">circ.</option>
				<option title="elliptically and bar-like extended">ellip.</option>
				<option title="spiral-like extended">spir.</option>
				<option title="complex extended emission">comp.</option>
			</values>
		</column>
		<LOOP listItems="12 18">
			<events>
				<column name="lim\item" type="boolean" required="True"
					ucd="meta.code;phot.flux"
					tablehead="Upper Lim. \item\+µm?"
					description="True if \item µm flux was not detected.  flu\item
						is a 3-sigma upper level in this case."
					verbLevel="15"/>
				<column name="flu\item"
					unit="mJy" ucd="phot.flux.density;em.IR"
					tablehead="F(\item µm)"
					description="Nuclear subarcsecond-scale monochromatic flux density at
						restframe \item µm"
					verbLevel="1"/>
				<column name="err\item"
					unit="mJy" ucd="stat.error;phot.flux;em.IR"
					tablehead="Err(\item µm)"
					description="1-σ uncertainty of the \item µm continuum flux"
					verbLevel="1"/>
			</events>
		</LOOP>
		<column name="photpar" type="text" required="True"
			ucd="meta.ref;phot"
			tablehead="Photometry Sources"
			description="Link to detailed information on the photometry sources."
			verbLevel="5"
			displayHint="type=url">
			<property name="anchorText">[Photometry Details]</property>
		</column>
		<column name="dunr"
			unit="pc" ucd="phys.size;src"
			tablehead="Sz. unresolved"
			description="Size constraint on the nuclear unresolved emission in pc,
				which is set equal to the minimum PSF FWHM (major axis) measured
				for the object"
			verbLevel="15"/>
		<column name="rmed"
			unit="" ucd="phot.flux;arith.ratio"
			tablehead="N/I"
			description="Flux ratio of nuclear to intermediate scale; the in
				Spitzer/IRS unresolved flux component is used as measure for
				the intermediate-scale emission."
			verbLevel="5"/>
		<column name="rlar"
			unit="" ucd="phot.flux;arith.ratio"
			tablehead="N/L"
			description="Flux ratio of nuclear to large scale; the IRAS
				12 µm flux is used as measure for the large-scale
				emission."
			verbLevel="5"/>
		<column name="pathcomp" type="text"
			tablehead="Ignore"
			description="Interally used"
			verbLevel="50"/>

		<meta name="note" tag="d">
			Mostly redshift-based luminosity distance, corrected for the Earth's
			motion relative to the cosmic microwave background reference frame
			with H_0 = 67.3, Omega_m = 0.315, and Omega_vac = 0.685, or
			redshift-independent distance (App. B of 2014MNRAS.439.1648A).
		</meta>
		<meta name="note" tag="e">
			Nuclear morphology at subarcsecond resolution; values used include:

			======== ====================================
			\-       point-like,
			o        possibly extended
			?        unknown extension
			circ.    spherical extended
			ellip.   elliptical and bar-like extended
			spir.    spiral-like extended
			comp.    complex extended emission
			======== ====================================
		</meta>
	</table>

	<coverage>
		<updater spaceTable="objects"/>
		<temporal>2003-12-02 2011-06-15</temporal>
		<spectral>1.528e-20 2.838e-20</spectral>
		<spatial>6/18,650,1701,4116,4381,4439,4447,4993,5091,5116,5202,5975-5976,6098,7552,7606,7659,7869,7959,8195,8264,8299,8492,8675,8922,9770,10265,10355,10364,10454,10465,10475,10817,10839,10856,10912,10924-10925,10927,10977,11027,11029,11457,11512,12241,12306,12335,12380,13564,13707,14744,14858,16301,16434,16655,16690,16712,17075,17183,17264,17369,17525,17727,17748,17754,17795,17814,17819,17850,18017,18242,18365,18432,18484,18524,18683,18714,18838,18895,18897,18935,19283,19373,19376,19433,19611,19619,19730,19746,19932,20000,20489,21016,21036,21450,22654,22721,22890,22912,22976,23167,23269,23323,23469,24842,25035,25083,25182,25518,25610,25790,25890,25907,26028,26091,26148,26264,26292,26303,26313,26338,26365,26393,26547,26937,27030,27191,27255,27382,27426,27512,27515,27699,27714,27719,27721,27765,27767,27773,27909,27914,27945,28075,28167,28173,28184,28221,28249,28259,28495,28535,29795,30140,31080,31158,31352,33034,33716,33930,33954,33958,34099,34104,34273,34294,34318,34343,34412,34493,34531,34534,34695,34737,34881,34913,35246,35447,35608,35623,35691,35993,36005,36158,36668,36765,36785-36786,36861,36896,37650,38268,38479,38653,38704,38853,38868,38887,38948,39182,39487,39836,40221,40410,40777,40818,41586,41982,42016,42027,43233,43242,43262,43339,43625,43634,43677,43748,43806,43877,43925,44507,44551,44650,44660,45587,45735,45779,45816,45883,46079,46399,46442,46481,46568,46615,46715,46811,46987,47047,47107,47120,47154,47169,47325,47415,49042</spatial>
	</coverage>

	<STREAM id="prodlinkdef">
		<doc>Inserts a var for the link to the info page.</doc>
		<var key="prodlink">makeAbsoluteURL("\\schema/q/prod/qp/"+
 			urllib.parse.quote(@name))</var>
 	</STREAM>

	<data id="import_objects">
		<recreateAfter>import_phot</recreateAfter>
		<recreateAfter>import_descriptions</recreateAfter>

		<sources>data/tables/table01.dat</sources>
		<columnGrammar>
			<colDefs>
				name: 1-23
				raj2000: 25-34
				dej2000: 36-45
				z: 47-53
				d: 55-60
				cls: 62-70
				u_agn: 72-76
				batid: 78-80
				n_ext: 82-87
				lim12: 89-93
				flu12: 95-101
				err12: 103-108
				lim18: 110-114
				flu18: 116-122
				err18: 124-129
				dunr: 131-134
				rmed: 136-139
				rlar: 141-146
			</colDefs>
		</columnGrammar>
		<make table="objects">
			<rowmaker idmaps="*">
				<FEED source="prodlinkdef"/>
				<var key="u_agn">parseBooleanLiteral(@u_agn)</var>
				<var key="lim12">parseBooleanLiteral(@lim12)</var>
				<var key="lim18">parseBooleanLiteral(@lim18)</var>
				<var key="photpar"
					>makeAbsoluteURL("\rdId/phot/qp/"+urllib.parse.quote(@name))</var>

				<apply name="addpathcomp">
					<!-- this adds pathcomp, the file names used for an object
					in the various product selections. -->
					<setup>
						<code>
							import csv
							with open(os.path.join(base.getConfig("inputsDir"),
									"\schema", "data/Name_conversions.txt")) as f:
								fNames4objs = dict(
									(b.strip(), a.strip())
										for a,b in csv.reader(f, delimiter=";"))
						</code>
					</setup>
					<code>
						@pathcomp = fNames4objs[@name]
					</code>
				</apply>
			</rowmaker>
		</make>
	</data>

	<table id="photpar" onDisk="True" adql="True">
		<meta name="description">Photometric parameters for all
			nuclear measurements.</meta>
 		<column original="objects.name"/>
 		<column original="objects.raj2000"/>
 		<column original="objects.dej2000"/>
		<column name="filter" type="text"
			ucd="meta.id;instr.filter"
			tablehead="Filter"
			description="Filter name"
			verbLevel="5"/>
		<column original="//products#instance.accref" tablehead="Image"/>
		<column original="objects.prodlink"/>
		<column name="w_obs"
			unit="um" ucd="em.wl.central;instr.filter"
			tablehead="λ_c"
			description="Filter central wavelength (observing frame)"
			verbLevel="1"/>
		<column name="hwidth"
			unit="um" ucd="instr.bandwidth"
			tablehead="HWHM"
			description="Filter half-width-half-maximum"
			verbLevel="15"/>
		<column name="instr" type="text"
			ucd="meta.id;instr"
			tablehead="Instr"
			description="Instrument used to obtain the data"
			verbLevel="25"/>
		<column name="pfov"
			unit="arcsec/pix" ucd="phys.angSize;instr.pixel"
			tablehead="Pix. size"
			description="Pixel size of field of view"
			verbLevel="25"/>
		<column name="exptime"
			unit="s" ucd="time.duration;obs.exposure"
			tablehead="T_exp"
			description="Total exposure time on-source"
			verbLevel="5"/>
		<column name="mode" type="text"
			ucd="instr.setup"
			tablehead="Mode"
			description="Chop and nod mode"
			verbLevel="25"/>
		<column name="cthrow"
			unit="arcsec" ucd="instr.param"
			tablehead="Chop Throw"
			description="Chop throw"
			verbLevel="25"/>
		<column name="cangle"
			unit="deg" ucd="instr.param"
			tablehead="Chop Angle"
			description="Chop angle"
			verbLevel="25"/>
		<column name="rota"
			unit="deg" ucd="instr.param;pos.posAng"
			tablehead="Rot"
			description="Instrument rotation angle, west of north."
			verbLevel="25"/>
		<column name="proid" type="text"
			ucd="meta.id;obs"
			tablehead="Prog Id"
			description="Observation program ID"
			verbLevel="25"/>
		<column name="calname" type="text"
			ucd="meta.id;obs.calib"
			tablehead="Cal. Star"
			description="Calibrator star name"
			verbLevel="15"/>
		<column name="calmjd"
			unit="d" ucd="time.epoch;obs.calib"
			tablehead="Cal. Date"
			description="MJD of observation of calibrator star"
			verbLevel="15"
			xtype="mjd"
			displayHint="type=humanDate"/>
		<column name="dateobs" type="double precision"
			unit="d" ucd="time.epoch;obs"
			tablehead="Date Obs."
			description="MJD of observation"
			verbLevel="1"
			xtype="mjd"
			displayHint="type=humanDate"/>
		<column name="convf"
			unit="mJy/ct" ucd="phot.calib"
			tablehead="Factor"
			description="Conversion factor measured from the Calibration"
			verbLevel="15"/>
		<column name="econvf"
			unit="mJy/ct" ucd="stat.error;phot.calib"
			tablehead="Err. Factor"
			description="1-sigma uncertainty of the Conversion factor"
			verbLevel="25"/>
		<column name="calflu"
			unit="mJy" ucd="phot.flux;obs.calib"
			tablehead="Cal. Flux"
			description="Calibrator star flux"
			verbLevel="25"/>

		<LOOP>
			<csvItems>
				method, abbrev
				Gauss fitting, Gauss
				PSF fitting, PSF
			</csvItems>
			<events>
				<column name="lim\abbrev" type="boolean" required="True"
					ucd="meta.code"
					tablehead="Upper Lim. \abbrev?"
					description="If True, the object was not detected using \method
						or no matching calibrator star was available.  In that case,
						F_\abbrev represents a 3-sigma upper limit."
					verbLevel="1"/>
				<column name="f\abbrev"
					unit="mJy" ucd="phot.flux;em.IR"
					tablehead="F_\abbrev"
					description="Nuclear flux measured through \method"
					verbLevel="1"/>
				<column name="ef\abbrev"
					unit="mJy" ucd="stat.error;phot.flux;em.IR"
					tablehead="E(F_\abbrev)"
					description="1-sigma uncertainty in nuclear flux
						measured through \method"
					verbLevel="1"/>
			</events>
		</LOOP>
		<column name="calfma"
			unit="arcsec" ucd="phys.angSize;obs.calib"
			tablehead="Cal. Maj."
			description="Calibrator Star major axis FWHM"
			verbLevel="25"/>
		<column name="calfmi"
			unit="arcsec" ucd="phys.angSize;obs.calib"
			tablehead="Cal. Min."
			description="Calibrator Star minor axis FWHM"
			verbLevel="25"/>
		<column name="calpa"
			unit="deg" ucd="pos.posAng;obs.calib"
			tablehead="Cal. PA."
			description="Calibrator Star position angle, north over east"
			verbLevel="15"/>
		<column name="fwhmma"
			unit="arcsec" ucd="phys.angSize;src"
			tablehead="Maj. Ax"
			description="Major axis FWHM (constrained to &lt;=1arcsec) of
			 the Gaussian fit of the target object"
			verbLevel="5"/>
		<column name="fwhmmi"
			unit="arcsec" ucd="phys.angSize;src"
			tablehead="Min. Ax"
			description="Minor axis FWHM (constrained to &lt;=1arcsec) of
				the Gaussian fit of the target object"
			verbLevel="5"/>
		<column name="pa"
			unit="deg" ucd="pos.posAng;src"
			tablehead="Pos. Ang."
			description="Position Angle, north over east, of the Gaussian
				fit of the target object"
			verbLevel="15"/>
	</table>

	<data id="import_phot" recreateAfter="import_fits">
	<!-- the recreateAfter is because the accref column is filled from
	a script in import_fits -->
		<sources>data/tables/table02.dat</sources>
		<columnGrammar>
			<colDefs>
				name:1- 23
				ra:25- 34
				dec: 36- 45
				filter:47- 53
				w_obs:55- 59
				hwidth:61- 64
				instr:66- 73
				pfov:75- 79
				exptime:81- 84
				mode:86- 89
				cthrow:91- 92
				cangle:94- 97
				rota:99-102
				proid:104-119
				calname:121-132

				calmjd:151-159

				dateobs:178-186
				convf:188-195
				econvf:197-203
				calflu:205-214
				limGauss:216-220
				fGauss:222-228
				efGauss:230-235
				limPSF:237-241
				fPSF:243-249
				efPSF:251-256
				calfma:258-261
				calfmi:263-266
				calpa:268-270
				fwhmma:272-275
				fwhmmi:277-280
				pa:282-284
			</colDefs>
		</columnGrammar>
		<make table="photpar">
			<rowmaker idmaps="*">
				<FEED source="prodlinkdef"/>
				<map key="raj2000" source="ra"/>
				<map key="dej2000" source="dec"/>
				<map key="limGauss">parseBooleanLiteral(@limGauss)</map>
				<map key="limPSF">parseBooleanLiteral(@limPSF)</map>
			</rowmaker>
		</make>
	</data>


	<table id="descriptions" onDisk="True" primary="name">
		<meta name="description">Descriptions and plots for the objects
			observed</meta>
		<foreignKey inTable="objects" source="name"/>
		<column name="name" type="text"
			ucd="meta.id;meta.main"
			tablehead="Object"
			description="Object observed"
			verbLevel="1"/>
		<column name="description" type="unicode"
			tablehead="Description"
			description="Raw HTML fragment describing the observations"
			verbLevel="1"/>
	</table>

	<data id="import_descriptions">
		<sources pattern="data/descriptions/*.tex"/>
		<customGrammar module="res/texgrammar" id="texgrammar"/>
		<make table="descriptions"/>
	</data>

	<table id="atlas" onDisk="True" mixin="//siap#pgs">
		<!-- the full headers reflect what's in photpar; however, photpar
		also contains negative detections, which is why there are two different
		tables, and this one contains links into the photpars rather than
		the full set of metadata. -->
		<meta name="title">SASMIRALA Atlas</meta>
		<meta name="description">Final calibrated fits images.</meta>
		<foreignKey inTable="objects" source="name"/>
		<column original="objects.name"/>
	</table>

	<data id="import_fits">
		<sources pattern="data/fits/*.fits"/>
		<fitsProdGrammar>
			<rowfilter procDef="//products#define">
				<bind key="table">"\schema.atlas"</bind>
			</rowfilter>
		</fitsProdGrammar>
		<make table="atlas">
			<rowmaker>
				<apply procDef="//siap#computePGS"/>
				<apply procDef="//siap#setMeta">
					<bind key="bandpassId">@FILTER</bind>
					<bind key="bandpassLo">(@WAVELEN-@FHWIDTH)*1e-6</bind>
					<bind key="bandpassHi">(@WAVELEN+@FHWIDTH)*1e-6</bind>
					<bind key="bandpassRefval">@WAVELEN*1e-6</bind>
					<bind key="bandpassUnit">"m"</bind>
					<bind key="dateObs">@MJD_OBS</bind>
					<bind key="instrument">@INSTRUME</bind>
					<bind key="title">"Sasmirala %s %s"%(@OBJECT, @FILTER)</bind>
				</apply>

				<apply name="fix_fits_names">
					<!-- FITS and table names have different syntax.  Sigh. -->
					<setup>
						<code>
							unstickEat0CatRE = re.compile(
								"(NGC|PKS|Mrk|Fairall|1RXS|2MASX|3C|Ark|ESO|IC"
								"|LEDA|MR|UGC|IC)0*([0-9J])")
							unstickKeep0CatRE = re.compile(
								"(PG|IRAS|1H)([0-9])")
							removeESOG0RE = re.compile("-I?G0*")
							removeMCGLeadingZeroRE = re.compile("-0+")
							removeLeadingZeroesMRE = re.compile("^M0+")
							radioRE = re.compile("^(Cygnus|Cen|Pictor|Fornax|Hydra|"
								"Superantennae)")
							miscReplacements = {
								'M51A': 'M51a',
								'Z041-020': 'Z 41-20',
								'H0557-385': 'H 0557-385',
								'IZW001': 'I Zw 1',
								'IIIZW035N': 'III Zw 35N',
								'3C 390-3': '3C 390.3',
								'4C+73-08': '4C +73.08',
								'1RXS J112716-6+190914': '1RXS J112716.6+190914',
							}
						</code>
					</setup>
					<code>
						@OBJECT = radioRE.sub(r"\1 ",
							removeLeadingZeroesMRE.sub("M",
							unstickEat0CatRE.sub(r"\1 \2",
							unstickKeep0CatRE.sub(r"\1 \2", @OBJECT))))
						if @OBJECT.startswith("MCG"):
							@OBJECT = removeMCGLeadingZeroRE.sub("-", @OBJECT)
						if @OBJECT.startswith("ESO"):
							@OBJECT = removeESOG0RE.sub("-", @OBJECT)
						@OBJECT = miscReplacements.get(@OBJECT, @OBJECT)
					</code>
				</apply>
				<map key="name" source="OBJECT"/>
			</rowmaker>

			<script lang="SQL" type="postCreation">
				UPDATE sasmirala.photpar AS p
					SET accref=a.accref
				FROM sasmirala.atlas AS a
				WHERE a.name=p.name
					AND a.bandpassid=p.filter
					AND abs(a.dateobs-p.dateobs)&lt;0.001
			</script>
		</make>
	</data>

	<service id="phot" allowed="qp,form">
		<meta name="title">Sasmirala Photometry Details</meta>
		<meta name="shortName">sasmirala phot</meta>

		<meta name="_related" title="Catalog"
			>\internallink{sasmirala/q/cone/form}</meta>
		<property key="queryField">name</property>
		<dbCore queriedTable="photpar">
			<condDesc>
				<inputKey original="name" multiplicity="multiple"/>
			</condDesc>
			<condDesc original="//scs#humanInput">
				<inputKey original="//scs#hscs_sr">
					<property name="defaultForForm">0.2</property>
				</inputKey>
			</condDesc>
			<condDesc>
				<inputKey name="wl" tablehead="Wavelength covered"
					description="Central wavelength +/- FWHM of the observation
						covers this wavelength." multiplicity="single" unit="um"/>
				<phraseMaker>
					<code>
						yield "%%(%s)s BETWEEN w_obs-hwidth AND w_obs+hwidth"%(
							base.getSQLKey("wl", inPars["wl"], outPars))
					</code>
				</phraseMaker>
			</condDesc>
		</dbCore>
	</service>

	<service id="cone" allowed="form,scs.xml">
		<meta name="shortName">sasmirala cone</meta>
		<meta name="title">Sasmirala Subarcsecond mid-infrared atlas of local AGN,
			Cone Search</meta>
		<meta name="_intro" format="rst">
			This catalog provides access to data and mid-infrared images obtained at
			ground-based 8-meter class telescopes with public archives
			(Gemini/Michelle, Gemini/T-ReCS, Subaru/COMICS, and VLT/VISIR).

			You can also download full collections of:

				* \RSTservicelink{sasmirala/q/prod/static/collection/fits.tar.gz}{mid-infrared reduced FITS images}
				* \RSTservicelink{sasmirala/q/prod/static/collection/plots.tar.gz}{associated plots}
				* \RSTservicelink{sasmirala/q/prod/static/collection/tables.tar.gz}{tables}
		</meta>
		<meta name="_related" title="Photometry Details"
			>\internallink{sasmirala/q/phot/form}</meta>

		<meta name="testQuery">
			<meta name="ra">338.9425</meta>
			<meta name="dec">-26.050556</meta>
			<meta name="sr">0.01</meta>
		</meta>

		<publish render="form" sets="local,ivo_managed"/>
		<publish render="scs.xml" sets="ivo_managed"/>

		<property name="defaultSort">name</property>

		<scsCore queriedTable="objects">
			<condDesc original="//scs#humanInput">
				<inputKey original="//scs#hscs_sr">
					<property name="defaultForForm">0.2</property>
				</inputKey>
			</condDesc>
			<condDesc original="//scs#protoInput"/>
			<condDesc>
				<inputKey original="name" multiplicity="multiple" id="namekey"
					showItems="8" />
			</condDesc>
			<condDesc>
				<inputKey original="cls" multiplicity="multiple">
					<values fromdb="cls from sasmirala.objects order by cls"/>
				</inputKey>
			</condDesc>
			<LOOP listItems="d n_ext flu12 flu18">
				<events>
					<condDesc buildFrom="\item"/>
				</events>
			</LOOP>
		</scsCore>

		<outputTable verbLevel="30"/>
	</service>

	<service id="prod" allowed="static,qp">
		<meta name="title">Sasmirala object pages</meta>
		<property key="queryField">name</property>
		<property key="staticData">data</property>
		<template key="resultline">res/objdesc.html</template>

		<customRF name="embdesc">
			return ctx.tag[T.xml(data["description"])]
		</customRF>
		<customRF name="ifirac">
			if os.path.exists(service.rd.getAbsPath(
					"data/IRAC_MIPS/"+data["pathcomp"]+"_INT.jpg")):
				return ctx.tag
			else:
				return ""
		</customRF>
		<customRF name="ifmir">
			if os.path.exists(service.rd.getAbsPath(
					"data/mid-infrared/"+data["pathcomp"]+"_HAR.jpg")):
				return ctx.tag
			else:
				return ""
		</customRF>

		<customRF name="photdetails">
			from gavo import svcs
			from gavo.web import htmltable
			otd = svcs.OutputTableDef.fromTableDef(
				service.rd.getById("photpar"), None)
			obName = data.getPrimaryTable().rows[0]["name"]

			with base.getTableConn() as conn:
				t = rsc.TableForDef(otd, rows=(otd.makeRowFromTuple(t)
					for t in conn.query(
						"SELECT * FROM sasmirala.photpar WHERE name=%(name)s",
						{"name": obName})))
			return htmltable.HTMLTableFragment(t, svcs.emptyQueryMeta)
		</customRF>

		<fancyQueryCore queriedTable="objects">
			<outputTable>
				<outputField original="name"/>
				<outputField original="pathcomp"/>
				<outputField original="descriptions.description"/>
			</outputTable>
			<inputTable>
				<inputKey original="name"/>
			</inputTable>
			<query>
				SELECT
					name, pathcomp, description
				FROM sasmirala.objects
				NATURAL JOIN sasmirala.descriptions
				%s
			</query>
		</fancyQueryCore>
	</service>

	<service id="im" allowed="form,siap.xml">
		<meta name="title">Sasmirala Subarcsecond mid-infrared atlas of local AGN</meta>
		<meta name="shortName">sasmirala atlas</meta>
		<meta name="description" format="rst">
		These FITS images were generated with the IDL package MIRphot
		[Asmus2014]_ by extraction (and combination) of the  sub-images from the
		chopped/nodded total images from COMICS, Michelle, T-ReCS and VISIR (see
		[Asmus2014]_ for details).

		The FITS images contain the central ~4 arcsec of each source centered on
		the (putative) nuclear position with North being up and East to the
		left. The WCS registration has been performed after extraction by using
		coordinates of the nucleus from other wavelengths (mostly 2MASS and
		NED). The uncertainty of these reference position is usually less than 1
		arcsec. In addition, the imprecision of the assignment itself is ~1px ~
		0.1".

		The FITS images are flux calibrated (unit is mJy) using the Gaussian 2D
		fits to the corresponding STD observation (where available, otherwise
		using the median conversion factor for the used instrument/filter
		settings). Therefore, correction factors have to be applied in case
		other flux measurement methods are applied to the images. The flux
		values given in the FITS headers should be regarded as approximate
		values. In particular for the instruments, VISIR and COMICS, they are
		not necessarily exactly equal to the values provided in the photometry
		results table, because many flux measurements were performed during the
		process of combining individual subimages (all in MIRphot), instead of
		in the final combined image, provided here. The used total images are
		available upon request. Note, however, that these are just the products
		of the observatory-delivered pipelines with default parameters.

		.. [Asmus2014] Asmus D., Hoenig S.F., Gandhi P., Smette A.,
			 Duschl W.: The subarcsecond mid-infrared view of local active
			 galactic nuclei: I. The N- and Q-band imaging atlas,
			 `2014MNRAS.439.1648A &lt;http://ads.ari.uni-heidelberg.de/abs/2014MNRAS.439.1648A>`_
		</meta>
		<meta name="sia.type">Pointed</meta>

		<meta name="testQuery.pos.ra">213.31</meta>
		<meta name="testQuery.pos.dec">-3.2075</meta>
		<meta name="testQuery.size.ra">0.1</meta>
		<meta name="testQuery.size.dec">0.1</meta>

		<publish render="form" sets="local,ivo_managed"/>
		<publish render="siap.xml" sets="ivo_managed"/>

		<dbCore id="query_images" queriedTable="atlas">
			<condDesc original="//siap#protoInput"/>
			<condDesc original="//siap#humanInput"/>
			<condDesc>
				<inputKey original="name" showItems="13"/>
			</condDesc>
			<condDesc>
				<inputKey name="bandpassid" type="text"
					tablehead="Filter name">
						<values fromdb="bandpassid FROM \schema.atlas order by
							bandpassid"/>
				</inputKey>
			</condDesc>
		</dbCore>

		<outputTable autoCols="*">
			<outputField original="name">
				<formatter>
					return T.a(href=f"/sasmirala/q/prod/qp/{data}",
						style="white-space:nowrap")[data]
				</formatter>
			</outputField>
		</outputTable>
	</service>

	<regSuite>
		<regTest title="sasmirala SIAP">
			<url REQUEST="queryData" POS="213.31,-3.2075" SIZE="0.1" VERB="3"
				bandpassid="NEII_2" RESPONSEFORMAT="votabletd">im/siap.xml</url>
			<code>
				self.assertHasStrings(' value="2MASX J03565655-4041453"',
					' name="Z 41-20"')
				self.assertXpath("//v:TR[1]/v:TD[8]",
					{None: "Sasmirala NGC5506 NEII_2"})
			</code>
		</regTest>

		<regTest title="sasmirala SCS">
			<url RA="338.9425" DEC="-26.050556" SR="0.01">cone/scs.xml</url>
			<code>
				row = self.getFirstVOTableRow()
				self.assertEqual(row["batid"], 147)
				self.assertEqual(row["name"], "NGC 7314")
				self.assertEqual("/".join(row["photpar"].split("/")[3:]),
					"sasmirala/q/phot/qp/NGC%207314")
				self.assertAlmostEqual(row["err12"], 11.8, places=6)
			</code>
		</regTest>

		<regTest title="sasmirala photpar">
			<url>phot/qp/NGC%207314</url>
			<code><![CDATA[
				self.assertHasStrings("is a collection of all available N-",
					'<th class="thVertical" title="Calibrator star name">',
					'<td>11.25</td>')
			]]></code>
		</regTest>

		<regTest title="sasmirala products">
			<url>prod/qp/NGC%207314</url>
			<code><![CDATA[
				import urllib.request, urllib.parse
				self.assertHasStrings("2.5-11 micron", "M. Elitzur",
					"[gallimore_infrared_2010]")
				for mat in re.finditer(b'<img src="([^"]*)"', self.data):
					f = urllib.request.urlopen(urllib.parse.urljoin(
						self.url.httpURL, mat.group(1).decode("ascii")))
					self.assertEqual(f.info()["content-type"], "image/jpeg")
			]]></code>
		</regTest>
	</regSuite>
</resource>
