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

<resource resdir="apfs" schema="apfs">
	<require>protocols.simbadinterface</require>

	<meta name="title">Intermediate and Apparent Places of Fundamental Stars
		</meta>
	<meta name="creationDate">2007-10-04T12:00:00Z</meta>
	<meta name="schema-rank">20</meta>
	<meta name="description" format="plain">
		The Apparent Places of Fundamental Stars (APFS) give exact
		geocentric positions for a selected set of FK6 stars.
	</meta>
	<meta name="_related" title="APFS pages">https://wwwadd.zah.uni-heidelberg.de/datenbanken/ariapfs/index.php.en</meta>
	<meta name="_related" title="Computation of GAST, GMST, and ERA">/apfs/times/q/form</meta>
	<meta name="_related" title="APFS on FK6">/apfs/res/apfs_new/catquery/form</meta>
	<meta name="_related" title="APFS on Hipparcos">/apfs/res/apfs_new/hipquery/form</meta>
	<meta name="_related" title="APFS on Gaia DR2">/apfs/res/apfs_new/gdr2query/form</meta>

	<meta name="subject">astrometry</meta>
	<meta name="subject">ephemerides</meta>
	<meta name="subject">astronomical-coordinate-systems</meta>

	<meta name="source">Apparent Places of Fundamental Stars,
		Karlsruhe: G. Braun, ISSN 0174-254 X</meta>
  <meta name="coverage.waveband">Optical</meta>

	<STREAM id="longdocTpl">
		<doc>A template for the documentation of the various services.
		This is customised with macros; so far, it's catspec for
		specifics on the underlying catalog.
		</doc>

	<meta name="_longdoc" format="rst"><![CDATA[
On Positions in APFS
--------------------

APFS stands for "Apparent Places of Fundamental Stars", a term
which we maintain due to its traditional use; introductorily, it might be
appropriate to address the following issues:

#. "apparent places" in the traditional sense are positions with right
   ascension referred  to the equinox ("first point of Aries").
   It was recommended by IAU 2000 Resolution B1.8 to use
   the "non-rotating origin" as new reference point for right ascensions
   on the celestial equator. The "non-rotating origin" – now called
   "Celestial Intermediate Origin (CIO)" – constitutes "intermediate
   places" instead of the former "apparent places". Declinations are
   not affected by this change of the zero point for right ascensions.
   For an undetermined transition period we shall provide equinox-based
   "apparent places" besides the CIO-based "intermediate places".
   However, the user should be aware that equinox-based right ascensions
   refer to a concept of the past, rather than to a forward-looking one.
   The notation "apparent places" will sometimes be used
   in text components to denote both kinds of ephemeris.
\catspec
#. From a star catalogues given in the
   "International Celestial Reference System (ICRS)",
   apparent places are obtained via the procedure
   explained e.g. in the `Explanatory Supplement of the Astronomical Almanac <http://www.hmnao.com/nao/publicat/asa.html>`_.
   That means in principle for stellar ephemeris:
   transformation from J2000.0 to the desired epoch and
   from barycentric ICRS ephemeris to geocentric coordinates by
   considering space motion and parallax of a star as well as
   light deflection and annual aberration; finally,  frame
   bias, precession and nutation have to be considered in order to obtain
   apparent places referred to the equator of date (and to the
   origin of date for right ascension).
#. The IAU 2000/2006 precession-nutation is used for intermediate
   and apparent positions. This precession-nutation model is recommended
   by IAU 2006 Resolution B1 and shall be valid from 1 January 2009 onwards.
   It  includes  a new precession component (P03 precession theory) which
   replaces the P00 precession of the IAU 2000A precession-nutation
   model. Right ascensions and declinations determined by using this new or
   the prior precession-nutation model are almost identical at milliarcsec
   level, and differences will hardly be noticed by APFS users.
   We use `JPL DE430`_ ephemeris where required.

.. _JPL DE430: ftp://ssd.jpl.nasa.gov/pub/eph/planets/README.txt


On times in APFS
----------------

The dates and times in this service are taken as and given in Terrestrial Time
(TT).

TT is related to Coordinated Universal Time (UTC) by:

    TT = UTC + Δ(AT) + 32.184 sec

where Δ(AT) is an integer term depending on irregularities
of the Earth's rotation. In 2006: Δ(AT) = 33 sec.
The current  value for Δ(AT) can be found
in `IERS Bulletin C <http://www.iers.org>`_.


That means that TT and UTC differ by  roughly one minute.
The computed apparent places are usually not affected by this
difference in time-scale, except the last given
digit of right ascensions for stars near the poles
(as an effect of the underlying spherical coordinate system).
In any case, if apparent places are used for conventional geodetic
applications there is no need to consider this intricateness, and
UTC may be set instead of TT. UTC is the civil time as
disseminated by radio or TV, corrected for your time zone.


References
----------

* `Hilton et al., Celest. Mech., 94, 351, (2006) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2006CeMDA..94..351H&db_key=AST&link_type=ABSTRACT&high=48046e348013996>`_
* `Hilton, Hohenkerk, A&A 413, 765 (2004) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2004A%26A...413..765H&db_key=AST&link_type=ABSTRACT&high=48046e348014080>`_
* `Capitaine and Wallace, A&A 450, 855 (2006) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2006A%26A...450..855C&db_key=AST&link_type=ABSTRACT&high=48046e348014121>`_
* `Capitaine, Wallace, Chapront, A&A 412, 567 (2003) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2003A%26A...412..567C&db_key=AST&link_type=ABSTRACT&high=48046e348014121>`_
* `Capitaine, Wallace, McCarthy, A&A 406, 1135 (2003) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2003A%26A...406.1135C&db_key=AST&link_type=ABSTRACT&high=48046e348014145>`_
* `Capitaine, et al., Latest proposal of the IAU WG on Nomenclature for Fundamental Astronomy (NFA) <http://syrte.obspm.fr/iau/iauWGnfa>`_
* `Seidelmann, Kovalevsky, A&A 392, 341 (2002) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2002A%26A...392..341S&db_key=AST&link_type=ABSTRACT&high=48046e348014161>`_
* `Capitaine, Guinot, McCarthy, A&A 355, 398 (2000) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2000A%26A...355..398C&db_key=AST&link_type=ABSTRACT&high=48046e348014176>`_
* `Feissel, Mignard, A&A, 331, L33 (1998) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=1998A%26A...331L..33F&db_key=AST&link_type=ABSTRACT&high=48046e348014208>`_
* `Gaia Collaboration, Gaia Data Release 2. Summary of the contents and survey properties, A&A 161, A1 (2016) <http://ads.ari.uni-heidelberg.de/abs/2018A%26A...616A...1G>`_
* `Lindegren, L., et al, Gaia Data Release 2. The astrometric solution, A&A 616 A2 (2018) <http://ads.ari.uni-heidelberg.de/abs/2018A%26A...616A...2L>`_
* `Soubiran, C., et al, Gaia Data Release 2. The catalogue of radial velocity standard stars, A&A 616, , A7 (2018) <http://ads.ari.uni-heidelberg.de/abs/2018A%26A...616A...7S>`_
* `Wielen et al., Veroeff. Astron. Rechen-Institut., Heidelberg, No. 35, FK6 Part I, (1999) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=1999VeARI..35.....W&db_key=AST&link_type=ABSTRACT&high=48046e348025744>`_
* `Wielen et al., Veroeff. Astron. Rechen-Institut. Heidelberg, No. 37, FK6 Part III, (2000) <http://ads.ari.uni-heidelberg.de/cgi-bin/nph-data_query?bibcode=2000VeARI..37....1W&db_key=AST&link_type=ABSTRACT&high=48046e348025744>`_
* `Wielen et al., A&A  360, 399 (2000) <http://ads.ari.uni-heidelberg.de/abs/2000A%26A...360..399W>`_

Software Routines from the IAU SOFA Collection were used. Copyright ©
International Astronomical Union Standards of Fundamental Astronomy
(http://www.iausofa.org)

Parts of this work make use of data from the European Space Agency (ESA)
mission Gaia (http://www.cosmos.esa.int/gaia), processed by the Gaia Data
Processing and Analysis Consortium (DPAC,
http://www.cosmos.esa.int/web/gaia/dpac/consortium). Funding for the DPAC has
been provided by national institutions, in particular the institutions
participating in the Gaia Multilateral Agreement.
	]]></meta>
	</STREAM>


	<STREAM id="titleRF">
		<doc>A custom render function to insert a title adapted to what
			was actually queried: Apparent ("equatorial"), Intermediate
			("cio") Places or both.

			You must give the catalog name in the catname
			attribute.
		</doc>

		<customRF name="apfsTitle">
			# wants n:data="result"
			if self.queryMeta.get("columnSet")==set(["equ"]):
				denom = "Apparent Places"
			elif self.queryMeta.get("columnSet")==set(["equ", "cio"]):
				denom = "Apparent and Intermediate Places"
			else:
				denom = "Intermediate Places"

			if self.queryMeta["inputTable"]:
				star = str(self.queryMeta["inputTable"].getMeta("forStar"))
			else:
				star = "(unset)"
			return ctx.tag[denom+" for star \catname "+star]
		</customRF>
	</STREAM>

  <!-- CSV def of the orbit elements we have -->
	<macDef name="orbitdef">
		name, unit, description
		period, yr,    "orbit period, 0 (not NULL) for no orbit"
		ecc,    ,      orbit eccentricity
		tperi,  yr,    epoch of periastron
		a_major, deg,  orbit (full) major axis
		incl,   ,      orbit inclination
		nodelength, ,  length of ascending node of the orbit
		peraparg, ,    argument of periastron
	</macDef>

	<table id="apfsOutput">
		<column name="isodate" type="date" tablehead="Date"
			id="out_isodate" ucd="time.epoch" verbLevel="1"
			description="Date of epoch (TT)"
			displayHint="type=humanDay"/>
		<column name="arg_hour" type="integer" required="True"
			tablehead="Hour (TT)"
			id="out_hour" ucd="time" unit="h" verbLevel="1"
			description="Hour of epoch (TT)"/>
		<column name="raCio" type="double precision"
			tablehead="α (CIO)" displayHint="type=hms,sf=4"
			id="out_raCio" ucd="pos.eq.ra" unit="deg" verbLevel="1"
			description="Right ascension of object at epoch in the CIO system"/>
		<column name="raEqu" type="double precision"
			tablehead="α (Equinox)" displayHint="type=hms,sf=4"
			id="out_raEqu" ucd="pos.eq.ra" unit="deg" verbLevel="20"
			description="Right ascension of object at epoch in the
				old equinox system"/>
		<column name="dec" type="double precision"
			tablehead="δ" displayHint="type=dms,sf=3"
			id="out_dec" ucd="pos.eq.dec" unit="deg" verbLevel="1"
			description="Declination of object at epoch"/>
	</table>

	<data id="apfswrap" auto="False">
		<!-- used by the cores to parse apfswrap output; hence, this
		is our output table-->
		<reGrammar>
			<names>isodate,arg_hour,raCio,raEqu,dec</names>
		</reGrammar>

		<make table="apfsOutput">
			<rowmaker idmaps="*"/>
		</make>
	</data>

	<data id="buildresult" auto="False">
		<!-- used by the cores to "parse" the result of the functions in
		apfs.py -->
		<dictlistGrammar/>

		<make table="apfsOutput">
			<rowmaker idmaps="*"/>
		</make>
	</data>

<!--============ table definitions for APFS inputs (incl. fk6apfs) ======-->

	<STREAM id="apfsinput"
		doc="column descriptions for the input of the APFS computation.
		This is some columns of FK6 plus optionally data on an orbit.">
		<column name="comname" type="text" description="Common name"/>
		<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"/>
		<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"/>
		<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"/>
		<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(δ) applied."
			verbLevel="5"/>
		<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"/>
		<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"/>
		<column name="v_rad"
			ucd="spect.dopplerVeloc;pos.heliocentric" unit="km/s"
			tablehead="v_rad"
			description="Radial velocity"
			verbLevel="15"/>
		<LOOP csvItems="\orbitdef">
			<events>
				<column name="\name" unit="\unit" description="\description"/>
			</events>
		</LOOP>
	</STREAM>

	<table id="fk6orbits" onDisk="True" mixin="//scs#q3cindex">
		<mixin>//scs#pgs-pos-index</mixin>
		<meta name="description">Stars with orbits (what should have been
			FK6, part 2)</meta>
		<FEED source="apfsinput"/>
	</table>

	<table id="fk6apfs" onDisk="True">
		<FEED source="apfsinput"/>
		<viewStatement>
			CREATE VIEW \curtable AS ((
					SELECT \colNames
						FROM apfs.fk6orbits)
				UNION (
					SELECT comname, localid, raj2000, dej2000, pmra, pmde, pres, v_rad,
							0 as period, NULL as cc, NULL as a_major, NULL as tperi,
							NULL as incl, NULL as nodelength, NULL as peraparg
						FROM fk6.fk6join))
		</viewStatement>
	</table>

	<data id="make_orbits">
		<sources>data/withorbits.txt</sources>
		<reGrammar topIgnoredLines="7" names="\colNames{fk6orbits}"/>
		<make table="fk6orbits">
			<rowmaker idmaps="*" id="rmk_orbits">
				<LOOP listItems="pmra pmde a_major pres">
					<events>
						<map dest="\item">float(@\item)*DEG_MAS</map>
					</events>
				</LOOP>
			</rowmaker>
		</make>
	</data>

	<data id="make_inputs">
		<make table="fk6apfs"/>
	</data>

	<STREAM id="outSystemSelector">
		<inputKey name="_SET" type="text" tablehead="Output in">
			<values>
				<option title="CIO system">cio</option>
				<option title="(old) equinox system">equ</option>
			</values>cio</inputKey>
	</STREAM>

<!--============ Fk6-based APFS computation ==========================-->

	<customCore id="apfsComputer" module="res/fk6core"/>

<!-- SOAP disabled while Debian t.w doesn't have t.w.soap
	<service id="qall" allowed="soap" core="apfsComputer">
		<meta name="title">SOAP ephemeris for fundamental stars</meta>
		<meta name="shortName">apfs_qall</meta>
		<meta name="description">An interface to the the APFS ephemerides
			giving you ephemerides for a given FK6 star or the closest one
			to a position you define.</meta>
		<publish render="soap" sets="ivo_managed"/>
	</service>
-->

	<service id="catquery" core="apfsComputer">
		<meta name="shortName">apfs_catquery</meta>
		<meta name="_intro" format="rst">This service computes apparent places of
			certain
			fundamental stars (from the FK6 catalogue).  The positions can
			be given either in the CIO system (default) or the old equinox
			system.

			If you give a position or an object resolvable by Simbad, the
			service will choose the nearest FK6 star for the ephemeris.
		</meta>

		<meta name="_news" author="MD" date="2011-07-12">
			We added star 907 (Polaris); for this, we use the orbit given by
			2000A&amp;A...360..399W.
		</meta>
		<meta name="_news" author="MD" date="2023-08-02">
			The epoch propagation to bring catalogues on the FK6 system
			are now performed by pgsphere rather than a custom extension as before.
			In some cases, in particular Gaia objects with radial velocities,
			this may lead to different results at the microarcsec level.
		</meta>

		<meta name="_news" author="MD" date="2025-04-15">
			We replaced the Fortran code that computed the apparent and
			intermediate places with Python equivalents.  We are confident
			that the results are identical to the microarcsecond level.
			For Hipparcos and Gaia APFS, this in particular means that
			intermediate reductions to epoch J2000 no longer happen, which
			should reduce the impact of rounding errors.
		</meta>

		<meta name="isSupplementedBy"
			ivoId="ivo://org.gavo.dc/apfs/times/q">
			Computation of GAST, GMST, and ERA
		</meta>
		<meta name="isSupplementedBy"
			ivoId="ivo://org.gavo.dc/apfs/res/apfs_new/gdr2query">
			APFS on Gaia DR2</meta>
		<meta name="isSupplementedBy"
			ivoId="ivo://org.gavo.dc/apfs/res/apfs_new/hipquery">
			APFS on Hipparcos</meta>
		
		<publish render="form" sets="ivo_managed,local"/>
		<meta name="title">APFS Ephemeris for FK6 Stars</meta>
		<template key="response">res/response.template</template>
		
		<FEED source="outSystemSelector"/>
		<FEED source="titleRF" catname="FK6"/>
		<FEED source="longdocTpl"
			catspec="#. There may be doubts in which respect the stars of
   `Sixth Catalogue of Fundamental Stars &lt;http://www.ari.uni-heidelberg.de/datenbanken/fk6/index.php.en&gt;`_ (FK6) can still claim to be
   &quot;fundamental&quot;. But there are good reasons to rely further on
   this well-defined subset of the former FK5 fundamental stars.
   We assume that these stars of the FK6 Part I (and Part III)
   are particularly suited as data base for computing
   apparent places because their parameters result from a careful
   combination of the Hipparcos astrometry satellite with long-term
   ground-based data as summarized in the FK5.  Moreover, these selected
   stars behave apparently as single stars.  Apparent places are also available
   for Polaris (FK6-No. 907) although it is not a single star; orbital
   corrections for the photo-center of Polaris are determined using the
   retrograde orbit from Wielen et al. (2000).
   Further details can be found in the cited references."/>

		<customRF name="multiplicityWarning">
			return ""
		</customRF>

		<customRF name="icrsPos">
			try:
				pd = self.queryMeta["inputTable"].getParamDict()
				return ctx.tag["ICRS position is α=%.7f, δ=%.7f"%(
					float(pd["alpha"]), float(pd["delta"]))]
			except:
				return ""
		</customRF>

		<outputTable namePath="apfsOutput">
			<column original="isodate" sets="cio,equ"/>
			<column original="arg_hour" sets="cio,equ"/>
			<column original="raCio" sets="cio"/>
			<column original="raEqu" sets="equ"/>
			<column original="dec" sets="cio,equ"/>
		</outputTable>
	</service>

<!--============ Hipparcos-based APFS computation ==============-->
	
	<service original="catquery" id="hipquery">
		<customCore module="res/hipcore"/>

		<meta name="description">This service is an extension of the
		Apparent Places of Fundamental Stars (APFS) computing exact
		geocentric positions in both the CIO and equinox systems to
		stars from the Hipparcos catalogue.</meta>
		<meta name="shortName">apfs_hipquery</meta>
		<meta name="_intro" format="rst">This service computes apparent and/or
			intermediate places of the stars in the Hipparcos main catalogue.
			Please note the warning on apparent places for multiple stars in
			the service info.

			The positions can
			be given either in the CIO system (default) or the old equinox
			system.

			If you give a position or an object resolvable by Simbad, the
			service will choose the nearest Hipparcos star for the ephemeris.
		</meta>

		<meta name="isSupplementTo"
			ivoId="ivo://org.gavo.dc/apfs/res/apfs_new/catquery">
			Apparent Places for Fundamental Stars
		</meta>
		<meta name="isSupplementedBy"
			ivoId="ivo://org.gavo.dc/apfs/times/q">
			Computation of GAST, GMST, and ERA
		</meta>

		<FEED source="longdocTpl"
			catspec="#. The user should be aware, however, that many Hipparcos stars are double
   stars; their proper motion as observed by the Hipparcos satellite may not
   reflect the long-term space motion of the star, which will severely
   degrade the accuracy of apparent places.  The
   \RSTservicelink{/dmubin/q/cone/form}{Catalogue of Delta-mu-binaries}
   contains such stars (e.g. Polaris = Hipparcos No. 11767), but this
   list certainly is not exhaustive.
   &#10;#. Hipparcos star parameters enter the computational
   procedure as they are published in the  Hipparcos Catalogue
   (European Space Agency 1997).  Consequently, radial velocities
   are not considered.
   &#10;#. To link APFS-HIP with the main APFS, we provide `a cross-reference
   between FK6 and Hipparcos numbers
   &lt;http://www.ari.uni-heidelberg.de/datenbanken/ariapfs/namenliste.html&gt;`_ .
   &#10;#. From the Hipparcos catalogue data apparent places are obtained via the
   procedure explained in the `Astronomical Almanac &lt;http://www.hmnao.com/nao/publicat/asa.html&gt;`_ . As a first step,
   stellar coordinates given in the Hipparcos Catalogue are transformed
   from catalogue epoch J1991.25 to J2000.0. Then follows a transformation
   from J2000.0 to the desired epoch and from barycentric ICRS
   coordinates to geocentric coordinates by
   considering space motion and parallax of a star as well as
   light deflection and annual aberration; finally,  frame
   bias, precession and nutation have to be considered in order to obtain
   apparent places referred to the equator of date (and to the
   origin of date for right ascension)."/>


		<publish render="form" sets="ivo_managed,local"/>
		<meta name="title">APFS Ephemeris for Hipparcos Stars</meta>

		<FEED source="titleRF" catname="HIP"/>

		<customRF name="multiplicityWarning">
			# wants n:data="result"
			if not self.queryMeta["inputTable"]:
				# we're delivering an error
				return ""

			if self.queryMeta["inputTable"].getMeta("multiple"):
				return ctx.tag["Warning:  This star"
					" is identified by Hipparcos as being a ",
					T.strong["multiple star."],
					" This means that proper motions given in the Hipparcos"
					" catalogue are unreliable when applied to extended periods"
					" of time.  Thus, the places given below will be severely"
					" wrong unless the orbital period of the object is sufficiently"
					" long (i.e., hundreds of years)."]
			return ""
		</customRF>
		<outputTable namePath="apfsOutput">
			<column original="isodate" sets="cio,equ"/>
			<column original="arg_hour" sets="cio,equ"/>
			<column original="raCio" sets="cio"/>
			<column original="raEqu" sets="equ"/>
			<column original="dec" sets="cio,equ"/>
		</outputTable>

	</service>



<!--============ Gaia DR2-based APFS computation ==============-->

	<service original="catquery" id="gdr2query">
		<customCore module="res/gdr2core"/>

		<meta name="description">This service is an extension of the
		Apparent Places of Fundamental Stars (APFS) computing exact
		geocentric positions in both the CIO and equinox systems to
		stars from the Gaia DR2 result catalogue.</meta>
		<meta name="isSupplementTo"
			ivoId="ivo://org.gavo.dc/apfs/res/apfs_new/catquery">
			Apparent Places for Fundamental Stars
		</meta>
		<meta name="isSupplementedBy"
			ivoId="ivo://org.gavo.dc/apfs/times/q">
			Computation of GAST, GMST, and ERA
		</meta>
		<meta name="copyright" format="rst"><![CDATA[
			This work has made use of data from the European Space Agency (ESA)
			mission `Gaia <https://www.cosmos.esa.int/gaia>`_, processed by the
			Gaia `Data Processing and Analysis Consortium (DPAC)
			<https://www.cosmos.esa.int/web/gaia/dpac/consortium>`_. Funding for the
			DPAC has been provided by national institutions, in particular the
			institutions participating in the Gaia Multilateral Agreement.
		]]></meta>

		<publish render="form" sets="ivo_managed,local"/>

		<meta name="shortName">apfs_gaiaquery</meta>
		<meta name="title">APFS Ephemeris for Gaia DR2 Stars</meta>
		<meta name="_intro" format="rst">This service computes apparent and/or
			intermediate places of the stars in the Gaia DR2 catalogue.

			The positions can
			be given either in the CIO system (default) or the old equinox
			system.

			Pass a position or an object resolvable by Simbad as well as a magnitude
			range into the service.  The service will then choose the
			nearest Gaia star with sufficient astrometry matching your criteria
			(only stars within 0.25 degrees are considered).
		</meta>
		<publish render="form" sets="ivo_managed,local"/>

		<FEED source="titleRF" catname="Gaia DR2"/>
		<FEED source="longdocTpl"
			catspec="#. Gaia Data Release 2 (Gaia DR2) was released on 25 April
				2018. A five-parameter astrometric solution – positions on the sky,
				parallaxes, and proper motions – for more than 1.8 billion sources,
				with a limiting magnitude of G = 21 and a bright limit of G ≈ 3,
				has been provided by Gaia DR2. Median radial velocities (i.e. the
				median value over the epochs) for a minor part (7.2 million stars)
				are also available. `Details can be found
				&lt;https://www.cosmos.esa.int/web/gaia/dr2>`_ on ESA's website and
				corresponding references (see below).

				From the published uncertainties it follows that apparent places
				derived from Gaia DR2 may be assumed to have uncertainties of one
				milliarcsecond or less for the present epoch (FK6 ~ 10-20
				milliarcseconds, Hipparcos ~ twice FK6).  On the other hand, we cannot
				verify all these sources.  It remains the responsibility of the user to
				verify that a selected source is identical with a specified star, and
				conforms to a specified accuracy."/>
	</service>


<!--============ Gaia DR3-based APFS computation ==============-->

	<service original="catquery" id="gdr3query">
		<customCore module="res/gdr3core"/>

		<meta name="description">This service is an extension of the
		Apparent Places of Fundamental Stars (APFS) computing exact
		geocentric positions in both the CIO and equinox systems to
		stars from the Gaia DR3 result catalogue.</meta>
		<meta name="isSupplementTo"
			ivoId="ivo://org.gavo.dc/apfs/res/apfs_new/catquery">
			Apparent Places for Fundamental Stars
		</meta>
		<meta name="isSupplementedBy"
			ivoId="ivo://org.gavo.dc/apfs/times/q">
			Computation of GAST, GMST, and ERA
		</meta>
		<meta name="copyright" format="rst"><![CDATA[
			This work has made use of data from the European Space Agency (ESA)
			mission `Gaia <https://www.cosmos.esa.int/gaia>`_, processed by the
			Gaia `Data Processing and Analysis Consortium (DPAC)
			<https://www.cosmos.esa.int/web/gaia/dpac/consortium>`_. Funding for the
			DPAC has been provided by national institutions, in particular the
			institutions participating in the Gaia Multilateral Agreement.
		]]></meta>

		<publish render="form" sets="ivo_managed,local"/>

		<meta name="shortName">apfs_gaiaquery</meta>
		<meta name="title">APFS Ephemeris for Gaia DR3 Stars</meta>
		<meta name="_intro" format="rst">This service computes apparent and/or
			intermediate places of the stars in the Gaia DR3 catalogue.

			The positions can
			be given either in the CIO system (default) or the old equinox
			system.

			Pass a position or an object resolvable by Simbad as well as a magnitude
			range into the service.  The service will then choose the
			nearest Gaia star with sufficient astrometry matching your criteria
			(only stars within 0.25 degrees are considered).
		</meta>
		<publish render="form" sets="ivo_managed,local"/>

		<FEED source="titleRF" catname="Gaia DR3"/>
		<FEED source="longdocTpl"
			catspec="#. Gaia Data Release 3 (Gaia DR3) was released in June
				2022, reflecting data of the first 34 months of the Gaia mission.
				A five-parameter astrometric solution – positions on the sky,
				parallaxes, and proper motions – is provided for more than 1.3 billion
				sources, with a limiting magnitude of G = 21 and a bright limit of G ≈
				3.  34 million sources even have six-parameter solutions including
				radial velocities. `Details can be found
				&lt;https://www.cosmos.esa.int/web/gaia/data-release-3>`_
				on ESA's website and corresponding references (see below).

				From the published uncertainties it follows that apparent places
				derived from Gaia DR3 may be assumed to have uncertainties of one
				milliarcsecond or less for the present epoch (FK6 ~ 10-20
				milliarcseconds, Hipparcos ~ twice FK6).  On the other hand, we cannot
				verify all these sources.  It remains the responsibility of the user to
				verify that a selected source is identical with a specified star, and
				conforms to a specified accuracy."/>
	</service>



	<regSuite>
		<regTest title="APFS form served" url="catquery/form">
			<code>
				self.assertHasStrings("Output format")
			</code>
		</regTest>

		<regTest title="APFS formal argument validation works">
			<url parSet="form"
				object="56" hrInterval="24" _FILTER="default" _VERB="2"
					RESPONSEFORMAT="votabletd"
				>catquery/form</url>
			<code>
				self.assertHasStrings("Required&lt;/li>")
			</code>
		</regTest>

		<regTest title="NV APFS custom argument validation works">
			<url parSet="form" object="fdsfa" startDate__day="12"
				startDate__month="12" startDate__year="2006" endDate__day="20"
				endDate__month="12" endDate__year="2006" hrInterval="24"
				_FILTER="default">catquery/form</url>
			<code>
				self.assertHasStrings("known by simbad")
			</code>
		</regTest>

		<regTest title="APFS computation yields expected results">
			<url parSet="form"
				object="56" startDate__day="12" startDate__month="12"
				startDate__year="2006" endDate__day="20" endDate__month="12"
				endDate__year="2006" hrInterval="24" _FILTER="default"
				_SET="equ"
				>catquery/form</url>
			<code><![CDATA[
				self.assertHasStrings("<h1>Apparent Places for star FK6 56")
				self.assertHasStrings("+5 31 28.714")
			]]></code>
		</regTest>

		<regTest title="APFS HIP multiple star warning is issued.">
			<url parSet="form"
				object="Algol" startDate__day="10" startDate__month="10"
				startDate__year="2009" endDate__day="12" endDate__month="10"
				endDate__year="2009" hrInterval="24"
				>hipquery/form?_SET=cio&amp;_SET=equ</url>
			<code><![CDATA[
				self.assertHasStrings(
					"<h1>Apparent and Intermediate Places for star HIP 14576")
				self.assertHasStrings("multiple star", "03 08 20.0148")
			]]></code>
		</regTest>

		<regTest title="APFS Polaris orbit computation looks ok">
			<url parSet="form"
				object="907" startDate__day="2" startDate__month="11"
				startDate__year="2012" endDate__day="5" endDate__month="11"
				endDate__year="2012" hrInterval="24" _SET="cio"
				>catquery/form</url>
			<code><![CDATA[
				self.assertHasStrings("<h1>Intermediate Places for star FK6 907")
				self.assertHasStrings("(Polaris)", "02 49 11.8798", "+89 19 10.165")
			]]></code>
		</regTest>

<!-- SOAP disabled, see above
		<regTest id="soaptest" title="APFS SOAP returns something reasonable">
			<url postPayload="res/soapRequest.regtest" httpMethod="POST">
				<httpHeader key="SOAPAction">'"useService"'</httpHeader>
				<httpHeader key="content-type">text/xml</httpHeader
				>qall/soap/go</url>
			<code>
				self.assertHasStrings(
					'="xsd:date">2008-02-03Z&lt;/tns:isodate>',
				'&lt;tns:raCio xsi:type="xsd:double">25.35')
			</code>
		</regTest>
-->
	</regSuite>

	<regSuite title="APFS DaCHS regression">
		<regTest title="Disallowed renderer yields 403."
			url="catquery/admin">
			<code>
				self.assertHTTPStatus(403)
			</code>
		</regTest>

		<regTest title="VOSI tableMetadata response validates for computed core."
			url="catquery/tableMetadata">
			<code>
				self.assertValidatesXSD()
			</code>
		</regTest>

		<regTest title="Service info looks credible and includes some meta
			information" url="catquery/info">
			<code><![CDATA[
				self.assertHasStrings("Service Documentation",
					"form</em> --",
					'class="useservice"',
					"give exact geocentric",
					"Δ(AT)",
					"End date of generated ephemeris",
					"Hour of epoch (TT)",
					"isodate",
					"endDate")
			]]></code>
		</regTest>
	</regSuite>

	<regSuite title="APFS DR2">
		<regTest title="APFS DR2 has plausible values">
			<url parSet="form" minmag="8.6" startDate__month="11" maxmag="8.7"
				object="314.40, 7.689" startDate__year="2016" _SET="cio"
				hrInterval="12" startDate__day="10" endDate__year="2016"
				endDate__day="11" endDate__month="11"
				>gdr2query/form</url>
			<code><![CDATA[
				self.assertHasStrings("<h1>Intermediate Places for star"
					" Gaia DR2 1737540534405856896",
					"2016-11-10", "12", "20 57 34.8099", "+7 45 31.205")
			]]></code>
		</regTest>
	</regSuite>

	<regSuite title="APFS DR3">
		<regTest title="APFS DR3 has plausible values">
			<url parSet="form" minmag="9" startDate__month="12" maxmag="10"
				object="303.2548,41.0283" startDate__year="2021" _SET="cio"
				hrInterval="12" startDate__day="10" endDate__year="2021"
				endDate__day="12" endDate__month="12"
				>gdr3query/form</url>
			<code><![CDATA[
				self.assertHasStrings("<h1>Intermediate Places for star"
					" Gaia DR3 2062599636658625024",
					"2021-12-10", "20 12 38.6742", "+41 05 47.717")
			]]></code>
		</regTest>
	</regSuite>
</resource>
