<resource schema="tgas">
	<meta name="title">TGAS catalogue</meta>
	<meta name="description">
		This table is a subset of GaiaSource comprising those stars in the
		Hipparcos and Tycho-2 Catalogues for which a full 5-parameter astrometric
		solution has been possible in Gaia Data Release 1. This is possible because
		the early Hipparcos epoch positions break some degeneracies due to the
		limited Gaia time coverage. This table contains a substantial fraction of
		the around 2.5 million stars in the Hipparcos and Tycho-2 catalogue. Many
		stars have been excluded due to several reasons, such as saturation,
		cross-match errors or bad astrometric solution.  All rows have Gaia
		solution id 1635378410781933568.
	</meta>
	<meta name="creator">
		<meta name="name">GAIA Collaboration</meta>
	</meta>
	<meta name="content">
		<meta name="type">Catalog</meta>
	</meta>
	<meta name="coverage">
		<meta name="profile">AllSky ICRS</meta>
		<meta name="waveband">Optical</meta>
	</meta>
	<meta name="creationDate">2016-09-07T13:29:08Z</meta>
	<meta name="schema-rank">1000</meta>

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

	<meta name="copyright" format="rst">
		If you use public Gaia DR1 data in your paper, please take note of
		`ESAC's guide`_ on how to acknowledge and cite Gaia DR1.

		.. _ESAC's guide: http://gaia.esac.esa.int/documentation/GDR1/Miscellaneous/sec_credit_and_citation_instructions.html
	</meta>


	<table id="main" onDisk="True" mixin="//scs#q3cindex" adql="True"
		primary="source_id">

		<mixin>//scs#pgs-pos-index</mixin>

		<publish sets="ivo_managed,local"/>
		
		<FEED source="gaia/q#dr1columns"/>

		<column name="hip"  type="integer"
			tablehead="Hip#"
			description="Hipparcos identifier">
			<values nullLiteral="-1" />
		</column>
		<column name="tycho2_id" type="text"
			tablehead="TYC2 #"
			description="Tycho 2 identifier"/>
		<column name="pmra" type="double precision"
			ucd="pos.pm;pos.eq.ra" unit="mas/yr"
			tablehead="µ(RA)"
			description="Proper motion in right ascension of the source in ICRS
				at ref_epoch. This is the projection of the proper motion vector in the
				direction of increasing right ascension."/>
		<column name="pmdec" type="double precision"
			ucd="pos.pm;pos.eq.dec" unit="mas/yr"
			tablehead="µ(Dec)"
			description="Proper motion in declination at ref_epoch." />
	</table>

	<coverage>
		<spatial>0/0-11</spatial>
		<spectral>2.721e-19 4.138e-19</spectral>
	</coverage>

	<data>
		<sources>
			<pattern>data/gaiadr1_tgas.fits</pattern>
		</sources>
		<directGrammar cBooster="res/boosterfunc.c" type="fits"
			id="boost">
			<mapKeys>
				raj2000: ra,
				dej2000: dec
			</mapKeys>
		</directGrammar>
		<make table="main"/>
	</data>

	<regSuite title="TGAS regression">
		<regTest title="TGAS data looks reasonable">
			<url REQUEST="doQuery" LANG="ADQL" FORMAT="votable/b2"
				QUERY="SELECT * from tgas.main where source_id=6667791110468879872"
				>/tap/sync</url>
			<code>
				row = self.getFirstVOTableRow()
				self.assertEqual(len(row), 56)
				self.assertEqual(row["phot_variable_flag"], None)
				self.assertAlmostEqual(row["parallax"],  32.05400085449219)
				self.assertAlmostEqual(row["astrometric_excess_noise_sig"],
					478.05993652)
				self.assertAlmostEqual(row['scan_direction_mean_k4'],
					21.1312, places=4)
			</code>
		</regTest>
	</regSuite>
</resource>
