<?xml version="1.0" encoding="utf-8"?>

<resource resdir="fk6">
	<schema>fk6</schema>
	<meta name="title">The Sixth Fundamental Catalogue (FK6)</meta>
	<meta name="schema-rank">100</meta>
	<meta name="creationDate">2008-05-08T12:00:00Z</meta>
	<meta name="description" format="plain">
		Parts I and III of the sixth fundamental catalog, a catalog
		of high-precision astrometry for bright stars combining centuries
		of ground-based observations as reflected in FK5 with HIPPARCOS
		astrometry.

		The result contains, in particular for the proper motions, statistically
		significant improvements of the Hipparcos data und represents a system of
		unprecedented accuracy for these 4150 fundamental stars. The typical mean
		error in pm is 0.35 mas/year for 878 basic stars, and 0.59 mas/year for the
		sample of the 3272 additional stars.
		</meta>
	<meta name="referenceURL" title="ARI FK6 pages">http://www.ari.uni-heidelberg.de/datenbanken/fk6/index.php.en</meta>

	<meta name="subject">astrometry</meta>
	<meta name="subject">standard-stars</meta>

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

	<meta name="_news" author="MD" date="2011-07-06">Added the non-basic
		columns.</meta>

	<FEED source="//procs#license-cc0" what="the FK6 data"/>

	<meta name="_longdoc" format="rst"><![CDATA[
	Input
	-----

	The FK5 consists of observations coming from the past 200 years. Three parts
	were published giving the results of that work: First we have the `Basic
	FK5`_ with 1535 stars, second the `FK5 Extension`_ with 3117 objects , and
	third the `FK5 Supplement`_ with 995 objects.

	The results from the HIPPARCOS mission were published in 1997 (`The
	Hipparcos and Tycho Catalogues`_).

	The catalogue
	-------------

	The combination of the Hipparcos data and the FK5 was primarily done using
	only probable single stars. Two parts were published:

	In `FK6 part I`_ (published 1999) 878 single stars (or objects that could be
	treated as single) were used from the Basic FK5, in `FK6 part III`_ (published
	2000) 3272 single stars (or objects that could be treated as single) from the
	FK5 Extension and the FK5 Supplement were added.

	The FK6 catalogue gives three solutions for each star: Besides the standard
	model for single stars, in which these were treated with a constant space
	velocitiy (single star mode, "SI"), two further solutions were added. The
	data of the standard single star mode "SI" are valid for real single stars
	only. For all other samples of stars it is, however, necessary to include the
	statistically significant influence of stars with companions in the
	solutions. The principles of this statistical astrometry were described by
	`1997A&A...325..367W`_ and are also given in the printed FK6 catalogues.

	The uncertain knowledge of the included correlations allows merely to produce
	two approximate solutions for short-period predictions of the position (short
	term prediction, "STP") or predictions for longer terms (long term
	predictions, "LTP"). The data of the STP mode should be used for epochs near
	to 1991.25, the mean observational epoch of Hipparcos, the data from the LTP
	mode for epochs differing from this mean epoch by more than 10-20 years.

	Note that part II of the catalog (containing binary stars
	with orbits) was never published.  See :bibcode:`2000A&A...360..399W` for an
	orbit of Polaris.

	Abbreviations used in the notes for the objects
	-----------------------------------------------

	af:
		binarity is assumed optical since objects are approximately fixed
	nc:
		binarity is assumed optical since objects show no common proper motion
	hv
		binarity is assumed optical since objects have a high relative velocity
	pc
		binarity is assumed optical since objects have large spatial separation
	no
		no relative position given
	oo
		only one observation given in CCDM or WDS (hence no relative proper
		motion available)

	.. _Basic FK5: http://ads.ari.uni-heidelberg.de/abs/1988VeARI..32....1F
	.. _FK5 Extension: http://ads.ari.uni-heidelberg.de/abs/1991VeARI..33....1F
	.. _FK5 Supplement: http://ads.ari.uni-heidelberg.de/abs/1993VeARI..34.....S
	.. _The Hipparcos and Tycho Catalogues: http://ads.ari.uni-heidelberg.de/abs/1997ESASP1200.....P
	.. _Fk6 part I: http://ads.ari.uni-heidelberg.de/abs/1999VeARI..35....1W
	.. _FK6 part III: http://ads.ari.uni-heidelberg.de/abs/2000VeARI..37....1W
	.. _1997A&A...325..367W: http://ads.ari.uni-heidelberg.de/abs/1997A%26A...325..367W
	]]></meta>

	<!-- the following macros let us handle all reductions modes analoguously
	-->

	<macDef name="modes">
		mname
		LTP
		STP
		HIP
	</macDef>

	<macDef name="parmodes">
		mname
		SI
		STP
		HIP
	</macDef>

	<STREAM id="commonFrontFields" doc="Field 1..23 are (about) the same
		for parts I and III.">

		<column name="hipno" type="integer" required="True"
			ucd="meta.id"
			tablehead="HIP#"
			description="Number of the star in the HIPPARCOS Catalogue (ESA 1997)"
			verbLevel="25"/>
		<column name="comname" type="text"
			ucd="meta.id"
			tablehead="Name"
			description="Common Name"
			verbLevel="25"/>
		<column name="raj2000" type="double precision" required="True"
			ucd="pos.eq.ra;meta.main" unit="deg"
			tablehead="RA"
			description="The right ascension alpha of the star at epoch and
			equinox J2000.0 in the ICRS/HIPPARCOS system for the SI mode of the FK6."
			verbLevel="1"
			displayHint="sf=8"/>
		<column name="dej2000" type="double precision" required="True"
			ucd="pos.eq.dec;meta.main" unit="deg"
			tablehead="Dec"
			description="The declination delta of the star at epoch and
			equinox J2000.0 in the ICRS/HIPPARCOS system for the SI mode of the FK6."
			verbLevel="1"
			displayHint="sf=8"/>
		<column name="pmra" required="True"
			ucd="pos.pm;pos.eq.ra;meta.main" unit="deg/yr"
			tablehead="PM α"
			description="The proper-motion component of the star
				in alpha at epoch and equinox J2000.0 in the ICRS/HIPPARCOS
				system for the SI mode of the FK6, cos(delta) applied."
			verbLevel="5"
			displayHint="displayUnit=mas/yr"/>
		<column name="pmde" required="True"
			ucd="pos.pm;pos.eq.dec;meta.main" unit="deg/yr"
			tablehead="PM δ"
			description="The proper-motion component mu_delta of the star
				in delta at epoch and equinox J2000.0 in the ICRS/HIPPARCOS
				system for the SI mode of the FK6."
			verbLevel="5"
			displayHint="displayUnit=mas/yr"/>

		<column name="epra" required="True"
			ucd="time.epoch;pos.eq.ra" unit="yr"
			tablehead="Ep(RA)"
			description="Central epoch of raj2000 in the SI mode."
			verbLevel="21"/>
		<column name="e_raj2000" required="True"
			ucd="stat.error;pos.eq.ra;meta.main" unit="deg"
			tablehead="Err(RA)"
			description="Mean error of raj2000 in the SI mode, cos(delta) applied."
			verbLevel="15"
			displayHint="displayUnit=mas"/>
		<column name="e_pmra" required="True"
			ucd="stat.error;pos.pm;pos.eq.ra;meta.main" unit="deg/yr"
			tablehead="Err(PM RA)"
			description="Mean error of pmra in the SI mode."
			verbLevel="15"
			displayHint="displayUnit=mas/yr"/>

		<column name="epde" required="True"
			ucd="time.epoch;pos.eq.dec" unit="yr"
			tablehead="Ep(Dec)"
			description="Central epoch of delta in the SI mode."
			verbLevel="21"/>
		<column name="e_dej2000" required="True"
			ucd="stat.error;pos.eq.ra;meta.main" unit="deg"
			tablehead="Err(Dec)"
			description="Mean error of dej2000 at the central epoch epde"
			verbLevel="15"
			displayHint="displayUnit=mas"/>
		<column name="e_pmde" required="True"
			ucd="stat.error;pos.pm;pos.eq.dec;meta.main" unit="deg/yr"
			tablehead="Err(PM Dec)"
			description="Mean error of pmde in the SI mode."
			verbLevel="15"
			displayHint="displayUnit=mas/yr"/>

		<column name="pres"
			ucd="pos.parallax" unit="deg"
			tablehead="Parallax"
			description="'Resulting' parallax p_res of the star. This is
				either the HIPPARCOS parallax or a photometric/spectroscopic parallax."
			verbLevel="15"
			displayHint="displayUnit=mas"/>
		<column name="e_pres"
			ucd="stat.error;pos.parallax" unit="deg"
			tablehead="Err.(Par.)"
			description="Mean error of parallax"
			verbLevel="25"
			displayHint="displayUnit=mas"/>
		<column name="src_par" type="char" required="True"
			ucd="meta.code;pos.parallax"
			tablehead="Src(Par.)"
			description="Source of parallax (H=HIPPARCOS, P=Newly determined
				photometric or spectroscopic parallax)"
			verbLevel="25"/>
		<column name="v_rad"
			ucd="spect.dopplerVeloc;pos.heliocentric" unit="km/s"
			tablehead="v_rad"
			description="Radial velocity"
			verbLevel="15"/>

		<column name="vmag" required="True"
			ucd="phot.mag;em.opt.V" unit="mag"
			tablehead="m_V"
			description="Apparent visual magnitude m_V of the star, taken from the
				HIPPARCOS Catalogue"
			verbLevel="15" displayHint="sf=2"/>

		<column name="varFlag" type="char"
			ucd="meta.code;src.var"
			tablehead="Var?"
			description="Flag for the variability of the brightness of the
				star, taken from the HIPPARCOS Catalogue (see note)"
			verbLevel="19"
			note="V">
			<values nullLiteral="."/>
		</column>

		<column name="K_bin" type="smallint" required="True"
			ucd="meta.code.multip"
			tablehead="Binarity"
			description="Flag for the double-star nature of the object (see note)"
			verbLevel="23"
			note="M"/>
		<column name="K_Delta_mu" type="char"
			ucd="meta.code.multip"
			tablehead="Dmu"
			description="Flag for the double-star nature of the object based
				on differences between various proper motions (see note)"
			verbLevel="23"
			note="D">
			<values nullLiteral="."/>
		</column>
		<column name="K_ae" type="smallint"
			ucd="meta.code.qual"
			tablehead="Excellent?"
			description="Flag for astrometrically excellent stars, larger
				numbers are better (3 is best)"
			verbLevel="5">
			<values nullLiteral="-1"/>
		</column>

		<column name="sect" type="smallint" required="True"
			ucd="meta.id.part;meta.main"
			tablehead="FK6 part"
			description="FK6 part of this record"
			verbLevel="3"/>

		<meta name="note" tag="V">
			A nonempty varFlag field indicates that the star is variable with
			an amplitude of

			1:
				&lt; 0.06 mag
			2:
				0.06 .. 0.6 mag
			3:
				&gt; 0.6mag
		</meta>

		<meta name="note" tag="M">
			K_bin is a flag for the double-star nature of the object: K_bin = 10d1+d2

			First digit d1

			The first digit d1 describes the information on the double-star nature
			based on the proper-motion differences Delta_mu.  The method and the
			meaning of the corresponding test parameters F are explained in
			1999A&amp;A...346..675W.

			1:
				all values of F (F_FH, F_0H, F_0(GC)H, F_0F) are below 2.49
			2:
				at least one value of F (F_FH, F_0H, F_0(GC)H, F_0F) is larger than 3.44
			3:
				all other (intermediate) cases

			Second digit d2:

			The second digit d2 describes the information on the double-star nature
			based on various other methods. If the data indicate various kinds of
			binarity, the 'astrometrically most disturbing' effect is given.

			1:
				single star indicated
			2:
				the star is a member of a visual binary (gravitationally bound system),
				or the object is resolved by speckle interferometry
			3:
				the object is suspected to be a visual binary (mainly due to HIPPARCOS)
			4:
				the star has at least one optical companion with a separation of
				rho&lt;60 arcsec
			5:
				the star has at least one optical companion, but all companions have
				a separation of rho &gt;= 60"
			6:
				astrometric binary (mainly the non-standard solutions O, G, V, X of HIP)
			7:
				spectroscopic binary with a known orbit, or the star is an eclipsing
				binary
			8
				the radial velocity of the star is variable (indicating a spectroscopic
				binary), or the object shows a composite spectrum (indicating a double
				star)
			9:
				the radial velocity of the star may be variable (possible indication
				for a spectroscopic binary), or the object may show a composite
				spectrum (possibly indicating a double star), or other weak indications
				of binarity, or the star has a (suspected) planetary companion
		</meta>

		<meta name="note" tag="D">
			K_Delta_mu is a flag for the double-star nature of
			the object based on differences between (see 1999A&amp;A...346..675W).

			1:
				single-star candidate
			2:
				Delta_mu binary
			blank:
				uncertain (between 1 and 2), or the binary nature which is indicated by
				other data does not allow to classify the object as a single-star
				candidate
		</meta>

	</STREAM>

	<STREAM id="commonRowmakerItems" doc="Stuff common to the rowmakers
		for part1 and part3">
	
		<var name="raj2000">hmsToDeg(@alphaHMS)</var>
		<var name="dej2000">dmsToDeg(@deltaDMS)</var>
		<var name="pmra">float(killBlanks(@pmra))*DEG_MAS</var>
		<var name="pmde">float(killBlanks(@pmde))*DEG_MAS</var>

		<map dest="epra">float(@epra2)+1900</map>
		<map dest="epde">float(@epde2)+1900</map>
		<map dest="v_rad">base.parseFloat(killBlanks(@v_rad))</map>
		<map dest="vmag">base.parseFloat(killBlanks(@vmag))</map>

		<!-- string items just needing to be stripped -->
		<LOOP listItems="comname localid src_par varFlag K_bin K_Delta_mu
				K_ae">
			<events>
				<map dest="\item">@\item.strip() or None</map>
			</events>
		</LOOP>

		<!-- all items that just need conversion from mas to deg -->
		<LOOP listItems="e_raj2000 e_dej2000 e_pmra e_pmde
				pres e_pres">
			<events>
				<map dest="\item">float(@\item)*DEG_MAS</map>
			</events>
		</LOOP>

		<idmaps>
			hipno, raj2000, dej2000, pmra, pmde,
		</idmaps>

	</STREAM>

	<table onDisk="True" id="part1" adql="True" primary="localid"
			mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description">Part I of the FK6 (successor to Basic FK5)</meta>
		<nrows>878</nrows>
		<FEED source="commonFrontFields"/>

		<column name="localid" type="text" required="true"
			ucd="meta.id;meta.main"
			tablehead="Identifier"
			description="FK6 number of the star (it is identical with
			its FK5 or FK4sup number)"
			verbLevel="1">
			<values min="" max=""/>
		</column>

		<LOOP csvItems="\modes">
			<events>
				<column name="ra\mname" type="double precision" ucd="pos.eq.ra"
					tablehead="RA (\mname)" verbLevel="17" unit="deg"
					description="Right ascension in \mname mode"
					displayHint="sf=10"/>
				<column name="de\mname" type="double precision" ucd="pos.eq.dec"
					tablehead="Dec (\mname)" verbLevel="17" unit="deg"
					description="Declination in \mname mode"
					displayHint="sf=10"/>
				<column name="pmra\mname" ucd="pos.pm;pos.eq.ra"
					tablehead="PM RA (\mname)" verbLevel="17" unit="deg/yr"
					description="Proper motion in RA, cos(delta) applied, in
						\mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>
				<column name="pmde\mname" ucd="pos.pm;pos.eq.dec"
					tablehead="PM Dec (\mname)" verbLevel="17" unit="deg/yr"
					description="Proper motion in Dec in \mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>

				<column name="epra\mname" ucd="stat.error;time.epoch;pos.eq.ra"
					tablehead="Ep. RA (\mname)" verbLevel="27" unit="yr"
					description="Central epoch of RA (\mname)"
					displayHint="sf=2"/>
				<column name="e_ra\mname" ucd="stat.error;pos.eq.ra"
					tablehead="Err. RA (\mname)" verbLevel="21" unit="deg"
					description="Error in RA (\mname) with cos(delta) already applied"
					displayHint="sf=2,displayUnit=mas"/>
				<column name="e_pmra\mname" ucd="stat.error;pos.pm;pos.eq.ra"
					tablehead="Err. PM RA (\mname)" verbLevel="21" unit="deg/yr"
					description="Mean error in PM(RA)*cos(delta) in \mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>
				<column name="epde\mname" ucd="stat.error;time.epoch;pos.eq.dec"
					tablehead="Ep. Dec (\mname)" verbLevel="27" unit="yr"
					description="Central epoch of Dec (\mname)"
					displayHint="sf=2"/>
				<column name="e_de\mname" ucd="stat.error;pos.eq.dec"
					tablehead="Err. Dec (\mname)" verbLevel="21" unit="deg"
					description="Error in Dec (\mname)"
					displayHint="sf=2,displayUnit=mas"/>
				<column name="e_pmde\mname" ucd="stat.error;pos.pm;pos.eq.dec"
					tablehead="Err. PM Dec (\mname)" verbLevel="21" unit="deg/yr"
					description="Mean error in PM(Dec) in \mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>
			</events>
		</LOOP>

		<LOOP csvItems="\parmodes">
			<events>
				<column name="parallax\mname" ucd="pos.parallax"
					tablehead="Par. (\mname)" verbLevel="25" unit="deg"
					description="Parallax obtained in solution \mname"
					displayHint="sf=2,displayUnit=mas"/>
				<column name="e_parallax\mname" ucd="stat.error;pos.parallax"
					tablehead="Err. Par. (\mname)" verbLevel="29" unit="deg"
					description="Error in parallax obtained in solution \mname"
					displayHint="sf=2,displayUnit=mas"/>
			</events>
		</LOOP>

		<column name="note" type="text"
			ucd="meta.note"
			tablehead="Note"
			description="Note for this object"
			verbLevel="18"/>

	</table>

	<procDef type="apply" id="resolveNote">
		<doc><![CDATA[This proc application reads a file in the format of FK6
		individual notes ("(<noteno>) <stuff>)+") in setup and
		then adds a note key in the result row if vars["noteno"]
		refers to a noteno defined.]]></doc>

		<setup>
			<par name="notesFileName" description="resdir-relative name of the
				file containing the notes"/>
			<code>
				notesDict, accum = {}, []
				openerPat = re.compile(r"(\\d+)\\)")
				curNoteNumber = None

				with open(os.path.join(parent.parent.parent.rd.resdir,
						notesFileName)) as f:
					for ln in f:
						mat = openerPat.match(ln)
						if mat:
							if curNoteNumber is not None:
								notesDict[curNoteNumber] = "\\n".join(accum)
							curNoteNumber = int(mat.group(1))
							accum = [ln[mat.end():].strip()]
						else:
							accum.append(ln.strip())
				notesDict[curNoteNumber] = "\\n".join(accum)
				del accum, openerPat, curNoteNumber, f, mat
			</code>
		</setup>
		<code>
			if vars["noteno"].strip():
				result["note"] = notesDict[int(vars["noteno"])]
			else:
				result["note"] = None
		</code>
	</procDef>


	<data id="import_part1">
		<sources pattern="data/fk61cp01.txt"/>
		<reGrammar topIgnoredLines="10" enc="iso-8859-1" fieldSep="\|">
			<names>startpad, localid, hipno, comname,
			alphaHMS, deltaDMS, pmra, pmde,
			epra2, e_raj2000, e_pmra,
			epde2, e_dej2000, e_pmde,
			pres, e_pres, src_par, v_rad,
			vmag, varFlag,
			K_bin,K_Delta_mu, K_ae,
			draLTP, draSTP, draHIP, draFK5,
			ddeLTP, ddeSTP, ddeHIP, ddeFK5,
			dpmraLTP, dpmraSTP, dpmraHIP, dpmraFK5, dpmramu0,
			dpmdeLTP, dpmdeSTP, dpmdeHIP, dpmdeFK5, dpmdemu0,
			epraLTP, epraSTP, epraHIP, epraFK5,
			e_raLTP, e_raSTP, e_raHIP, e_raFK5,
			e_pmraLTP, e_pmraSTP, e_pmraHIP, e_pmraFK5, e_pmramu0,
			epdeLTP, epdeSTP, epdeHIP, epdeFK5,
			e_deLTP, e_deSTP, e_deHIP, e_deFK5,
			e_pmdeLTP, e_pmdeSTP, e_pmdeHIP, e_pmdeFK5, e_pmdemu0,
			parallaxSI, parallaxSTP, parallaxHIP,
			e_parallaxSI, e_parallaxSTP, e_parallaxHIP,
			drasys, ddesys, dpmrasys, dpmdesys,
			e_drasys, e_ddesys, e_dpmrasys, e_dpmdesys, K_sys,
			F_FH, F_0H, F_0GCH, F_0F,
			noteno, endpad</names>
		</reGrammar>

		<make table="part1">
			
			<rowmaker id="make_part1">
			
				<FEED source="commonRowmakerItems"/>

				<apply procDef="resolveNote">
					<bind name="notesFileName">"data/fk61ip01.txt"</bind>
				</apply>
			

				<LOOP csvItems="\modes">
					<events>
						<map dest="ra\mname">@raj2000+float(
							killBlanks(@dra\mname))*DEG_MAS/math.cos(
							@dej2000*utils.DEG)</map>
						<map dest="de\mname">@dej2000+float(
							killBlanks(@dde\mname))*DEG_MAS</map>
						<map dest="pmra\mname">@pmra+float(
							killBlanks(@dpmra\mname))*DEG_MAS</map>
						<map dest="pmde\mname">@pmde+float(
							killBlanks(@dpmde\mname))*DEG_MAS</map>
						<map dest="e_ra\mname">float(@e_ra\mname)*DEG_MAS</map>
						<map dest="e_pmra\mname">float(@e_pmra\mname
							)*DEG_MAS</map>
						<map dest="epra\mname">1900+float(@epra\mname)</map>
						<map dest="e_de\mname">float(@e_de\mname)*DEG_MAS</map>
						<map dest="e_pmde\mname">float(@e_pmde\mname)*DEG_MAS</map>
						<map dest="epde\mname">1900+float(@epde\mname)</map>
					</events>
				</LOOP>

				<LOOP csvItems="\parmodes">
					<events>
						<map dest="parallax\mname">float(killBlanks(@parallax\mname)
							)*DEG_MAS</map>
						<map dest="e_parallax\mname">float(
							killBlanks(@e_parallax\mname))*DEG_MAS</map>
					</events>
				</LOOP>

				<map dest="sect">1</map>

			</rowmaker>
		</make>
	</data>

	<STREAM id="tablenoteColumns" doc="The columns in the part3 tablenotes;
		since I'm folding in the tablenotes into the main table, these
		occur in both the memory-only intermediate table and in the part3
		itself.">
		<column name="hipdup" type="char"
			ucd="meta.code.multip"
			tablehead="HIP dup."
			description="HIPPARCOS indicators for a suspected visual binary;
			d=duplicity induced variability (H52),
			s=Hipparcos suspected non-single (H61),
			t=both"
			verbLevel="28">
			<values nullLiteral="."/></column>
		<!-- ignore U, too much effort for too little use -->
		<column name="hipfitqual" type="smallint"
			ucd="meta.code.qual"
			tablehead="HIP fit"
			description="HIPPARCOS goodness-of-fit parameter (HIP Field H30, F2);
				A large value of F2 (e.g. larger than 3) may be caused by a
				duplicity of the object, but other reasons cannot be excluded.
				NULL means a negative goodness-of-fit in HIP."
			verbLevel="28">
			<values nullLiteral="-1"/></column>
		<column name="speckleflag" type="char"
			ucd="meta.code.multip"
			tablehead="Speckle dup?"
			description="Indications on binarity provided by the catalogue
				of speckle observations (1999AJ....117.1890M); b=binarity resolved,
				u=possibly resolved, n=object observed but not resolved"
			verbLevel="28">
			<values nullLiteral="."/></column>
		<column name="viscomp" type="char"
			ucd="meta.code.multip"
			tablehead="Vis. comp."
			description="Indicator for a star which has one (or more) visual
				component(s) with a separation rho of at least 60 arcsec."
			note="VC" verbLevel="28">
			<values nullLiteral="."/></column>
		<column name="binindsrv" type="text"
			ucd="meta.code.multip"
			tablehead="RV Indicators"
			description="Indications for binarity provided by radial velocities
				from various sources (see Note)"
			note="RV" verbLevel="28"/>
		<column name="binindecl" type="char"
			ucd="meta.code;src.var"
			tablehead="Eclipsing?"
			description="Indicators for binarity from photometric variability
				(a=Algol-type, b=β Lyr-type, e=uncertain type, w=W UMa type)"
			verbLevel="28">
			<values nullLiteral="."/></column>
		<column name="pulsating" type="char"
			ucd="meta.code;src.var"
			tablehead="Pulsating?"
			description="Indicator for a variability of the radial velocity
			V_rad due to stellar pulsation (which may be confused with a
			variability of V_rad due to spectroscopic binarity; c=Cepheid,
			s=δ Sct, b=β Cep)">
			<values nullLiteral="."/></column>

		<meta name="note" tag="VC">
			Source of the information on the visual companion:

			===  ==================================================
			 c   CCDM (1994CoORB.115....1D)
			 t   TYCHO2 (2000yCat.1259....0H)
			 w   WDS (1997A&amp;AS..125..523W	and updated versions)
			 r   other sources
			===  ==================================================

			Note that visual binaries with separations below 60 arcsec
			are generally excluded from the FK6(III).
		</meta>
		
		<meta name="note" tag="RV">
			Radial velocity-based binarity indicators, in sequence, from

			* The Catalogue of Stellar Radial Velocities (1953GCRV..C......0W)
			* The Bright Star Catalogue (1982bsc..book.....H)
			* SIMBAD (the ORV block)
			* SIMBAD (the MK block; b=binary, u=possibly a binary)
			* Third Bibliographic Catalogue of Stellar Radial Velocities (1994A&amp;AS..108..603B)
			* Fourth Bibliographic Catalogue of Stellar Radial Velocities 2000A&amp;AS..144....1M)
			* Other sources

			For each catalog except SIMBAD MK, one of the following
			characters is given:

			===  ======================================================
			 v   radial velocity is variable
			 u   radial velocity may be variable
			 2   variable radial velocities for two stellar components
			 b   (other) indications of binarity
			 d   (other) indications of binarity are doubtful
			 f   probably erroneous indication on binarity
			 c   radial velocity is probably constant
			 .   no information from this source
			===  ======================================================
		</meta>
	</STREAM>

	<table onDisk="True" id="part3" adql="True">
		<meta name="description">Part III of the FK6
			(containing stars from the FK5 extension and Rsup)</meta>
		<nrows>3273</nrows>
		<column name="localid" type="text" required="true"
			ucd="meta.id;meta.main"
			tablehead="Identifier"
			description="FK6 number of the star (it is identical with
			its FK5 or FK4sup number)"
			verbLevel="1">
			<values min="" max=""/>
		</column>

		<column name="subsample" type="text"
			ucd="meta.id;meta.dataset"
			tablehead="Subsamp."
			description="Flag for the subsample of FK6(III) stars; BX and FX
				denote stars from the bright and faint FK5 extensions, respectively,
				RS denotes stars from RSup (1993VeARI..34....1S)"
			verbLevel="25"/>

		<FEED source="commonFrontFields"/>

		<LOOP csvItems="\modes">
			<events>
				<column name="pmra\mname" ucd="pos.pm;pos.eq.ra"
					tablehead="PM RA (\mname)" verbLevel="17" unit="deg/yr"
					description="Proper motion in RA, cos(delta) applied, in
						\mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>
				<column name="pmde\mname" ucd="pos.pm;pos.eq.dec"
					tablehead="PM Dec (\mname)" verbLevel="17" unit="deg/yr"
					description="Proper motion in Dec in \mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>

				<column name="e_pmra\mname" ucd="stat.error;pos.pm;pos.eq.ra"
					tablehead="Err. PM RA (\mname)" verbLevel="21" unit="deg/yr"
					description="Mean error in PM(RA)*cos(delta) in \mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>
				<column name="e_pmde\mname" ucd="stat.error;pos.pm;pos.eq.dec"
					tablehead="Err. PM Dec (\mname)" verbLevel="21" unit="deg/yr"
					description="Mean error in PM(Dec) in \mname mode"
					displayHint="sf=2,displayUnit=mas/yr"/>
			</events>
		</LOOP>

		<FEED source="tablenoteColumns"/>

		<column name="note" type="text"
			ucd="meta.note"
			tablehead="Note"
			description="Note for this object"
			verbLevel="18"/>
	</table>

	<data id="make_tabnotes" auto="False">
		<meta name="description">An internal table used during input
		of fk6 part 3 (the addTableNotes proc).</meta>
		<!-- to save on joins, I fold this table into the part3 table
		on import -->

		<sources>data/fk63np01.txt</sources>

		<table id="tabularnotes" onDisk="False" primary="localid">
			<column name="localid" type="text" description="FK6 number"/>

			<FEED source="tablenoteColumns"/>

			<column name="noteno" type="text" description="pointer into
				fk63ip01.txt, resolved by an apply in the rowmaker."/>
		</table>

		<reGrammar topIgnoredLines="10" fieldSep="\|">
			<names>startpad, localid, ignored, tabnotes, noteno, endpad</names>
		</reGrammar>

		<make table="tabularnotes">
			<rowmaker idmaps="noteno">
			<map dest="localid">@localid.strip()</map>
			<map dest="hipdup">parseWithNull(@tabnotes[2], str, ".")</map>
			<map dest="hipfitqual">parseWithNull(@tabnotes[6], int, "-")</map>
			<map dest="speckleflag">parseWithNull(@tabnotes[9], str, ".")</map>
			<map dest="viscomp">parseWithNull(@tabnotes[10], str, ".")</map>
			<map dest="binindsrv">@tabnotes[13:17]+@tabnotes[19:22]</map>
			<map dest="binindecl">parseWithNull(@tabnotes[24], str, ".")</map>
			<map dest="pulsating">parseWithNull(@tabnotes[25], str, ".")</map>
				
			</rowmaker>
		</make>
	</data>


	<data id="import_part3">
		<sources pattern="data/fk63cp01.txt"/>

		<reGrammar topIgnoredLines="10" enc="iso-8859-1" fieldSep="\|">
			<names>startpad, localid, hipno, subsample, comname,
			alphaHMS, deltaDMS, pmra, pmde,
			epra2, e_raj2000, e_pmra,
			epde2, e_dej2000, e_pmde,
			pres, e_pres, src_par, v_rad,
			vmag, varFlag,
			K_bin,K_Delta_mu, K_ae,
			dpmraLTP, dpmraSTP, dpmraHIP, dpmraFK5, dpmramu0,
			dpmdeLTP, dpmdeSTP, dpmdeHIP, dpmdeFK5, dpmdemu0,
			e_pmraLTP, e_pmraSTP, e_pmraHIP, e_pmraFK5, e_pmramu0,
			e_pmdeLTP, e_pmdeSTP, e_pmdeHIP, e_pmdeFK5, e_pmdemu0,
			F_FH, F_0H, F_0GCH, F_0F, F_TH,
			noteflag, endpad</names>
		</reGrammar>

		<make table="part3">
			<rowmaker id="make_part3">
				<FEED source="commonRowmakerItems"/>

				<apply name="addTableNotes">
					<setup>
						<code>
							from gavo import rsc
							tabnoteTable = rsc.makeData(
								parent.parent.parent.rd.getById("make_tabnotes")
								).getPrimaryTable()
							copiedKeys = [
								"hipdup", "hipfitqual", "speckleflag", "viscomp",
								"binindsrv", "binindecl", "pulsating"]
						</code>
					</setup>
					<code>
						try:
							row = tabnoteTable.getRow(vars["localid"].strip())
						except KeyError:
							vars["noteno"] = ""
							for key in copiedKeys:
								result[key] = None
						else:
							vars["noteno"] = row["noteno"] or ""
							for key in copiedKeys:
								result[key] = row[key]
					</code>
				</apply>

				<!-- resolveNote depends on noteno value in vars left by
				addTableNotes, so it must run after it -->
				<apply procDef="resolveNote" name="resolveIndividualNote">
					<bind name="notesFileName">"data/fk63ip01.txt"</bind>
				</apply>

				<LOOP csvItems="\modes">
					<events>
						<map dest="pmra\mname">@pmra+float(
							killBlanks(@dpmra\mname))*DEG_MAS</map>
						<map dest="pmde\mname">@pmde+float(
							killBlanks(@dpmde\mname))*DEG_MAS</map>
						<map dest="e_pmra\mname">float(@e_pmra\mname
							)*DEG_MAS</map>
						<map dest="e_pmde\mname">float(@e_pmde\mname)*DEG_MAS</map>
					</events>
				</LOOP>

				<map dest="subsample">@subsample.strip()</map>
				<map dest="sect">3</map>
			</rowmaker>
		</make>
	</data>

	<table onDisk="true" id="fk6join" adql="True">
		<meta name="description">The union of all published parts of FK6,
			comprising only the common fields.</meta>
		<nrows>4151</nrows>
		<LOOP listItems="localid hipno comname raj2000 dej2000 pmra pmde
			epra e_raj2000 e_pmra epde e_dej2000 e_pmde pres e_pres src_par
			v_rad vmag varFlag K_bin K_Delta_mu K_ae sect note
			pmraSTP pmdeSTP e_pmraSTP e_pmdeSTP
			pmraLTP pmdeLTP e_pmraLTP e_pmdeLTP
			pmraHIP pmdeHIP e_pmraHIP e_pmdeHIP">
			<events>
			<column original="part1.\item"/>
			</events>
		</LOOP>
		<viewStatement>
			CREATE VIEW \curtable AS (
				(SELECT \colNames FROM fk6.part1)
				UNION
				(SELECT \colNames FROM fk6.part3))
		</viewStatement>
	</table>

	<coverage>
		<updater spaceTable="fk6join" mocOrder="4"/>
		<temporal>2000-01-01 2000-01-01</temporal>
		<spatial>2/13,25,31,63,128,133,137 3/0,3,5-7,9-11,13,16-17,19-20,27-28,35,44,47,49,60-61,63-65,73,75,78,81-82,85-87,90,94-96,104,107,113,117-119,121-122,128,131-133,136-137,140,142-143,149,152,154-157,166-169,171,173-174,177,182-183,186-187,189-191,196,202,204-205,207-209,211-212,215,217,221,223,226,236-237,239,243-245,248,250,256,258,260,264-265,270-272,274,276-278,282,284,286,290-291,293-295,298,300,304-306,308,320,322,325,328,332,335,339,341,346,353,357,361,363-364,366,368,376,380,386-387,393-394,401-403,406-407,412,417-419,421,423,427,430-433,436,450,452,456-457,463,467,477-478,483,490,492,499,507,511,516-517,520-521,523-524,527,529-531,537,539,552-553,555,558,560,562,568,570-573,576,578-580,582-585,587,589,591,595-596,600,602,608-610,612,617,619,623,627,634-636,638,640-641,643-645,649,652,654,657,659,664-666,669,673,681-682,686,691,697-699,701-702,704-706,708-710,713,715,718,722,724,726-728,732,739-740,743-745,748-749,751,753,755-758,765-766 4/6-7,9-11,17-19,32,35,48-49,51,58,60,62-63,72,75,84-86,88-89,92-93,97-100,103-105,107,117-122,124,126-127,129-133,135,137-139,144-145,147,149,151,154-158,160-161,163,165,167-168,170-171,174,180-182,185-187,192-194,201-206,224,226-227,229-231,233-234,236,238-239,249-251,264-266,269-272,275-277,279-280,282-286,289-291,296-298,304-305,307,309-311,317-319,321-323,333-334,337-339,354-357,359,364,367-368,370-373,375,389,391-393,395-397,420-421,423,425,427,432-433,435,437-442,444-446,448,450-451,457-459,461,463-465,467,480-482,493-495,517-521,523,536-537,539,541-543,553,555-557,565-567,577-579,582-583,586,589-590,592,594-595,600-602,604,606-607,612-614,632,634,636-637,639-642,644-645,647-648,651-652,654-655,657-658,661-663,680-681,683,689-691,701,703,705-707,712-713,715-718,720-721,723-724,726-727,737-740,742-743,753-755,768,771-772,774-776,778-782,788,790-793,795-798,801,803,805-806,813-814,824,826,840,842-843,852-853,855-856,858,865-867,872,874-877,879-881,883,889-891,896-898,900-901,903,908-909,911,913-915,917,919-920,922-923,925-928,930-933,935-938,940,942-943,952-954,961-963,965-966,968-970,984,986-987,989-991,997-999,1004-1005,1007,1028-1030,1037-1039,1044,1046-1047,1051-1052,1054-1055,1064,1066-1068,1070-1073,1075,1077-1079,1093-1095,1100-1101,1103,1117-1118,1121-1122,1124-1126,1132,1135,1140,1142-1143,1149-1150,1152,1154,1156,1158-1159,1169-1171,1184-1185,1187-1190,1196-1197,1199,1205-1209,1211-1212,1214-1215,1228-1230,1237-1240,1242-1246,1249-1253,1255,1257-1259,1261-1264,1266,1269,1271,1273-1276,1278-1279,1285-1287,1292,1294,1296-1297,1305-1307,1309-1311,1317,1321-1324,1327,1332,1335-1337,1339,1344-1346,1348,1350,1352-1353,1361-1363,1368-1369,1371-1373,1376-1378,1380,1382,1388,1390-1392,1394-1395,1397-1400,1403-1405,1407,1411,1418-1422,1425-1427,1432-1434,1437-1440,1442-1443,1449-1451,1460,1462-1463,1468-1469,1476-1478,1482-1485,1487-1488,1490,1494-1497,1499-1501,1503,1508-1509,1511-1513,1515-1516,1525-1528,1531-1534,1537-1540,1542-1543,1552-1554,1557-1558,1561,1563-1566,1569-1571,1580-1581,1584,1587,1591-1592,1594-1597,1599,1601,1603,1616-1617,1619,1621-1623,1632,1634-1635,1637-1640,1642-1645,1647,1652-1653,1655-1657,1659-1662,1664-1665,1667,1681,1683,1688-1690,1697-1700,1702-1703,1706,1712,1715-1717,1719,1736,1738-1741,1743,1748,1750-1754,1757-1760,1762-1764,1766-1767,1769-1773,1775,1777-1782,1785,1787,1789-1791,1794,1797-1798,1804-1805,1807,1812-1813,1816,1819-1822,1832,1834-1838,1840-1841,1844-1845,1848-1849,1851,1856-1858,1861-1862,1864-1865,1867,1872,1874-1878,1880-1881,1883,1885-1886,1888-1889,1891-1894,1896-1897,1899,1901-1902,1904-1906,1916-1918,1921-1923,1925-1927,1929-1930,1936-1938,1942-1943,1945-1946,1949-1952,1954-1955,1957-1959,1965-1967,1973-1976,1978-1981,1983,1985-1987,1991-1993,1995,2002,2005-2006,2008-2009,2011,2014-2016,2018-2022,2024,2027,2032,2034-2035,2038-2039,2041-2043,2072-2074,2076,2078-2079,2088-2089,2091,2100-2101,2103-2105,2113-2115,2144-2145,2147,2152-2154,2161-2163,2165-2167,2169-2171,2173-2174,2176,2178-2181,2185-2189,2191,2218-2219,2224-2226,2229,2236,2238-2239,2246-2247,2252-2253,2255-2256,2259-2261,2263-2264,2266-2269,2276,2278-2279,2297,2299-2301,2303,2308,2310-2311,2324,2326,2344-2346,2353,2360-2361,2363,2369-2370,2373-2374,2376,2378-2379,2388,2390-2391,2393,2395-2396,2398-2399,2405-2407,2413-2417,2419,2421-2423,2425-2426,2428-2430,2445-2446,2452-2454,2457-2460,2463-2464,2466-2467,2472,2475,2481-2482,2484-2485,2489,2491,2497,2499-2500,2503-2506,2512-2513,2515,2517-2519,2521-2523,2525-2529,2531-2534,2549-2551,2557-2559,2569-2571,2584,2586-2587,2589-2594,2602-2606,2612-2613,2620-2621,2623-2624,2626-2627,2633,2635,2640,2642,2644-2645,2647-2649,2651-2653,2655,2668-2670,2672,2674-2675,2680-2681,2683-2685,2687-2690,2696-2697,2699-2702,2705-2708,2710-2714,2717-2721,2732,2734,2738-2739,2743,2748-2750,2752,2754,2756,2758-2760,2770-2773,2775-2777,2779-2781,2784-2786,2800-2801,2803,2813-2815,2828,2830-2831,2844-2845,2847,2849-2851,2856-2857,2859,2864-2866,2868-2870,2876-2878,2880-2882,2884,2886-2887,2892-2893,2895,2900,2902-2903,2916,2918-2921,2923-2924,2926,2932,2935-2937,2939-2941,2943-2945,2947-2950,2952-2953,2955,2964,2966-2969,2971,2985-2986,2988-2990,3001-3003,3008-3010,3016,3018-3019,3037-3039,3041-3045,3047,3049-3050,3052,3055-3058,3069-3071</spatial>
	</coverage>

	<data id="make_join">
		<make table="fk6join"/>
		<recreateAfter>apfs/res/apfs_new#make_inputs</recreateAfter>
	</data>

	<data id="collection" auto="false">
		<publish/>
		<make table="part1"/>
		<make table="part3"/>
		<make table="fk6join"/>
	</data>

	<service id="cone" allowed="form,scs.xml">
		<meta>
			shortName: FK6 cone
			testQuery.ra: 111.03
			testQuery.dec: 40.67
			testQuery.sr: 0.02
		</meta>
		<publish render="form" sets="local,ivo_managed"/>
		<publish render="scs.xml" sets="ivo_managed"/>

		<dbCore queriedTable="fk6join">
			<condDesc buildFrom="localid"/>
			<FEED source="//scs#coreDescs"/>
			<condDesc buildFrom="K_ae"/>
		</dbCore>
	</service>

	<regSuite title="FK6">
		<regTest title="FK6 SCS works">
			<url RA="4.21" DEC="-49.63" SR="0.02" K_ae="2 4">cone/scs.xml</url>
			<code>
				rows = self.getVOTableRows()
				self.assertEqual(len(rows), 1)
				self.assertEqual(rows[0]["localid"], '4030')
			</code>
		</regTest>
	</regSuite>

	<regSuite title="DaCHS stats regression">
		<regTest title="Column stats annotated in the registry">
			<url>/getRR/fk6/q/cone</url>
			<code>
				def S(n): return f"{{http://dc.g-vo.org/ColStats-1}}{n}"

				self.assertXpath("//table[name='fk6.fk6join']/nrows",
					{None: "4151"})

				self.assertXpath(
					"//table[name='fk6.fk6join']/column[name='hipno']/stats/fillFactor", {
						None: "1.0"})
				self.assertXpath(
					"//table[name='fk6.fk6join']/column[name='hipno']/stats/max", {
						None: "118322"})
				self.assertXpath(
					"//table[name='fk6.fk6join']/column[name='hipno']/stats/percentile03", {
						None: "3367.25"})

				self.assertXpath(
					"//table[name='fk6.fk6join']/column[name='k_ae']/stats/fillFactor", {
						None: '0.38724375'})
				self.assertXpath(
					"//table[name='fk6.fk6join']/column[name='k_ae']/stats/percentile97", {
						None: "3.0"})

			</code>
		</regTest>
	</regSuite>
</resource>
