<resource schema="gps1">
	<meta name="creationDate">2017-04-04T19:00:00</meta>
	<meta name="schema-rank">1000</meta>
	<meta name="title">The Gaia-PS1-SDSS (GPS1) Proper Motion Catalog</meta>
	<meta name="description" format="rst">
	This catalog combines Gaia DR1, Pan-STARRS 1, SDSS and 2MASS astrometry
	to compute proper motions for 350 million sources across three-fourths of
	the sky down to a magnitude of mr≈20. Positions of galaxies from Pan-STARRS 1
	are used to build a reference frame for PS1, SDSS, and 2MASS data.
	Gaia DR1 is adapted to that reference frame by exploiting that locally,
	proper motions are linear.

	GPS1 has a characteristic systematic error of less than 0.3 mas/yr, and
	a typical precision of 1.5−2.0 mas/yr. The proper motions have been
	validated using galaxies, open clusters, distant giant stars and QSOs. In
	comparison with other published faint proper motion catalogs, GPS1's
	systematic error (&lt;0.3 mas/yr) is about 10 times better than that of PPMXL
	and UCAC4 (>2.0 mas/yr). Similarly, its precision (~1.5 mas/yr) is
	an improvement by ∼ 4 times relative to PPMXL and UCAC4 (∼6.0 mas/yr).
	For QSOs, the precision of GPS1 is found to be worse (∼2.0−3.0 mas/yr),
	possibly due to their particular differential chromatic refraction (DCR).
	</meta>

	<meta name="creator">Tian, H.-J.; Gupta, P.; Sesar, B.; Rix, H.-W.;
	Liu, C.; Goldman, B.; Platais, I.; Kudritzki, R-P.; Waters, C.Z.</meta>

	<meta name="subject">stars</meta>
	<meta name="subject">surveys</meta>
	<meta name="subject">astrometry</meta>
	<meta name="subject">proper-motions</meta>

	<meta name="contentLevel">Research</meta>
	<meta name="source">2017ApJS..232....4T</meta>
	<meta name="coverage">
		<meta name="waveband">Optical</meta>
		<meta name="waveband">Infrared</meta>
	</meta>

	<coverage>
		<temporal>2010-01-01 2010-01-01</temporal>
		<spatial>0/0-11</spatial>
		<spectral>8.277e-20 5.442e-19</spectral>
	</coverage>

	<table id="main" onDisk="true" mixin="//scs#q3cindex" adql="True">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description">GPS1 main table with some deviations
		from the published paper.  In particular note that Gaia
		and Pan-STARRS1 photometry results from blind crossmatching; see
		d_g and d_ps1 fields for the offsets in the respective crossmatches.
		</meta>
		<index columns="obj_id"/>

		<stc>
			Position ICRS Epoch J2010.0 "ra" "dec"
				Velocity "pmra" "pmde" Error "e_pmra" "e_pmde"
		</stc>

		<stc>
			Position ICRS Epoch J2010.0 "ra" "dec"
				Velocity "pmra_x" "pmde_x" Error "e_pmra_x" "e_pmde_x"
		</stc>

		<stc>
			Position ICRS Epoch J2010.0 "ra" "dec"
				Velocity "pmra_ng" "pmde_ng" Error "e_pmra_ng" "e_pmde_ng"
		</stc>

		<stc>
			Position ICRS Epoch J2010.0 "ra" "dec"
				Velocity "pmra_ps" "pmde_ps" Error "e_pmra_ps" "e_pmde_ps"
		</stc>

		<column name="obj_id" type="bigint" required="True"
			ucd="meta.id;meta.main"
			tablehead="ID"
			description="Unique object identifier (this is not the Pan-STARRS1
				identifier)."
			verbLevel="1"/>
		<column name="ra" type="double precision"
			unit="deg" ucd="pos.eq.ra;meta.main"
			tablehead="RA"
			description="Right Ascension from fit (ICRS, Epoch J2010)."
			verbLevel="1" displayHint="sf=8" note="p"/>
		<column name="dec" type="double precision"
			unit="deg" ucd="pos.eq.dec;meta.main"
			tablehead="Dec"
			description="Declination from fit (ICRS, Epoch J2010)."
			verbLevel="1" displayHint="sf=8" note="p"/>

		<column name="e_ra"
			unit="deg" ucd="stat.error;pos.eq.ra;meta.main"
			tablehead="Err. RA"
			description="Error in Right Ascension from Gaia DR1."
			verbLevel="1" displayHint="sf=8" note="p"/>
		<column name="e_dec"
			unit="deg" ucd="stat.error;pos.eq.dec;meta.main"
			tablehead="Err. Dec"
			description="Error in Declination from Gaia DR1."
			verbLevel="1" displayHint="sf=8" note="p"/>


		<column name="ra_ps1" type="double precision"
			unit="deg" ucd="pos.eq.ra"
			tablehead="RA_PS1"
			description="Right Ascension from Pan-STARRS1"
			verbLevel="1" displayHint="sf=8"
			note="m"/>
		<column name="dec_ps1" type="double precision"
			unit="deg" ucd="pos.eq.dec"
			tablehead="Dec_PS1"
			description="Declination from Pan-STARRS1"
			verbLevel="1" displayHint="sf=8"
			note="m"/>

		<LOOP>
			<csvItems>
				suffix, fitdesc,          pmlevel, errlevel
				,       robust fit,       5,       15
				_x,     x-validation fit, 15,      25
				_ng,    fit without Gaia, 15,      25
				_ps,    fit with only Pan-STARRS, 15,      25
			</csvItems>
			<events>
				<column name="pmra\suffix"
					unit="deg/yr" ucd="pos.pm;pos.eq.ra"
					tablehead="PM α\suffix"
					description="Proper motion in RA with cos(δ) applied; \fitdesc."
					verbLevel="\pmlevel"
					displayHint="displayUnit=mas/yr,sf=2"/>
				<column name="e_pmra\suffix"
					unit="deg/yr" ucd="stat.error;pos.pm;pos.eq.ra"
					tablehead="Err. PM α\suffix"
					description="Error of proper motion in RA, cos(δ) applied; \fitdesc."
					verbLevel="\errlevel"
					displayHint="displayUnit=mas/yr,sf=2"/>
				<column name="pmde\suffix"
					unit="deg/yr" ucd="pos.pm;pos.eq.dec"
					tablehead="PM δ\suffix"
					description="Proper motion in Declination; \fitdesc."
					verbLevel="\pmlevel"
					displayHint="displayUnit=mas/yr,sf=2"/>
				<column name="e_pmde\suffix"
					unit="deg/yr" ucd="stat.error;pos.pm;pos.eq.dec"
					tablehead="Err. PM δ\suffix"
					description="Error of proper motion in Declination; \fitdesc."
					verbLevel="\errlevel"
					displayHint="displayUnit=mas/yr,sf=2"/>
			</events>
		</LOOP>

		<column name="chi2pmra"
			ucd="stat.fit.chi2;pos.pm;pos.eq.ra"
			tablehead="χ² PM α"
			description="Reduced χ² for the robust fit of proper motion in RA"
			verbLevel="15"
			displayHint="sf=2"/>
		<column name="chi2pmde"
			ucd="stat.fit.chi2;pos.pm;pos.eq.dec"
			tablehead="χ² PM δ"
			description="Reduced χ² for the robust fit of proper motion in
				Declination"
			verbLevel="15"
			displayHint="sf=2"/>
		<column name="chi2pmra_ps"
			ucd="stat.fit.chi2;pos.pm;pos.eq.ra"
			tablehead="χ² PM α_ps"
			description="Reduced χ² for the Pan-STARRS 1-only fit of
				proper motion in RA"
			verbLevel="25"
			displayHint="sf=2"/>
		<column name="chi2pmde_ps"
			ucd="stat.fit.chi2;pos.pm;pos.eq.dec"
			tablehead="χ² PM δ"
			description="Reduced χ² for the Pan-STARRS 1-only fit of proper
				motion in Declination"
			verbLevel="15"
			displayHint="sf=2"/>

		<LOOP>
			<csvItems>
				band, nband, ucd, description
				g, g, opt.V, g-band PSF magnitude from Pan-STARRS1 DR1
				r, r, opt.R, r-band PSF magnitude from Pan-STARRS1 DR1
				i, i, opt.I, i-band PSF magnitude from Pan-STARRS1 DR1
				z, z, opt.I, z-band PSF magnitude from Pan-STARRS1 DR1
				y, y, opt.I, y-band PSF magnitude from Pan-STARRS1 DR1
				J, j, ir.J, J-band magnitude from 2MASS
				H, h, ir.H, H-band magnitude from 2MASS
				K, k, ir.K, K_s-band magnitude from 2MASS
				G, gaia, opt.V, G-band magnitude from Gaia
			</csvItems>
			<events>
				<column name="mag\nband"
					unit="mag" ucd="phot.mag;em.\ucd"
					tablehead="mag \band"
					description="\description"
					verbLevel="5" displayHint="sf=3"
					note="c"/>
				<column name="e_mag\nband"
					unit="mag" ucd="stat.error;phot.mag;em.\ucd"
					tablehead="E. mag \band"
					description="Error in \description"
					verbLevel="15" displayHint="sf=2,displayUnit=mmag"/>
			</events>
		</LOOP>

		<column name="n_obsps1" type="smallint" required="True"
			ucd="meta.number;obs"
			tablehead="N(PS1)"
			description="Number of PS1 SeasonAVG detections."
			verbLevel="25"/>
		<column name="n_obs" type="smallint" required="True"
			ucd="meta.number;obs"
			description="number of all the detections."
			verbLevel="15"/>
		<column name="surveys" type="smallint" required="True"
			ucd="meta.code"
			verbLevel="15"
			tablehead="Sources"
			description="Sum of source codes for the  source catalogues
				that went into this row.  Pan-STARRS is always present.
				Source codes: 5 -- 2MASS; 10 -- SDSS, 20 -- Gaia."/>

		<column name="d_ps1"
			unit="arcsec" ucd="pos.eq;arith.diff"
			tablehead="d(PS1)"
			description="Distance between position in GPS1 and the associated
				(closest) position in Pan-STARRS1 used for (not accounting for the
				epoch difference)."
			verbLevel="15"/>
		<column name="d_g"
			unit="arcsec" ucd="pos.eq;arith.diff"
			tablehead="d(G)"
			description="Distance between position in GPS1 and the associated
				(closest) position in Gaia DR1 (not accounting for the epoch
				difference)."
			verbLevel="15"/>

		<meta name="note" tag="c">
			Pan-STARRS, 2MASS, and Gaia photometry was re-added to the objects
			via a blind crossmatch; it does not necessarily correspond to the
			photometry of the objects that were used to derive the astrometry, in
			particular in crowded fields.
		</meta>

		<meta name="note" tag="p">
			The positions are SeasonAVGs from Pan-STARRS1 if unvailable from
			Gaia DR1.  The errors are NULL in these cases.
		</meta>

	</table>

	<data id="import">
		<sources pattern="data/*.fits">
			<ignoreSources pattern="*sample*"/>
		</sources>
		<directGrammar id="booster" cBooster="res/boosterfunc.c"
			type="fits">
			<mapKeys>
				e_ra: raGErr,
				e_dec: decGErr,
				obj_id: objID,
				pmra: mura,
				e_pmra: muraErr,
				pmra_x: xmura,
				e_pmra_x: xmuraErr,
				pmra_ng: muraog,
				e_pmra_ng: muraogErr,
				chi2pmra: chi2ra,
				pmde: mudec,
				e_pmde: mudecErr,
				pmde_x: xmudec,
				e_pmde_x: xmudecErr,
				pmde_ng: mudecog,
				e_pmde_ng: mudecogErr,
				chi2pmde: chi2dec,
				pmra_ps: muraPS1,
				e_pmra_ps: muraPS1Err,
				chi2pmra_ps: chi2raPS1,
				pmde_ps: mudecPS1,
				e_pmde_ps: mudecPS1Err,
				chi2pmde_ps: chi2decPS1,
				n_obsps1: NobsPS1,
				n_obs: Nobs,
				surveys: flag,
				ra_ps1: raPS1,
				dec_ps1: decPS1,
				gaia_id: Gaia_source_id,
				magr: magPS1,
				e_magr: magPS1Err,
				maggaia: G,
				e_maggaia: GErr,
				d_ps1: dPS1,
				d_g: dG
			</mapKeys>
		</directGrammar>
		<make table="main"/>
	</data>

	<service id="cone" allowed="form,scs.xml">
		<publish sets="ivo_managed,local" render="form"/>
		<publish sets="ivo_managed" render="scs.xml"/>
		<dbCore queriedTable="main">
			<FEED source="//scs#coreDescs"/>
			<condDesc buildFrom="obj_id"/>
			<condDesc buildFrom="magr"/>
		</dbCore>
		<meta name="shortName">GPS1</meta>
		<meta name="testQuery.ra">294.42</meta>
  	<meta name="testQuery.dec">-1.53</meta>
  	<meta name="testQuery.sr">0.01</meta>
	</service>

	<regSuite title="GPS1 regression">
		<regTest title="GPS1 SCS returns plausible data">
			<url RA="18.95" DEC="-15.098" SR="0.01" VERB="3">cone/scs.xml</url>
			<code>
				rows = self.getVOTableRows()
				self.assertEqual(len(rows), 1)
				row = rows[0]
				self.assertEqual(row["obj_id"], "-2364829609020553088")
				self.assertAlmostEqual(row["ra"], 18.9499310329087)
				self.assertAlmostEqual(row["pmde"], -7.7454797065e-06)
				self.assertEqual(row["surveys"], 25)
				self.assertTrue(None not in row.values(), "None in GPS1 record?")

				self.assertXpath("//v:COOSYS[1]", {
					"system": "ICRS", "ID": "system"})

				mainSysId = self.getXpath("//v:FIELD[@name='ra']/@ref")[0]
				self.assertXpath("//v:FIELD[@name='pmra']", {"ref": mainSysId})

				xSysId = self.getXpath("//v:FIELD[@name='pmra_x']/@ref")[0]
				self.assertXpath("//v:FIELD[@name='e_pmde_x']", {"ref": xSysId})

				ngSysId = self.getXpath("//v:FIELD[@name='pmde_ng']/@ref")[0]
				self.assertXpath("//v:FIELD[@name='e_pmra_ng']", {"ref": ngSysId})
			</code>
		</regTest>
	</regSuite>
</resource>
