<resource schema="cs82morphoz">
	<meta name="title">Photometric redshifts in Stripe 82</meta>
	<meta name="creationDate">2017-11-18T01:02:03</meta>
	<meta name="schema-rank">1000</meta>
	<meta name="description">
		This is a catalogue of photometric redshifts of galaxies in the Stripe 82
		obtained when morphology (galaxy size, ellipticity, Sérsic index, and
		surface brightness) are included in training on galaxy samples from the
		SDSS and the CFHT Stripe-82 Survey (CS82).  Our redshifts yield a 68th
		percentile error of 0.058(1 + z), and a outlier fraction of 5.2 per cent.
	</meta>
	<meta name="creator">Soo, John Y H;  Moraes, Bruno;  Joachimi, Benjamin;
		Hartley, William;  Lahav, Ofer;  Charbonnier, Aldée;  Makler, Martín;
		Pereira, Maria E S;  Comparat, Johan;  Erben, Thomas; Leauthaud, Alexie;
		Shan, Huanyuan;  Van Waerbeke, Ludovic</meta>

	<meta name="_longdoc" format="rst">
		The distributions :math:`P(z)` used to estimate z_phot and z_morph are
		available as FITS binary tables from `pz_phot`_ (1.4 GB) and `pz_morph`_
		(0.8 GB), respectively.

		.. _pz_phot: /\schema/q/cone/static/cs82_pz_morph.fits.gz
		.. _pz_morph: /\schema/q/cone/static/cs82_pz_phot.fits.gz

		The data in the \schema.main table is also available as a FITS binary
		table: `phz.fits`_ (0.7 GB).

		.. _phz.fits: /\schema/q/cone/static/cs82_phz.fits.gz
	</meta>
	<meta name="subject">redshift-surveys</meta>
	<meta name="subject">broad-band-photometry</meta>
	<meta name="subject">galaxy-distances</meta>
	<meta name="subject">galaxy-structure</meta>

	<meta name="coverage">
		<meta name="waveband">Optical</meta>
	</meta>

	<meta name="source">2018MNRAS.475.3613S</meta>

	<table id="main" onDisk="True" mixin="//scs#q3cindex" primary="objid_cs82"
			adql="True">
		<index columns="mag_auto"/>
		<index columns="zbest"/>

		<column name="objid_cs82" type="integer" required="True"
			ucd="meta.id;meta.main"
			tablehead="CS82 id"
			description="Identifier built as im_num*1000000+se_id"
			verbLevel="1"/>

		<column name="ra" type="double precision"
			unit="deg" ucd="pos.eq.ra;meta.main"
			tablehead="RA"
			description="ICRS Right Ascension"
			displayHint="sf=7" verbLevel="1"/>
		<column name="dec" type="double precision"
			unit="deg" ucd="pos.eq.dec;meta.main"
			tablehead="Dec"
			description="ICRS Declination"
			displayHint="sf=7" verbLevel="1"/>
		<column name="flags" type="smallint" required="True"
			ucd="meta.code"
			tablehead="Ex. Qual"
			description="Source extraction quality flag (ranges from 0 to 3, with 0
				being the best)"
			verbLevel="15"/>

		<column name="weight" type="real"
			ucd="stat.weight"
			tablehead="lensFit"
			description="lensFit shape measurement confidence. weight&gt;0
				indicates good shape measurement"
			displayHint="sf=1" verbLevel="15"/>
		<column name="fitclass" type="smallint" required="True"
			ucd="meta.code;src.class"
			tablehead="Fit class"
			description="lensFit star-galaxy classifier: 1=stars; 0=galaxies; -1=no
				usable data; -2=blended objects; -3=miscellaneous reasons; -4=chi-square
				exceeded critical value"
			verbLevel="1"/>
		<column name="mag_auto" type="real"
			unit="mag" ucd="phot.mag;em.opt.i"
			tablehead="i Kron"
			description="CS82 Kron i-band magnitude"
			displayHint="sf=3" verbLevel="1"/>
		<column name="magerr_auto" type="real"
			tablehead="Err. i Kron"
			unit="mag" ucd="stat.error;phot.mag;em.opt.i"
			description="CS82 Kron i-band magnitude error. Signal-to-noise ratio is
				1.086/MAGERR_AUTO"
			displayHint="sf=3" verbLevel="15"/>
		<column name="mag_exp" type="real"
			unit="mag" ucd="phot.mag;em.opt.i"
			tablehead="i fit"
			description="CS82 exponential fit i-band magnitude"
			displayHint="sf=3" verbLevel="15"/>
		<column name="mag_psf" type="real"
			unit="mag" ucd="phot.mag;em.opt.i"
			tablehead="i psf"
			description="CS82 PSF i-band magnitude"
			displayHint="sf=3" verbLevel="15"/>
		<column name="reff_exp"
			unit="arcsec" ucd="phys.angsize;src"
			tablehead="R"
			description="Exponential fit effective radius"
			displayHint="sf=2" verbLevel="1"/>
		<column name="aspect_exp" type="real"
			ucd="src.morph.param"
			tablehead="Ax. Ratio"
			description="Exponential fit axis-ratio"
			displayHint="sf=2" verbLevel="15"/>
		<column name="mu_mean_exp"
			unit="mag/arcsec**2" ucd="phot.mag.sb;em.opt.i"
			tablehead="SB"
			description="Exponential fit mean surface brightness"
			displayHint="sf=1" verbLevel="15"/>
		<column name="p_exp" type="real"
			ucd="stat.fit.goodness"
			tablehead="S/E?"
			description="Exponential shape probability: ~1 -> disc galaxy; ~0 ->
				elliptical galaxy"
			displayHint="sf=4" verbLevel="15"/>
		<column name="n_ser" type="real"
			ucd="stat.fit.param"
			tablehead="Sérsic"
			description="Sersic index"
			displayHint="sf=2" verbLevel="1"/>
		<column name="spread_model_ser" type="real"
			ucd="stat.fit.param"
			tablehead="Spread model"
			description="Sersic spread model, the star-galaxy separator we used for
				this study. All objects in this catalogue have SPREAD_MODEL_SER>0.008,
				which are considered extended objects (galaxies)."
			displayHint="sf=5" verbLevel="1"/>

		<column name="lens" type="smallint" required="True"
			ucd="meta.code"
			tablehead="lens?"
			description="Lensing tag. Objects with lens=1 are objects from the
				lensing subsample (fitclass=0, weight&gt;0)"
			verbLevel="1"/>
		<column name="objid_sdss" type="bigint"
			ucd="meta.id.cross"
			tablehead="SDSS id"
			description="SDSS object ID for objects with matched ugriz broadband
				magnitudes (if available)"
			verbLevel="15">
			<values nullLiteral="-1"/>
		</column>

		<LOOP>
			<csvItems>
				band, ucd
				u,  em.opt.U
				g,  em.opt.V
				r,  em.opt.R
				i,  em.opt.I
				z,  em.opt.I
			</csvItems>
			<events>
				<column name="mag_dered_\band"
					unit="mag" ucd="phot.mag;\ucd"
					tablehead="\band dered"
					description="SDSS dereddened \band-band magnitude"
					displayHint="sf=2" verbLevel="15"/>
			</events>
		</LOOP>

		<column name="zspec"
			ucd="src.redshift"
			tablehead="z spec"
			description="Spectroscopic redshift from source given in source_spec"
			displayHint="sf=3" verbLevel="15"/>
		<column name="zphot"
			ucd="src.redshift"
			tablehead="z phot"
			description="Photometric redshift estimated using inputs
				ugriz+morphology"
			displayHint="sf=3" verbLevel="1"/>
		<column name="zmorph"
			ucd="src.redshift"
			tablehead="z morph"
			description="Photometric redshift estimated using inputs i+morphology"
			displayHint="sf=3" verbLevel="1"/>
		<column name="zbest"
			ucd="src.redshift"
			tablehead="z best"
			description="Best redshift for this object, in order of priority: zspec,
				zphot, zmorph"
			displayHint="sf=3" verbLevel="1"/>
		<column name="odds_phot"
			ucd="stat.fit.goodness"
			tablehead="Odds(z best)"
			description="Odds value for zphot"
			displayHint="sf=3" verbLevel="15"/>
		<column name="odds_morph"
			ucd="stat.fit.goodness"
			tablehead="Odds(z morph)"
			description="Odds value for zmorph"
			displayHint="sf=3" verbLevel="15"/>
		<column name="odds_best"
			ucd="stat.fit.goodness"
			tablehead="Odds(z best)"
			description="Odds value for zbest (=1 if zspec is used)"
			displayHint="sf=3" verbLevel="15"/>
		<column name="source_spec" type="text"
			ucd="meta.bib"
			tablehead="Src"
			description="Source of spectroscopy: SDSS, BOSS, DEEP2, WIGGLEZ or VVDS"
			verbLevel="25"/>
		<column name="class_spec" type="text"
			ucd="meta.code.class"
			tablehead="Class"
			description="Class of object based on spectral fit: GALAXY or QSO"
			verbLevel="15"/>
	</table>

	<data id="import">
		<sources pattern="data/*_phz.fits.gz"/>

		<fitsTableGrammar lowerKeys="True"/>

		<make table="main">
			<rowmaker idmaps="*">
				<LOOP listItems="mag_dered_u mag_dered_g mag_dered_r mag_dered_i
						mag_dered_z zspec zphot odds_phot odds_morph odds_best">
					<events>
						<map key="\item">None if math.isnan(@\item) else @\item</map>
					</events>
				</LOOP>
			</rowmaker>
		</make>
	</data>

	<service id="cone" allowed="scs.xml,form,static">
		<meta name="shortName">CS82 cone</meta>
		<meta name="testQuery">
			<meta name="ra">317.7168</meta>
			<meta name="dec">-0.9739</meta>
			<meta name="sr">0.001</meta>
		</meta>

		<property key="staticData">data</property>

		<dbCore queriedTable="main">
			<FEED source="//scs#coreDescs"/>
			<condDesc buildFrom="mag_auto"/>
			<condDesc buildFrom="zbest"/>
		</dbCore>

		<publish render="scs.xml" sets="ivo_managed"/>
		<publish render="form" sets="ivo_managed,local"/>
	</service>

	<regSuite title="cs82morphz regression">
		<regTest title="cs82morphz SCS delivers data">
			<url RA="12.1935326" DEC="-0.7699836" SR="0.01" ZBEST="6 7"
				>cone/scs.xml</url>
			<code>
				row = self.getFirstVOTableRow()
				self.assertEqual(row["objid_cs82"], '76059981')
				self.assertAlmostEqual(row['spread_model_ser'], 0.012096334248781204)
			</code>
		</regTest>

		<regTest title="cd82morphz Form performs reasonably well with zbest">
			<url parSet="form" zbest="&gt;2" _TIMEOUT="1">cone/form</url>
			<code><![CDATA[
				self.assertHasStrings(
					"Matched: 36",
					">68124213<",  # Matched object
					">14.4<",  # lensFit, formatted
					">21.265<", # kron i
					">19.8<" # surface brightness
				)
			]]></code>
		</regTest>
	</regSuite>
</resource>
