diff --git a/docs/gaia/gaia.rst b/docs/gaia/gaia.rst index ea7f7145cd..2405d12277 100644 --- a/docs/gaia/gaia.rst +++ b/docs/gaia/gaia.rst @@ -75,112 +75,78 @@ Examples This query searches for all the objects contained in an arbitrary rectangular projection of the sky. -It is possible to choose which data release to query, by default the Gaia DR2 catalogue is used. For example: +It is possible to choose which data release to query, by default the Gaia DR2 catalogue is used. For example:: -.. code-block:: python - - >>> Gaia.MAIN_GAIA_TABLE = "gaiadr2.gaia_source" # Select Data Release 2, default + >>> from astroquery.gaia import Gaia >>> Gaia.MAIN_GAIA_TABLE = "gaiaedr3.gaia_source" # Select early Data Release 3 + >>> Gaia.MAIN_GAIA_TABLE = "gaiadr2.gaia_source" # Reselect Data Release 2, default The following example searches for all the sources contained in an squared region of side = 0.1 degrees around an specific point in RA/Dec coordinates. -.. code-block:: python .. doctest-remote-data:: -.. doctest-skip:: >>> import astropy.units as u >>> from astropy.coordinates import SkyCoord - >>> from astroquery.gaia import Gaia # doctest: +IGNORE_OUTPUT >>> >>> coord = SkyCoord(ra=280, dec=-60, unit=(u.degree, u.degree), frame='icrs') >>> width = u.Quantity(0.1, u.deg) >>> height = u.Quantity(0.1, u.deg) >>> r = Gaia.query_object_async(coordinate=coord, width=width, height=height) INFO: Query finished. [astroquery.utils.tap.core] - >>> r.pprint() - dist solution_id ... epoch_photometry_url + >>> r.pprint(max_lines=12, max_width=130) + dist solution_id ... datalink_url ... - --------------------- ------------------- ... -------------------- - 0.0026034636994048854 1635721458409799680 ... - 0.0038518741347606357 1635721458409799680 ... - 0.00454542650096783 1635721458409799680 ... - 0.005613919443965546 1635721458409799680 ... - 0.005846434715822121 1635721458409799680 ... - 0.006209042666371929 1635721458409799680 ... - 0.007469463683838576 1635721458409799680 ... - 0.008202004514524316 1635721458409799680 ... - 0.008338509690874027 1635721458409799680 ... - 0.008406677772258921 1635721458409799680 ... - ... ... ... ... - 0.01943176697471851 1635721458409799680 ... - 0.019464719601172412 1635721458409799680 ... - 0.019467068628703368 1635721458409799680 ... - 0.019752561500226976 1635721458409799680 ... - 0.01991656886177004 1635721458409799680 ... - 0.020149589233310516 1635721458409799680 ... - 0.020307185970548904 1635721458409799680 ... - 0.020454730686780127 1635721458409799680 ... - 0.020802655215768254 1635721458409799680 ... - 0.021615117161838747 1635721458409799680 ... + --------------------- ------------------- ... ----------------------------------------------------------------------------------- + 0.0026034636994048854 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814214528 + 0.0038518741347606357 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090339113063296 + 0.00454542650096783 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814217600 + ... ... ... ... + 0.020307185970548904 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636089514478069888 + 0.020454730686780127 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636066940131244288 + 0.020802655215768254 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636067141990822272 + 0.021615117161838747 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090369173963776 Length = 50 rows + Queries return a limited number of rows controlled by ``Gaia.ROW_LIMIT``. To change the default behaviour set this appropriately. -.. code-block:: python .. doctest-remote-data:: -.. doctest-skip:: >>> Gaia.ROW_LIMIT = 8 >>> r = Gaia.query_object_async(coordinate=coord, width=width, height=height) INFO: Query finished. [astroquery.utils.tap.core] - >>> r.pprint() - dist solution_id ... epoch_photometry_url + >>> r.pprint(max_width=140) + dist solution_id ... datalink_url ... - --------------------- ------------------- ... -------------------- - 0.0026034636994048854 1635721458409799680 ... - 0.0038518741347606357 1635721458409799680 ... - 0.00454542650096783 1635721458409799680 ... - 0.005613919443965546 1635721458409799680 ... - 0.005846434715822121 1635721458409799680 ... - 0.006209042666371929 1635721458409799680 ... - 0.007469463683838576 1635721458409799680 ... - 0.008202004514524316 1635721458409799680 ... + --------------------- ------------------- ... ----------------------------------------------------------------------------------- + 0.0026034636994048854 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814214528 + 0.0038518741347606357 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090339113063296 + 0.00454542650096783 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814217600 + 0.005613919443965546 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636089583198816640 + 0.005846434715822121 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814218752 + 0.006209042666371929 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814213632 + 0.007469463683838576 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090339112308864 + 0.008202004514524316 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636089583198816512 To return an unlimited number of rows set ``Gaia.ROW_LIMIT`` to -1. -.. code-block:: python .. doctest-remote-data:: -.. doctest-skip:: >>> Gaia.ROW_LIMIT = -1 >>> r = Gaia.query_object_async(coordinate=coord, width=width, height=height) INFO: Query finished. [astroquery.utils.tap.core] - >>> r.pprint() - dist solution_id ... epoch_photometry_url + >>> r.pprint(max_lines=12, max_width=140) + dist solution_id ... datalink_url ... - --------------------- ------------------- ... -------------------- - 0.0026034636994048854 1635721458409799680 ... - 0.0038518741347606357 1635721458409799680 ... - 0.00454542650096783 1635721458409799680 ... - 0.005613919443965546 1635721458409799680 ... - 0.005846434715822121 1635721458409799680 ... - 0.006209042666371929 1635721458409799680 ... - 0.007469463683838576 1635721458409799680 ... - 0.008202004514524316 1635721458409799680 ... - 0.008338509690874027 1635721458409799680 ... - 0.008406677772258921 1635721458409799680 ... - ... ... ... ... - 0.049718018073992835 1635721458409799680 ... - 0.04977869666747251 1635721458409799680 ... - 0.05006096698512638 1635721458409799680 ... - 0.05038566478030134 1635721458409799680 ... - 0.050827895451955894 1635721458409799680 ... - 0.050860907684754444 1635721458409799680 ... - 0.051038347209386326 1635721458409799680 ... - 0.05121063325107872 1635721458409799680 ... - 0.051957226883925664 1635721458409799680 ... - 0.05320916763883812 1635721458409799680 ... + --------------------- ------------------- ... ----------------------------------------------------------------------------------- + 0.0026034636994048854 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814214528 + 0.0038518741347606357 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090339113063296 + 0.00454542650096783 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636090334814217600 + ... ... ... ... + 0.05121063325107872 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636065840618481024 + 0.051957226883925664 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6636093637644158592 + 0.05320916763883812 1635721458409799680 ... https://gea.esac.esa.int/data-server/datalink/links?ID=Gaia+DR2+6633086847005369088 Length = 176 rows @@ -190,15 +156,9 @@ To return an unlimited number of rows set ``Gaia.ROW_LIMIT`` to -1. This query performs a cone search centered at the specified RA/Dec coordinates with the provided radius argument. -.. code-block:: python .. doctest-remote-data:: -.. doctest-skip:: - >>> import astropy.units as u - >>> from astropy.coordinates import SkyCoord - >>> from astroquery.gaia import Gaia # doctest: +IGNORE_OUTPUT - >>> - >>> coord = SkyCoord(ra=280, dec=-60, unit=(u.degree, u.degree), frame='icrs') + >>> Gaia.ROW_LIMIT = 50 # Switching back to the default row limit. >>> radius = u.Quantity(1.0, u.deg) >>> j = Gaia.cone_search_async(coord, radius) INFO: Query finished. [astroquery.utils.tap.core] @@ -218,17 +178,18 @@ radius argument. 1635721458409799680 Gaia DR2 6636089583198817664 ... 0.008338509690874027 1635721458409799680 Gaia DR2 6636089578899968384 ... 0.008406677772258921 ... ... ... ... - 1635721458409799680 Gaia DR2 6636390501490205824 ... 0.9999643454969411 - 1635721458409799680 Gaia DR2 6632788093377355008 ... 0.9999659159212859 - 1635721458409799680 Gaia DR2 6634904786402451456 ... 0.9999669801021075 - 1635721458409799680 Gaia DR2 6632896116097991040 ... 0.9999706747249028 - 1635721458409799680 Gaia DR2 6631479811977059072 ... 0.9999871727941554 - 1635721458409799680 Gaia DR2 6636408544648238464 ... 0.9999885095326156 - 1635721458409799680 Gaia DR2 6633180133694763264 ... 0.9999911459079347 - 1635721458409799680 Gaia DR2 6632920344009005184 ... 0.9999925631357645 - 1635721458409799680 Gaia DR2 6636406929741393024 ... 0.9999942477166328 - 1635721458409799680 Gaia DR2 6636389951735167872 ... 0.9999964452249156 - Length = 113243 rows + + 1635721458409799680 Gaia DR2 6636089510180765312 ... 0.01943176697471851 + 1635721458409799680 Gaia DR2 6636066871411763712 ... 0.019464719601172412 + 1635721458409799680 Gaia DR2 6636089514475519232 ... 0.019467068628703368 + 1635721458409799680 Gaia DR2 6636090407832546944 ... 0.019752561500226976 + 1635721458409799680 Gaia DR2 6636066940132132352 ... 0.01991656886177004 + 1635721458409799680 Gaia DR2 6636066871411763968 ... 0.020149589233310516 + 1635721458409799680 Gaia DR2 6636089514478069888 ... 0.020307185970548904 + 1635721458409799680 Gaia DR2 6636066940131244288 ... 0.020454730686780127 + 1635721458409799680 Gaia DR2 6636067141990822272 ... 0.020802655215768254 + 1635721458409799680 Gaia DR2 6636090369173963776 ... 0.021615117161838747 + Length = 50 rows 1.3. Getting public tables metadata @@ -241,77 +202,61 @@ Table and columns metadata are specified by IVOA TAP_ recommendation To load only table names metadata (TAP+ capability): -.. code-block:: python .. doctest-remote-data:: - >>> from astroquery.gaia import Gaia # doctest: +IGNORE_OUTPUT >>> tables = Gaia.load_tables(only_names=True) INFO: Retrieving tables... [astroquery.utils.tap.core] INFO: Parsing tables... [astroquery.utils.tap.core] INFO: Done. [astroquery.utils.tap.core] >>> for table in (tables): - ... print(table.get_qualified_name()) # doctest: +IGNORE_OUTPUT + ... print(table.get_qualified_name()) external.external.apassdr9 external.external.gaiadr2_geometric_distance external.external.gaiaedr3_distance - external.external.galex_ais - ... ... ... - gaiadr2.gaiadr2.vari_short_timescale - gaiadr2.gaiadr2.vari_time_series_statistics - gaiadr2.gaiadr2.panstarrs1_original_valid - gaiadr2.gaiadr2.gaia_source + ... + tap_schema.tap_schema.keys + tap_schema.tap_schema.schemas + tap_schema.tap_schema.tables To load all tables metadata (TAP compatible): -.. code-block:: python .. doctest-remote-data:: - >>> from astroquery.gaia import Gaia >>> tables = Gaia.load_tables() INFO: Retrieving tables... [astroquery.utils.tap.core] INFO: Parsing tables... [astroquery.utils.tap.core] INFO: Done. [astroquery.utils.tap.core] - >>> for table in (tables): - ... print(table.get_qualified_name()) # doctest: +IGNORE_OUTPUT - external.external.apassdr9 - external.external.gaiadr2_geometric_distance - external.external.gaiaedr3_distance - external.external.galex_ais - ... ... ... - gaiadr2.gaiadr2.vari_short_timescale - gaiadr2.gaiadr2.vari_time_series_statistics - gaiadr2.gaiadr2.panstarrs1_original_valid - gaiadr2.gaiadr2.gaia_source + >>> print(tables[0]) + TAP Table name: external.external.apassdr9 + Description: The AAVSO Photometric All-Sky Survey - Data Release 9 + This publication makes use of data products from the AAVSO + Photometric All Sky Survey (APASS). Funded by the Robert Martin Ayers + Sciences Fund and the National Science Foundation. Original catalogue released by Henden et al. 2015 AAS Meeting #225, id.336.16. Data retrieved using the VizieR catalogue access tool, CDS, Strasbourg, France. The original description of the VizieR service was published in A&AS 143, 23. VizieR catalogue II/336. + Num. columns: 25 To load only a table (TAP+ capability): -.. code-block:: python .. doctest-remote-data:: - >>> from astroquery.gaia import Gaia - >>> table = Gaia.load_table('gaiadr2.gaia_source') + >>> gaiadr2_table = Gaia.load_table('gaiadr2.gaia_source') Retrieving table 'gaiadr2.gaia_source' - >>> print(f"table = {table}") - table = TAP Table name: gaiadr2.gaiadr2.gaia_source + >>> print(gaiadr2_table) + TAP Table name: gaiadr2.gaiadr2.gaia_source Description: This table has an entry for every Gaia observed source as listed in the Main Database accumulating catalogue version from which the catalogue release has been generated. It contains the basic source parameters, that is only final data (no epoch data) and no spectra (neither final nor epoch). - Num. columns: 96 + Num. columns: 95 Once a table is loaded, its columns can be inspected: -.. code-block:: python .. doctest-remote-data:: - >>> from astroquery.gaia import Gaia - >>> gaiadr2_table = Gaia.load_table('gaiadr2.gaia_source') - Retrieving table 'gaiadr2.gaia_source' - >>> for column in (gaiadr2_table.columns): - ... print(column.name) # doctest: +IGNORE_OUTPUT + >>> for column in gaiadr2_table.columns: + ... print(column.name) solution_id designation source_id @@ -342,42 +287,54 @@ The results can be saved in memory (default) or in a file. Query without saving results in a file: -.. code-block:: python .. doctest-remote-data:: - >>> from astroquery.gaia import Gaia # doctest: +IGNORE_OUTPUT - >>> >>> job = Gaia.launch_job("select top 100 " ... "solution_id,ref_epoch,ra_dec_corr,astrometric_n_obs_al, " ... "matched_observations,duplicated_source,phot_variable_flag " ... "from gaiadr2.gaia_source order by source_id") >>> r = job.get_results() - >>> print(r['solution_id']) # doctest: +IGNORE_OUTPUT - solution_id - ------------------- - 1635378410781933568 - 1635378410781933568 - 1635378410781933568 - 1635378410781933568 - ... + >>> print(r['ra_dec_corr']) + ra_dec_corr + ------------- + 0.022670548 + 0.06490505 + 0.11690165 + 0.042778816 + 0.095711425 + 0.56088775 + -0.0028029205 + 0.11152559 + 0.6039746 + 0.06599529 + ... + 0.1803336 + 0.089540906 + 0.23512067 + 0.066183 + -0.29090926 + 0.21693705 + 0.1531835 + 0.14783339 + 0.32718197 + -0.05562011 + 0.008669683 Length = 100 rows Query saving results in a file (you may use 'output_format' to specified the results data format, available formats are: 'votable', 'votable_plain', 'fits', 'csv' and 'json', default is 'votable'): -.. code-block:: python -.. doctest-remote-data:: +.. doctest-skip:: - >>> from astroquery.gaia import Gaia >>> job = Gaia.launch_job("select top 100 " ... "solution_id,ref_epoch,ra_dec_corr,astrometric_n_obs_al, " ... "matched_observations,duplicated_source,phot_variable_flag " ... "from gaiadr2.gaia_source order by source_id", ... dump_to_file=True, output_format='votable') - >>> print(job.outputFile) # doctest: +IGNORE_OUTPUT + >>> print(job.outputFile) 1592474300458O-result.vot.gz >>> r = job.get_results() - >>> print(r['solution_id']) # doctest: +IGNORE_OUTPUT + >>> print(r['solution_id']) solution_id ------------------- 1635721458409799680 @@ -390,24 +347,13 @@ available formats are: 'votable', 'votable_plain', 'fits', 'csv' and 'json', def Note: you can inspect the status of the job by typing: -.. code-block:: python -.. doctest-remote-data:: +.. doctest-skip:: - >>> print(job) # doctest: +IGNORE_OUTPUT -