<resource schema="carsarcs">
	<macDef name="imageBands">u g r i</macDef>

	<meta name="creationDate">2013-03-18T10:08:00</meta>
	<meta name="schema-rank">100</meta>
	<meta name="title">Gravitational arc candidates in the
		CFHTLS-Archive-Research Survey CARS</meta>
	<meta name="description">
	Candidate gravitational arcs in the 37 deg^2 of CFHTLS-Archive-Research
	Survey (CARS). The data include their post-stamp images, astrometry,
	photometry (u*,g',r',i'), geometric properties (length, length-to-width
	ratio, profile curvature, area), and photometric redshifts.  The arc
	candidates were selected booth with an automatic arcfinder, based on a
	tailored image segmentation and a color selection, and by visually inspecting
	the survey.</meta>

	<meta name="creator.name">Maturi, M.</meta>
	<meta name="creator.logo"
		>http://dc.g-vo.org/carsarcs/q/s/static/arcs-logo_letters.png</meta>
	<meta name="creator">Mizera, S.; Seidel, G.</meta>

	<meta name="source">2014A&amp;A...567A.111M</meta>
	<meta name="subject">strong-gravitational-lensing</meta>
	<meta name="subject">luminous-arcs</meta>
	<meta name="subject">galaxy-clusters</meta>
	<meta name="subject">dark-matter</meta>

	<meta name="facility">Canada-France-Hawaii Telescope</meta>
	<meta name="instrument">MegaPrime camera</meta>
	<meta name="copyright">If you use this data, please cite the paper
	Maturi et al, 2014, given in the source metadata</meta>

	<meta name="coverage.waveband">Optical</meta>
	<meta name="coverage.waveband">Infrared</meta>

	<meta name="_related" title="CARS products">/cars/q/prod/form</meta>

	<meta name="_news" author="MD" date="2014-05-13">
		Updated data after journal review, publishing the service.
	</meta>

	<table id="meta" onDisk="true" adql="True" mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="title">Magnitudes, redshifts, positions, etc. of the
		arcs found in CARS.</meta>

		<column name="preview" type="text"
			ucd="meta.ref.url"
			tablehead="Preview"
			description="Preview image"
			verbLevel="5"
			displayHint="type=imageURL"/>
		<column name="matid" type="text"
			ucd="meta.id;meta.main"
			tablehead="Id"
			description="Identification number within carsarcs"
			verbLevel="1"
			note="d"/>
		<column name="carsfield" type="text"
			ucd="meta.id;obs.field"
			tablehead="CARS field"
			description="CARS field identifier"
			verbLevel="15"/>
		<column name="raj2000" type="double precision"
			unit="deg" ucd="pos.eq.ra;meta.main"
			tablehead="RA"
			description="Right ascension of the center, ICRS"
			verbLevel="1"/>
		<column name="dej2000" type="double precision"
			unit="deg" ucd="pos.eq.dec;meta.main"
			tablehead="Dec"
			description="Declination of the center, ICRS"
			verbLevel="1"/>
		<column name="arc_length"
			unit="deg" ucd="phys.angSize;src"
			tablehead="Arc length"
			description="Length of the arc (see paper for construction)."
			verbLevel="1"
			displayHint="displayUnit=arcsec"/>
		<column name="arc_l_w"
			unit="" ucd="phys.size;arith.ratio"
			tablehead="L/W"
			description="Length to width ratio for the arc
				(see paper for construction)."
			verbLevel="1"/>
		<column name="arc_curv"
			unit="deg**-1" ucd="src.morph.param"
			tablehead="Curvature"
			description="Curvature of the arc (see paper for construction)."
			verbLevel="15" displayHint="displayUnit=arcsec**-1"/>
		<column name="arc_area"
			unit="deg**2" ucd="phys.angSize;src"
			tablehead="Area"
			description="Area of the arc (see paper for construction)."
			verbLevel="15"
			displayHint="displayUnit=arcsec**2"/>
		<LOOP>
			<csvItems>
				band, ucd
				u, em.opt.U
				g, em.opt.V
				r, em.opt.R
				i, em.opt.I
			</csvItems>
			<events>
				<column name="\band\+prime"
					unit="mag" ucd="phot.mag;\ucd"
					tablehead="mag_\band"
					description="arc \band' aperture magnitude (based on segmentation)"
					verbLevel="15"/>
				<column name="err_\band\+prime"
					unit="mag" ucd="stat.error;phot.mag;\ucd"
					tablehead="σ(mag_\band)"
					description="Error in \band magnitude; estimated by image
						noise including background subtraction uncertainty."
					verbLevel="25"/>
			</events>
		</LOOP>
		<column name="z_lens"
			unit="" ucd="src.redshift.phot"
			tablehead="Lens z"
			description="Photometric redshift of the lens (from CARS catalog)."
			verbLevel="5"/>
		<column name="z_lens_err_plus"
			unit="" ucd="stat.error;src.redshift.phot"
			tablehead="+z"
			description="Lens photometric redshift 1-sigma error taken from the
				CARS catalog."
			verbLevel="25"/>
		<column name="z_lens_err_minus"
			unit="" ucd="stat.error;src.redshift.phot"
			tablehead="-z"
			description="Lens photometric redshift 1-sigma error taken from the
				CARS catalog."
			verbLevel="25"/>
		<column name="qual_ass" type="smallint"
			ucd="meta.code.qual"
			tablehead="Quality"
			description="Quality assessment"
			verbLevel="5"
			note="q">
			<values nullLiteral="0"/>
		</column>
		<column name="catnr" type="text"
			ucd="meta.id.cross"
			tablehead="Ext. id"
			description="Catalog number of previously known arcs"
			verbLevel="15"/>
		<LOOP listItems="\imageBands">
			<events>
				<column name="img_\item" type="text"
					ucd="meta.ref.url"
					tablehead="\item band image"
					description="CARS image in the \item band."
					verbLevel="15"
					displayHint="type=url"/>
			</events>
		</LOOP>

		<meta name="note" tag="d">
			The last character of the id is the detection type. This can
			be:

			a
				satisfies all criteria except color selection
			b
				was detected by the arcfinder but rejected by the geometrical
				constraints (L&gt;15 pix, L/W&lt;4)
			c
				was detected only by eye-ball checking
		</meta>
		<meta name="note" tag="q">
			This flag takes the following values:

			1
				"unlikely": arc structures which seem physically associated
				to an astrophysical object, or which are relatively far from
				a possible lens
			2
				"unclear": arc structures with a very promising shape but still
				being of dubious origin
			3
				"unclear": a clear arc structure which curvature is displaced in
				such a way to "enclose" a possible lens cause of its origin,
				i.e. large ellipticals or significant concentrations of galaxies.
		</meta>
	</table>

	<coverage>
		<updater sourceTable="meta"/>
		<spatial>5/4419,4422,4758 6/10741,10743,10745,10747,10750-10751,17668,17671,17681-17683,17685-17686,17692,17694,17712-17713,19021,19027,19030,19036-19038,19056,19060,36793,36795</spatial>
		<spectral>2.31e-19 6.621e-19</spectral>
	</coverage>

	<data id="import_meta">
		<sources pattern="data/*_full.tbl"/>
		<reGrammar recordCleaner="(?:#.*)?(.*)" fieldSep="\t" lax="True"
				enc="iso-8859-1">
			<names>matid, segment_id, carsfield, raj2000, dej2000,
				arc_length, arc_l_w, arc_curv, arc_area,
				uprime, err_uprime, gprime, err_gprime, rprime, err_rprime,
				iprime, err_iprime,
				z_lens, z_lens_err_plus, z_lens_err_minus,
				qual_ass, catnr</names>
		</reGrammar>

		<make table="meta">
			<rowmaker idmaps="*">
				<map key="arc_length">float(@arc_length)*DEG_ARCSEC</map>
				<map key="arc_curv">float(@arc_curv)/DEG_ARCSEC</map>
				<map key="arc_area">float(@arc_area)*DEG_ARCSEC*DEG_ARCSEC</map>
				<map key="raj2000">hmsToDeg(@raj2000, sepChar=":")</map>
				<map key="dej2000">dmsToDeg(@dej2000, sepChar=":")</map>
				<map key="catnr">parseWithNull(@catnr, str, "-")</map>
				<map key="preview">makeAbsoluteURL(
					"/carsarcs/q/s/static/color/%s_%s-%s_label.jpg"%(
						@matid, @carsfield, @segment_id))</map>
				<LOOP listItems="\imageBands">
					<events>
						<map key="img_\item">makeAbsoluteURL(
							"/carsarcs/q/s/static/fits/%s-%s-%s.fits"%(
						@carsfield, @segment_id, "\item"))</map>
					</events>
				</LOOP>
			</rowmaker>
		</make>
	</data>

	<service id="s" allowed="form,scs.xml,static">
		<publish render="scs.xml" sets="ivo_managed"/>
		<publish render="form" sets="local,ivo_managed"/>

		<meta name="shortName">carsarcs scs</meta>
		<meta name="testQuery">
			<meta name="ra">210.5267</meta>
			<meta name="dec">52.952</meta>
			<meta name="sr">0.001</meta>
		</meta>

		<property name="staticData">data/images</property>
		<scsCore queriedTable="meta">
			<FEED source="//scs#coreDescs"/>
			<condDesc buildFrom="z_lens"/>
			<condDesc>
				<inputKey original="arc_length" inputUnit="arcsec"
					type="vexpr-float"/>
			</condDesc>
			<condDesc>
				<inputKey original="carsfield" multiplicity="multiple">
					<values fromdb="carsfield from carsarcs.meta order by carsfield"/>
				</inputKey>
			</condDesc>
		</scsCore>
	</service>

	<regSuite>
		<regTest title="carsarcs scs yield credible results">
			<url RA="210.5267" DEC="52.952" SR="0.001">s/scs.xml</url>
			<code>
				res = self.getFirstVOTableRow()
				self.assertAlmostEqual(res["arc_length"], 0.00056944397510)
				self.assertTrue(res['preview'].endswith(
					"/carsarcs/q/s/static/color/arc81c_W3m3m2-8649b_label.jpg"))
				self.assertTrue(res["img_r"].endswith(
					'carsarcs/q/s/static/fits/W3m3m2-8649b-r.fits'))
				# no conversion here
				self.assertEqual(res["arc_curv"], 1476.0)
			</code>
		</regTest>

		<regTest title="carsarcs static renderer spits out things">
			<url>s/static/color/arc81c_W3m3m2-8649b_label.jpg</url>
			<code>
				self.assertHasStrings("JFIF")
			</code>
		</regTest>

		<regTest title="carsarcs form output looks about right">
			<url parSet="form" z_lens="0.5 .. 0.51" carsfield="W3m3m2"
				>s/form</url>
			<code><![CDATA[
				self.assertHasStrings("very promising",
					'<img ', 'alt="Image at http://',
					'/carsarcs/q/s/static/color/arc81c_',
					"<td>W3m3m2</td>",
					# that would be the converted arc_curv
					"<td>1.00</td>",
					'<td><a href="http://',
					'/carsarcs/q/s/static/fits/W3m3m2-8649b-u.fits">W3m3m2-8649b-u.fits')
			]]></code>
		</regTest>
	</regSuite>
</resource>
