diff --git a/astroquery/esa/hubble/core.py b/astroquery/esa/hubble/core.py index 98748c15f6..3eda55970f 100644 --- a/astroquery/esa/hubble/core.py +++ b/astroquery/esa/hubble/core.py @@ -367,7 +367,7 @@ def cone_search(self, coordinates, radius, filename=None, "pl.main_science_plane='true' and 1=CONTAINS(POINT('ICRS', " f"pos.ra, pos.dec),CIRCLE('ICRS', {str(ra)}, {str(dec)}, {str(radius_in_grades)})) order " "by prop.proposal_id desc") - print("type: " + str(type(query))) + if verbose: log.info(query) table = self.query_hst_tap(query=query, async_job=async_job, diff --git a/docs/esa/hsa/hsa.rst b/docs/esa/hsa/hsa.rst index 4f9ec9661c..f43ef36688 100644 --- a/docs/esa/hsa/hsa.rst +++ b/docs/esa/hsa/hsa.rst @@ -20,15 +20,17 @@ Examples 1. Getting Herschel data ------------------------ -.. doctest-remote-data:: +.. Skipping becuase of how long the download takes +.. doctest-skip:: >>> from astroquery.esa.hsa import HSA >>> - >>> HSA.download_data(observation_id='1342195355',retrieval_type='OBSERVATION', instrument_name='PACS') # doctest: +IGNORE_OUTPUT + >>> HSA.download_data(observation_id='1342195355', retrieval_type='OBSERVATION', + ... instrument_name='PACS') Downloading URL http://archives.esac.esa.int/hsa/whsa-tap-server/data?&retrieval_type=OBSERVATION&observation_id=1342195355&instrument_name=PACS to 1342195355.tar ... [Done] '1342195355.tar' -This will download the product of the observation '1342195355' with the instrument 'PACS' and +This will download the products of the observation '1342195355' with the instrument 'PACS' and it will store them in a tar called '1342195355.tar'. The parameters available are detailed in the API. For more details of the parameters check the section 6 of the ``Direct Product Access using TAP`` in the @@ -41,11 +43,12 @@ For more details about the products check: 2. Getting Observation Products ------------------------------- -.. doctest-remote-data:: +.. Skipping becuase of how long the download takes +.. doctest-skip:: >>> from astroquery.esa.hsa import HSA >>> - >>> HSA.get_observation('1342195355', instrument_name='PACS') # doctest: +IGNORE_OUTPUT + >>> HSA.get_observation('1342195355', instrument_name='PACS') Downloading URL http://archives.esac.esa.int/hsa/whsa-tap-server/data?&retrieval_type=OBSERVATION&observation_id=1342195355&instrument_name=PACS to 1342195355.tar ... [Done] '1342195355.tar' @@ -245,4 +248,4 @@ Reference/API .. testcleanup:: >>> from astroquery.utils import cleanup_saved_downloads - >>> cleanup_saved_downloads(['1342195355*', 'results.csv']) \ No newline at end of file + >>> cleanup_saved_downloads(['1342195355*', 'results.csv']) diff --git a/docs/esa/hubble/hubble.rst b/docs/esa/hubble/hubble.rst index c29ba32816..7cccef569b 100644 --- a/docs/esa/hubble/hubble.rst +++ b/docs/esa/hubble/hubble.rst @@ -1,5 +1,3 @@ -.. doctest-skip-all - .. _astroquery.esa.hubble: ***************************************** @@ -36,39 +34,42 @@ SCIENCE_PRODUCT or POSTCARD). This will download all files for the raw calibration level of the observation 'J6FL25S4Q' and it will store them in a tar called 'raw_data_for_J6FL25S4Q.tar'. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> esahubble.download_product(observation_id="J6FL25S4Q", calibration_level="RAW", filename="raw_data_for_J6FL25S4Q.tar") + >>> esahubble.download_product(observation_id="J6FL25S4Q", calibration_level="RAW", + ... filename="raw_data_for_J6FL25S4Q.tar") # doctest: +IGNORE_OUTPUT This will download the science files associated to the observation 'J6FL25S4Q' and it will store them in a file called 'science_data_for_J6FL25S4Q.tar.fits.gz', modifying the filename provided to ensure that the extension of the file is correct. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> esahubble.download_product(observation_id="J6FL25S4Q", filename="science_data_for_J6FL25S4Q.tar", product_type="SCIENCE_PRODUCT") + >>> esahubble.download_product(observation_id="J6FL25S4Q", product_type="SCIENCE_PRODUCT", + ... filename="science_data_for_J6FL25S4Q.tar") # doctest: +IGNORE_OUTPUT This third case will download the science files associated to the observation 'J6FL25S4Q' in raw calibration level and it will store them in a file called 'science_raw_data_for_J6FL25S4Q.fits.gz', modifying the filename provided to ensure that the extension of the file is correct. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> esahubble.download_product(observation_id="J6FL25S4Q", calibration_level="RAW", filename="science_raw_data_for_J6FL25S4Q", product_type="SCIENCE_PRODUCT") + >>> esahubble.download_product(observation_id="J6FL25S4Q", calibration_level="RAW", + ... filename="science_raw_data_for_J6FL25S4Q", product_type="SCIENCE_PRODUCT") # doctest: +IGNORE_OUTPUT --------------------------- 2. Getting Hubble postcards --------------------------- -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> esahubble.get_postcard("J6FL25S4Q", "RAW", 256, "raw_postcard_for_J6FL25S4Q.jpg") + >>> esahubble.get_postcard("J6FL25S4Q", "RAW", 256, "raw_postcard_for_J6FL25S4Q.jpg") # doctest: +IGNORE_OUTPUT This will download the postcard for the observation 'J8VP03010' with low resolution (256) and it will stored in a jpg called @@ -82,7 +83,8 @@ Calibration levels can be RAW, CALIBRATED, PRODUCT or AUXILIARY. Note: Artifact is a single Hubble product file. -.. code-block:: python +.. Doesn't run +.. doctest-skip:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() @@ -98,12 +100,11 @@ artifact to be download. The query_target function queries the name of the target as given by the proposer of the observations. -.. code-block:: python +.. doctest-remote-data:: - >>> from astroquery.esa.hubble import ESAHubble + >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> table = esahubble.query_target("m31", "m31_query.xml") - >>> str(table) + >>> table = esahubble.query_target("m31", filename="m31_query.xml") # doctest: +IGNORE_OUTPUT This will retrieve a table with the output of the query. It will also download a file storing all metadata for all observations @@ -116,7 +117,7 @@ file 'm31_query.xml'. The query_criteria function uses a set of established parameters to create and execute an ADQL query, accessing the HST archive database usgin the Table -Access Protocol (TAP). +Access Protocol (TAP). - **calibration_level** (*str or int, optional*): The identifier of the data reduction/processing applied to the data. @@ -128,21 +129,21 @@ Access Protocol (TAP). - **data_product_type** (*str, optional*): High level description of the product. + image - + spectrum + + spectrum + timeseries - **intent** (*str, optional*): The intent of the original obsever in acquiring this observation. - + SCIENCE + + SCIENCE + CALIBRATION - **collection** (*list of strings, optional*): List of collections that are available in eHST catalogue. + HLA + HST - + Do not forget that this is a list of elements, so it must be defined as ['HST'], ['HST', 'HLA']... - + - **instrument_name** (*list of strings, optional*): Name(s) of the instrument(s) used to generate the dataset. This is also a list of elements. - **filters** (*list of strings, optional*): Name(s) of the filter(s) used to generate the dataset. This is also a list of elements. - **async_job** (*bool, optional, default 'True'*): executes the query (job) in asynchronous/synchronous mode (default synchronous) @@ -153,110 +154,172 @@ Access Protocol (TAP). This is an example of a query with all the parameters and the verbose flag activated, so the query is shown as a log message. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> result = esahubble.query_criteria(calibration_level = 3, - data_product_type = 'image', - intent='SCIENCE', - obs_collection=['HLA'], - instrument_name = ['WFC3'], - filters = ['F555W', 'F606W'], - async_job = False, - output_file = 'output1.vot.gz', - output_format="votable", - verbose = True, - get_query = False) - INFO: select o.*, p.calibration_level, p.data_product_type from ehst.observation - AS o LEFT JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid - where(p.calibration_level LIKE '%PRODUCT%' AND p.data_product_type LIKE '%image%' - AND o.intent LIKE '%SCIENCE%' AND (o.collection LIKE '%HLA%') AND (o.instrument_name - LIKE '%WFC3%') AND (o.instrument_configuration LIKE '%F555W%' OR - o.instrument_configuration LIKE '%F606W%')) [astroquery.esa.hubble.core] - >>> str(result) - Table length=2000 ... - + ... data_product_type = 'image', + ... intent='SCIENCE', + ... obs_collection=['HLA'], + ... instrument_name = ['WFC3'], + ... filters = ['F555W', 'F606W'], + ... async_job = False, + ... output_file = 'output1.vot.gz', + ... output_format="votable", + ... verbose = True, + ... get_query = False) # doctest: +IGNORE_OUTPUT + INFO: select o.*, p.calibration_level, p.data_product_type, pos.ra, pos.dec from ehst.observation AS o JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid JOIN ehst.position as pos on p.plane_id = pos.plane_id where(p.calibration_level LIKE '%PRODUCT%' AND p.data_product_type LIKE '%image%' AND o.intent LIKE '%SCIENCE%' AND (o.collection LIKE '%HLA%') AND (o.instrument_name LIKE '%WFC3%') AND (o.instrument_configuration LIKE '%F555W%' OR o.instrument_configuration LIKE '%F606W%')) [astroquery.esa.hubble.core] + Launched query: 'select TOP 2000 o.*, p.calibration_level, p.data_product_type, pos.ra, pos.dec from ehst.observation AS o JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid JOIN ehst.position as pos on p.plane_id = pos.plane_id where(p.calibration_level LIKE '%PRODUCT%' AND p.data_product_type LIKE '%image%' AND o.intent LIKE '%SCIENCE%' AND (o.collection LIKE '%HLA%') AND (o.instrument_name LIKE '%WFC3%') AND (o.instrument_configuration LIKE '%F555W%' OR o.instrument_configuration LIKE '%F606W%'))' + ------>http + host = hst.esac.esa.int:80 + context = /tap-server/tap//sync + Content-type = application/x-www-form-urlencoded + 200 200 + [('Date', 'Mon, 25 Jul 2022 15:46:58 GMT'), ('Server', 'Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_jk/1.2.48'), ('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate'), ('Pragma', 'no-cache'), ('Expires', '0'), ('X-XSS-Protection', '1; mode=block'), ('X-Frame-Options', 'SAMEORIGIN'), ('X-Content-Type-Options', 'nosniff'), ('Content-Encoding', 'gzip'), ('Content-Disposition', 'attachment;filename="1658764018965O-result.vot"'), ('Content-Type', 'application/x-votable+xml'), ('Set-Cookie', 'JSESSIONID=B3AD5976E059A042D39AAA35C9C814FC; Path=/; HttpOnly'), ('Connection', 'close'), ('Transfer-Encoding', 'chunked')] + Retrieving sync. results... + Saving results to: output1.vot.gz + Query finished. + >>> print(result) # doctest: +IGNORE_OUTPUT + algorithm_name collection ... ra dec + object object ... float64 float64 + ---------------- ---------- ... ------------------ ------------------- + HLA ASSOCIATIONS HLA ... 196.03170537675234 -49.368511417967795 + exposure HLA ... 196.03171011284857 -49.36851677699096 + exposure HLA ... 259.2792180139594 43.13314581814599 + exposure HLA ... 259.2792180139594 43.13314581814599 + exposure HLA ... 259.2792180139594 43.13314581814599 + exposure HLA ... 259.2792180139594 43.13314581814599 + HLA ASSOCIATIONS HLA ... 259.2792176982667 43.133150839338235 + HLA ASSOCIATIONS HLA ... 68.97704902707727 -12.677248264318337 + HLA ASSOCIATIONS HLA ... 68.97704902707727 -12.677248264318337 + exposure HLA ... 68.97705442773626 -12.677252912230811 + ... ... ... ... ... + HLA ASSOCIATIONS HLA ... 210.80500687669544 54.278497365211976 + exposure HLA ... 152.7572845488674 -4.80118571219738 + exposure HLA ... 152.7572845488674 -4.80118571219738 + HLA ASSOCIATIONS HLA ... 152.7572806802392 -4.801183163442886 + exposure HLA ... 152.7572845488674 -4.80118571219738 + HLA ASSOCIATIONS HLA ... 202.44374997285675 -23.750512499483055 + exposure HLA ... 202.44375533561396 -23.750513053780008 + HLA ASSOCIATIONS HLA ... 202.44374997285675 -23.750512499483055 + exposure HLA ... 202.44375533561396 -23.750513053780008 + exposure HLA ... 152.8105559087745 -4.65644496753373 + exposure HLA ... 152.8105559087745 -4.65644496753373 + Length = 2000 rows + This will make a synchronous search, limited to 2000 results to find the observations that match these specific requirements. It will also download a votable file called **output.vot.gz** containing the result of the query. The following example uses the string definition of the calibration level ('PRODUCT') and executes an asynchronous job to get all the results that match the criteria. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> result = esahubble.query_criteria(calibration_level = 'PRODUCT', - data_product_type = 'image', - intent='SCIENCE', - obs_collection=['HLA'], - instrument_name = ['WFC3'], - filters = ['F555W', 'F606W'], - async_job = True, - output_file = 'output2.vot.gz', - output_format="votable", - verbose = True, - get_query = False) - >>> str(result) - Table length=12965 ... - + >>> result = esahubble.query_criteria(calibration_level = 'PRODUCT', + ... data_product_type = 'image', + ... intent='SCIENCE', + ... obs_collection=['HLA'], + ... instrument_name = ['WFC3'], + ... filters = ['F555W', 'F606W'], + ... async_job = True, + ... output_file = 'output2.vot.gz', + ... output_format="votable", + ... verbose = False, + ... get_query = False) + >>> print(result) # doctest: +IGNORE_OUTPUT + algorithm_name collection ... ra dec + ---------------- ---------- ... ------------------ ------------------- + HLA ASSOCIATIONS HLA ... 196.03170537675234 -49.368511417967795 + exposure HLA ... 196.03171011284857 -49.36851677699096 + exposure HLA ... 259.2792180139594 43.13314581814599 + exposure HLA ... 259.2792180139594 43.13314581814599 + exposure HLA ... 259.2792180139594 43.13314581814599 + exposure HLA ... 259.2792180139594 43.13314581814599 + HLA ASSOCIATIONS HLA ... 259.2792176982667 43.133150839338235 + HLA ASSOCIATIONS HLA ... 68.97704902707727 -12.677248264318337 + HLA ASSOCIATIONS HLA ... 68.97704902707727 -12.677248264318337 + exposure HLA ... 68.97705442773626 -12.677252912230811 + exposure HLA ... 68.97705442773626 -12.677252912230811 + ... ... ... ... ... + exposure HLA ... 345.6583071276117 56.72394842149916 + exposure HLA ... 345.65831033427037 56.723950318257195 + exposure HLA ... 345.65826624404 56.72397181023684 + exposure HLA ... 345.6582969971932 56.72398324705819 + exposure HLA ... 345.65825980977695 56.72394255099519 + exposure HLA ... 345.6582694604474 56.7239515193261 + exposure HLA ... 345.6582302371085 56.72396314167643 + exposure HLA ... 345.65834620470923 56.72399729379321 + HLA ASSOCIATIONS HLA ... 345.6583089525364 56.723967490767976 + exposure HLA ... 295.67142911697397 -10.32552919162329 + exposure HLA ... 140.37867144039893 45.11729184881005 + Length = 12965 rows + + As has been mentioned, these parameters are optional and it is not necessary to define all of them to execute this function, as the search will be adapted to the ones that are available. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> result1 = esahubble.query_criteria(calibration_level = 'PRODUCT', - async_job = False, - output_file = 'output3.vot.gz') - >>> result2 = esahubble.query_criteria(data_product_type = 'image', - intent='SCIENCE', - async_job = False, - output_file = 'output4.vot.gz') + >>> result1 = esahubble.query_criteria(calibration_level = 'PRODUCT', + ... async_job = False, + ... output_file = 'output3.vot.gz') + >>> result2 = esahubble.query_criteria(data_product_type = 'image', + ... intent='SCIENCE', + ... async_job = False, + ... output_file = 'output4.vot.gz') >>> result3 = esahubble.query_criteria(data_product_type = 'timeseries', - async_job = False, - output_file = 'output5.vot.gz') - + ... async_job = False, + ... output_file = 'output5.vot.gz') + If no criteria are specified to limit the selection, this function will retrieve all the observations. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> result = esahubble.query_criteria(async_job = False, - verbose = True) - INFO: select o.*, p.calibration_level, p.data_product_type from ehst.observation - AS o LEFT JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid - [astroquery.esa.hubble.core] - - This last example will provide the ADQL query based on the criteria defined by the user. - -.. code-block:: python + >>> result = esahubble.query_criteria(async_job = False, verbose = True) # doctest: +IGNORE_OUTPUT + INFO: select o.*, p.calibration_level, p.data_product_type, pos.ra, pos.dec from ehst.observation AS o JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid JOIN ehst.position as pos on p.plane_id = pos.plane_id [astroquery.esa.hubble.core] + Launched query: 'select TOP 2000 o.*, p.calibration_level, p.data_product_type, pos.ra, pos.dec from ehst.observation AS o JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid JOIN ehst.position as pos on p.plane_id = pos.plane_id' + ------>http + host = hst.esac.esa.int:80 + context = /tap-server/tap//sync + Content-type = application/x-www-form-urlencoded + 200 200 + [('Date', 'Mon, 25 Jul 2022 16:21:18 GMT'), ('Server', 'Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_jk/1.2.48'), ('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate'), ('Pragma', 'no-cache'), ('Expires', '0'), ('X-XSS-Protection', '1; mode=block'), ('X-Frame-Options', 'SAMEORIGIN'), ('X-Content-Type-Options', 'nosniff'), ('Content-Encoding', 'gzip'), ('Content-Disposition', 'attachment;filename="1658766078997O-result.vot"'), ('Content-Type', 'application/x-votable+xml'), ('Set-Cookie', 'JSESSIONID=7098EC515E7A2240E6F3129D23564139; Path=/; HttpOnly'), ('Connection', 'close'), ('Transfer-Encoding', 'chunked')] + Retrieving sync. results... + Query finished. + +This last example will provide the ADQL query based on the criteria defined by the user. + +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> result = esahubble.query_criteria(calibration_level = 'PRODUCT', - data_product_type = 'image', - intent='SCIENCE', - obs_collection=['HLA'], - instrument_name = ['WFC3'], - filters = ['F555W', 'F606W'], - get_query = True) - >>> str(result) + ... data_product_type = 'image', + ... intent='SCIENCE', + ... obs_collection=['HLA'], + ... instrument_name = ['WFC3'], + ... filters = ['F555W', 'F606W'], + ... get_query = True) + >>> print(result) + select o.*, p.calibration_level, p.data_product_type, pos.ra, pos.dec from ehst.observation AS o JOIN ehst.plane as p on o.observation_uuid=p.observation_uuid JOIN ehst.position as pos on p.plane_id = pos.plane_id where(p.calibration_level LIKE '%PRODUCT%' AND p.data_product_type LIKE '%image%' AND o.intent LIKE '%SCIENCE%' AND (o.collection LIKE '%HLA%') AND (o.instrument_name LIKE '%WFC3%') AND (o.instrument_configuration LIKE '%F555W%' OR o.instrument_configuration LIKE '%F606W%')) -------------------------------------- 6. Cone searches in the Hubble archive -------------------------------------- -.. code-block:: python +.. doctest-remote-data:: >>> from astropy import coordinates >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> c = coordinates.SkyCoord("00h42m44.51s +41d16m08.45s", frame='icrs') >>> table = esahubble.cone_search(c, 7, "cone_search_m31_5.vot") - >>> str(table) This will perform a cone search with radius 7 arcmins. The result of the query will be returned and stored in the votable file @@ -271,46 +334,85 @@ in memory, without defining neither a filename nor the "save" tag. It is also possible to perform a cone search defined by a target name or coordinates, a radius and a set of criteria to filter the results. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> result = esahubble.cone_search_criteria(target= 'm31',radius=7, - obs_collection=['HST'], - data_product_type = 'image', - instrument_name = ['ACS/WFC'], - filters = ['F435W'], - async_job = True, - filename = 'output1.vot.gz', - output_format="votable") - >>> result - - - algorithm_name collection end_time end_time_mjd exposure_duration ... target_name calibration_level data_product_type ra dec - object object object float64 float64 ... object object object float64 float64 - -------------- ---------- ----------------------- ----------------- ----------------- ... ----------- ----------------- ----------------- ------------------ ----------------- - drizzle HST 2002-06-29 14:15:20.787 52454.51065725694 1600.0 ... M31-T3 CALIBRATED image 10.791884595154517 41.28819762447081 - ... ... ... ... ... ... ... ... ... ... ... - exposure HST 2014-06-26 03:40:17.0 56834.06964120371 1246.0 ... M-31-CORE CALIBRATED image 10.531742116262286 41.25273489574185 - exposure HST 2014-06-26 03:40:17.0 56834.06964120371 1246.0 ... M-31-CORE RAW image 10.531742116262286 41.25273489574185 - - -.. code-block:: python + ... obs_collection=['HST'], + ... data_product_type = 'image', + ... instrument_name = ['ACS/WFC'], + ... filters = ['F435W'], + ... async_job = True, + ... filename = 'output1.vot.gz', + ... output_format="votable") + >>> print(result) # doctest: +IGNORE_OUTPUT + algorithm_name collection end_time ... ra dec + -------------- ---------- ----------------------------- ... ------------------ ------------------ + multidrizzle HST 2002-06-29 15:25:57.556128+00 ... 10.773035733571806 41.28459914735614 + drizzle HST 2002-06-29 12:15:20.787+00 ... 10.809522856742248 41.29351658280752 + drizzle HST 2002-06-29 12:15:20.787+00 ... 10.809522856742248 41.29351658280752 + drizzle HST 2002-06-29 12:15:20.787+00 ... 10.809522856742248 41.29351658280752 + drizzle HST 2002-06-29 15:25:57.557+00 ... 10.809522856742248 41.29351658280752 + drizzle HST 2002-06-29 15:25:57.557+00 ... 10.809522856742248 41.29351658280752 + drizzle HST 2002-06-29 15:25:57.557+00 ... 10.809522856742248 41.29351658280752 + exposure HST 2002-06-29 10:40:25.757+00 ... 10.809522856742248 41.29351658280752 + exposure HST 2002-06-29 10:40:25.757+00 ... 10.809522856742248 41.29351658280752 + exposure HST 2002-06-29 10:49:21.757+00 ... 10.809522856742248 41.29351658280752 + exposure HST 2002-06-29 10:49:21.757+00 ... 10.809522856742248 41.29351658280752 + ... ... ... ... ... ... + exposure HST 2013-06-19 01:44:51.32+00 ... 10.766005545644669 41.309233725982274 + drizzle HST 2014-06-26 02:01:04.4+00 ... 10.56783424321201 41.26161655867049 + drizzle HST 2014-06-26 02:01:04.4+00 ... 10.56783424321201 41.26161655867049 + exposure HST 2014-06-26 00:04:17.347+00 ... 10.56783424321201 41.26161655867049 + exposure HST 2014-06-26 00:04:17.347+00 ... 10.56783424321201 41.26161655867049 + exposure HST 2014-06-26 00:26:04.320001+00 ... 10.56784158160213 41.26168995624255 + exposure HST 2014-06-26 00:26:04.320001+00 ... 10.56784158160213 41.26168995624255 + exposure HST 2014-06-26 01:37:39.337+00 ... 10.567904084182938 41.26166780758625 + exposure HST 2014-06-26 01:37:39.337+00 ... 10.567904084182938 41.26166780758625 + exposure HST 2014-06-26 02:01:03.337+00 ... 10.567896755477244 41.26159439998882 + exposure HST 2014-06-26 02:01:03.337+00 ... 10.567896755477244 41.26159439998882 + Length = 323 rows + + +.. doctest-remote-data:: >>> from astropy import coordinates >>> from astropy import units as u >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() - >>> c = coordinates.SkyCoord("00h42m44.51s +41d16m08.45s", frame='icrs') - >>> result = esahubble.cone_search_criteria(coordinates=c,radius=7*u.arcmin, - obs_collection=['HST'], - instrument_name = ['WFPC2'], - filters = ['F606W'], - async_job = True, - filename = 'output1.vot.gz', - output_format="votable", - verbose=True) - >>> str(table) + >>> coords = coordinates.SkyCoord("00h42m44.51s +41d16m08.45s", frame='icrs') + >>> result = esahubble.cone_search_criteria(coordinates=coords, + ... radius=7*u.arcmin, + ... obs_collection=['HST'], + ... instrument_name = ['WFPC2'], + ... filters = ['F606W'], + ... async_job = True, + ... filename = 'output1.vot.gz', + ... output_format="votable") + >>> print(result) # doctest: +IGNORE_OUTPUT + algorithm_name collection end_time ... ra dec + -------------- ---------- -------------------------- ... ------------------ ------------------ + exposure HST 1996-07-11 19:57:16.567+00 ... 10.707934959432448 41.29717554921647 + exposure HST 1996-07-11 19:57:16.567+00 ... 10.707934959432448 41.29717554921647 + exposure HST 1996-07-11 23:10:56.567+00 ... 10.707934959432448 41.29717554921647 + exposure HST 1996-07-11 23:10:56.567+00 ... 10.707934959432448 41.29717554921647 + exposure HST 1995-08-07 17:18:17.427+00 ... 10.667025486961762 41.27549451122148 + exposure HST 1995-08-07 17:18:17.427+00 ... 10.667025486961762 41.27549451122148 + exposure HST 1998-08-13 15:41:53.99+00 ... 10.62792588770676 41.16842053688991 + exposure HST 1998-08-13 15:41:53.99+00 ... 10.62792588770676 41.16842053688991 + exposure HST 1998-08-13 15:53:53.99+00 ... 10.627778569005512 41.168427385527195 + exposure HST 1998-08-13 15:53:53.99+00 ... 10.627778569005512 41.168427385527195 + exposure HST 1999-06-06 17:52:53.323+00 ... 10.726290793310492 41.17571391732456 + exposure HST 1999-06-06 17:52:53.323+00 ... 10.726290793310492 41.17571391732456 + exposure HST 1999-06-06 19:19:33.45+00 ... 10.726290793310492 41.17571391732456 + exposure HST 1999-06-06 19:19:33.45+00 ... 10.726290793310492 41.17571391732456 + exposure HST 1998-08-13 17:18:53.99+00 ... 10.627778569005512 41.168427385527195 + exposure HST 1998-08-13 17:18:53.99+00 ... 10.627778569005512 41.168427385527195 + exposure HST 2002-06-29 10:28:56.79+00 ... 10.673753121140141 41.33685901875662 + exposure HST 2002-06-29 10:28:56.79+00 ... 10.673753121140141 41.33685901875662 + exposure HST 2002-06-29 10:35:56.79+00 ... 10.673753121140141 41.33685901875662 + exposure HST 2002-06-29 10:35:56.79+00 ... 10.673753121140141 41.33685901875662 This will perform a cone search with radius 7 arcmins around the target (defined by its coordinates or its name) using the filters defined when executing the function. @@ -325,12 +427,12 @@ This function allows the same parameters than the search criteria (see Section 5 This function provides access to the HST archive database using the Table Access Protocol (TAP) and via the Astronomical Data Query Language (ADQL). -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> result = esahubble.query_hst_tap("select top 10 * from hsc_v2.hubble_sc2", "test.vot.gz") - >>> print(result) + INFO: Query finished. [astroquery.utils.tap.core] This will execute an ADQL query to download the first 10 sources in the Hubble Source Catalog (HSC) version 2.1 (format default: compressed @@ -348,12 +450,13 @@ If the observation is Simple the method returns the Composite observation that is built on this simple observation. If the observation is Composite then the method returns the simple observations that make it up. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> result = esahubble.get_member_observations("jdrz0c010") >>> print(result) + ['jdrz0cjxq', 'jdrz0cjyq'] -------------------------------------------------------- @@ -363,12 +466,13 @@ method returns the simple observations that make it up. This function takes in an observation id of a Simple HAP or HST observation and returns the corresponding HAP or HST observation -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.hubble import ESAHubble >>> esahubble = ESAHubble() >>> result = esahubble.get_hap_hst_link("hst_16316_71_acs_sbc_f150lp_jec071i9") >>> print(result) + ['jec071i9q'] diff --git a/docs/esa/iso/iso.rst b/docs/esa/iso/iso.rst index 69ebcab75a..6c22b49c12 100644 --- a/docs/esa/iso/iso.rst +++ b/docs/esa/iso/iso.rst @@ -1,5 +1,3 @@ -.. doctest-skip-all - .. _astroquery.esa.iso: **************************************** @@ -26,89 +24,88 @@ Examples 1. Querying ISO data ------------------------------ -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.iso import ISO - >>> table=ISO.query_ida_tap(query="SELECT tdt,ra,dec,aotname,target " + - ... "FROM ida.observations " + - ... "WHERE INTERSECTS(CIRCLE('ICRS',10.68470833,41.26875,0.08333333333333333)," + - ... "ida.observations.s_region_fov)=1") - >>> table.pprint() - tdt ra dec aotname target - h deg - -------- ----------- ------------ ------- -------------- - 40001501 0.71278 41.26997 S01 M31_BULGE - 40001621 0.712304666 41.26917 C04 M31 - 40001622 0.712304666 41.26916 C04 M31 - 40001717 0.712305333 41.26917 C04 M31 - 40001718 0.712306 41.26916 C04 M31 - 40001847 0.712304666 41.26916 C04 M31 - 40001945 0.712305333 41.26916 C04 M31 - 40002013 0.712305333 41.26916 C04 M31 - 40002014 0.712305333 41.26917 C04 M31 - 40002151 0.712305333 41.26917 C04 M31 - ... ... ... ... ... - 58002001 0.7268883 41.156980827 C// Near M31 - 58002102 0.727339315 41.157998107 C// Near M31_BULGE - 58302305 0.71225 41.26945 C01 M31_LW6 - 58302402 0.71225 41.26945 C01 M31_LW2 - 58302504 0.71225 41.26944 C01 M31_LW1 - 58302603 0.719229923 41.047816169 C// Near M31S - 58302703 0.71225 41.26945 C01 M31_LW3 - 76100504 0.712055333 41.29 C03 M31 D395 - 76100708 0.722799457 41.430336366 C// Near M31_PAH - 76196300 -- -- C63 + >>> table = ISO.query_ida_tap(query=("SELECT tdt,ra,dec,aotname,target " + ... "FROM ida.observations " + ... "WHERE INTERSECTS(CIRCLE('ICRS',10.68470833,41.26875," + ... "0.08333333333333333)," + ... "ida.observations.s_region_fov)=1")) + >>> table.pprint() # doctest: +IGNORE_OUTPUT + tdt ra dec aotname target + h deg + -------- ----------- ------------ ------- ------------ + 43601726 0.712305333 41.26917 C04 M31 + 43701073 0.712305333 41.26916 C04 M31 + 43701863 0.712305333 41.26917 C04 M31 + 58302402 0.71225 41.26945 C01 M31_LW2 + 58302703 0.71225 41.26945 C01 M31_LW3 + 40001501 0.71278 41.26997 S01 M31_BULGE + 60202005 0.720306 41.38386 L01 M31N + 40001621 0.712304666 41.26917 C04 M31 + 40001622 0.712304666 41.26916 C04 M31 + 40001717 0.712305333 41.26917 C04 M31 + ... ... ... ... ... + 58302603 0.719229923 41.047816169 C// Near M31S + 40402302 0.713987 41.281959 L// Near M31 + 60202005 0.73670327 41.310155308 C// Near M31N + 58302305 0.697341 41.375848 L// Near M31_LW6 + 58302402 0.697336 41.37576 L// Near M31_LW2 + 58302504 0.697331 41.375662 L// Near M31_LW1 + 76100601 0.71225 41.26944 C04 M31_CVF + 76100504 0.712055333 41.29 C03 M31 D395 + 76100708 0.722799457 41.430336366 C// Near M31_PAH + 76196300 -- -- C63 Length = 49 rows -'query_ida_tap' executes a TAP (Tabular Access Protocol) query to the ISO archive. In this case, -the archive is queried to its main table ('ida.observations') for observations that overlaps the + +'query_ida_tap' executes a TAP (Tabular Access Protocol) query to the ISO archive. In this case, +the archive is queried to its main table ('ida.observations') for observations that overlaps the position ('ra=10.68470833, ec=41.26875' in degrees, that corresponds with M31). The result of a query can be stored in a file by defining the output format and the output file name. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.iso import ISO - >>> table = ISO.query_ida_tap(query="select top 10 * from ida.observations", - >>> output_format='csv', output_file='results10.csv') + >>> table = ISO.query_ida_tap(query="select top 10 * from ida.observations", + ... output_format='csv', output_file='results10.csv') This will execute an ADQL query to query the first 10 observations in the ISO Data Archive. The result of -the query will be stored in the file 'results10.csv'. The result of this query can be printed by doing +the query will be stored in the file 'results10.csv'. The result of this query can be printed by doing print(table). -Once we have the observations identifiers (TDT) we can invoke the data download. To discover the tables +Once we have the observations identifiers (TDT) we can invoke the data download. To discover the tables provided by this service, see section 'Getting Tables Details'. ------------------------------ 2. Getting ISO data ------------------------------ -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.iso import ISO - >>> ISO.download_data('80000203', retrieval_type="OBSERVATION", - ... product_level="DEFAULT_DATA_SET", + >>> import tarfile + >>> + >>> ISO.download_data('80000203', retrieval_type="OBSERVATION", + ... product_level="DEFAULT_DATA_SET", ... filename="80000203", verbose=True) - Created TAP+ (v1.2.1) - Connection: - Host: nida.esac.esa.int - Use HTTPS: False - Port: 80 - SSL Port: 443 - INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&tdt=80000203&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000203&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] INFO: Copying file to 80000203.tar... [astroquery.esa.iso.core] - INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&tdt=80000203&product_level=DEFAULT_DATA_SET to 80000203.tar [astroquery.esa.iso.core] - >>> import tarfile + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000203&product_level=DEFAULT_DATA_SET to 80000203.tar [astroquery.esa.iso.core] + '80000203.tar' >>> tar = tarfile.open("80000203.tar") - >>> tar.list() - -rw-r--r-- idaops/0 1094 2005-12-23 12:02:55 ././ISO1601052542/EXTRAKON//pich80000203.gif - -rw-r--r-- idaops/0 266240 2005-12-23 12:02:54 ././ISO1601052542/EXTRAKON//C10480000203.tar - -rw-r--r-- idaops/0 14400 2005-12-23 12:02:55 ././ISO1601052542/EXTRAKON//psph80000203.fits - -rw-r--r-- idaops/0 5599 2005-12-23 12:02:55 ././ISO1601052542/EXTRAKON//ppch80000203.gif - -rw-r--r-- idaops/0 266240 2005-12-23 12:02:54 ././ISO1601052542/EXTRAKON//C10180000203.tar - >>> tar.extract("././ISO1648561466/EXTRAKON//psph80000203.fits") + >>> tar.list() # doctest: +IGNORE_OUTPUT + -rw-r--r-- idaops/0 1094 2005-12-23 11:02:55 ././ISO1659972236/EXTRAKON//pich80000203.gif + -rw-r--r-- idaops/0 266240 2005-12-23 11:02:54 ././ISO1659972236/EXTRAKON//C10480000203.tar + -rw-r--r-- idaops/0 14400 2005-12-23 11:02:55 ././ISO1659972236/EXTRAKON//psph80000203.fits + -rw-r--r-- idaops/0 5599 2005-12-23 11:02:55 ././ISO1659972236/EXTRAKON//ppch80000203.gif + -rw-r--r-- idaops/0 266240 2005-12-23 11:02:54 ././ISO1659972236/EXTRAKON//C10180000203.tar + >>> tar.extract("././ISO1659972236/EXTRAKON//psph80000203.fits") # doctest: +SKIP >>> tar.extractall() -'download_data' method invokes the data download of files from the ISO Data Archive, using the +'download_data' method invokes the data download of files from the ISO Data Archive, using the observation identifier (TDT) as input. There are different product levels: * ALL @@ -119,75 +116,86 @@ observation identifier (TDT) as input. There are different product levels: * HPDP: 'Highly Processed Data Products' (HPDP). These products include DATA (images, spectra etc.), which have been processed beyond the pipeline and/or using new, refined algorithms and therefore have been improved to any degree compared to the OLP 10 products, as well as any resulting CATALOGUES and ATLASES. * DEFAULT_DATA_SET: This is the selected pack of products that better characterize the observation, either pipeline products or HPDP products. -There are two valid values for 'retrieval_type': OBSERVATION and STANDALONE. OBSERVATION is the one -used commonly to download data from the archive and STANDALONE returns a Virtual Observatory +There are two valid values for 'retrieval_type': OBSERVATION and STANDALONE. OBSERVATION is the one +used commonly to download data from the archive and STANDALONE returns a Virtual Observatory product (if any). -For more info on the data products, please check 'http://nida.esac.esa.int/nida-cl-web/', +For more info on the data products, please check 'http://nida.esac.esa.int/nida-cl-web/', "IDA USERS GUIDE" section. -Both query and download methods are designed to be used in coordination. For example, we can query -for SWS observations with a certain target associated (not calibration) for the revolution 800 and +Both query and download methods are designed to be used in coordination. For example, we can query +for SWS observations with a certain target associated (not calibration) for the revolution 800 and we can loop on the observations to download the best products (DEFAULT_DATA_SET) in different tar files. -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.iso import ISO - >>> table=ISO.query_ida_tap(query="SELECT tdt, revno, aotname, ra, dec FROM " + - ... "ida.observations WHERE " + + >>> table=ISO.query_ida_tap(query="SELECT tdt, revno, aotname, ra, dec FROM " + + ... "ida.observations WHERE " + ... "revno=800 and aotname like 'S%' and target != ''") - >>> print(table) + >>> print(table) # doctest: +IGNORE_OUTPUT tdt revno aotname ra dec h deg -------- ----- ------- ------------ -------- - 80002504 800 S01 2.74033 55.18761 - 80002450 800 S01 2.550044 58.03472 - 80002304 800 S07 2.428013333 62.09789 80002247 800 S07 2.428012666 62.09789 80002014 800 S02 0.901055333 73.08528 - 80000938 800 S01 21.691944 76.37833 + 80002504 800 S01 2.74033 55.18761 80000828 800 S02 21.035861333 68.15064 80000104 800 S01 16.477365333 41.88163 + 80000938 800 S01 21.691944 76.37833 + 80002304 800 S07 2.428013333 62.09789 + 80002450 800 S01 2.550044 58.03472 + >>> >>> for observation in table: - >>> ISO.download_data(str(observation['tdt']), retrieval_type="OBSERVATION", - ... product_level="DEFAULT_DATA_SET", filename=str(observation['tdt']), verbose=True) - INFO: http://nida.esac.esa.int/nida-sl-tap/data? - retrieval_type=OBSERVATION&tdt=80002504&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + ... ISO.download_data(str(observation['tdt']), retrieval_type="OBSERVATION", + ... product_level="DEFAULT_DATA_SET", filename=str(observation['tdt']), verbose=True) # doctest: +SKIP + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000104&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Copying file to 80000104.tar... [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000104&product_level=DEFAULT_DATA_SET to 80000104.tar [astroquery.esa.iso.core] + '80000104.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002504&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] INFO: Copying file to 80002504.tar... [astroquery.esa.iso.core] - INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data? - retrieval_type=OBSERVATION&tdt=80002504&product_level=DEFAULT_DATA_SET to 80002504.tar [astroquery.esa.iso.core] - INFO: http://nida.esac.esa.int/nida-sl-tap/data? - retrieval_type=OBSERVATION&tdt=80002450&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002504&product_level=DEFAULT_DATA_SET to 80002504.tar [astroquery.esa.iso.core] + '80002504.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000938&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Copying file to 80000938.tar... [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000938&product_level=DEFAULT_DATA_SET to 80000938.tar [astroquery.esa.iso.core] + '80000938.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000828&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Copying file to 80000828.tar... [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80000828&product_level=DEFAULT_DATA_SET to 80000828.tar [astroquery.esa.iso.core] + '80000828.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002304&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Copying file to 80002304.tar... [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002304&product_level=DEFAULT_DATA_SET to 80002304.tar [astroquery.esa.iso.core] + '80002304.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002450&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] INFO: Copying file to 80002450.tar... [astroquery.esa.iso.core] - INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data? - retrieval_type=OBSERVATION&tdt=80002450&product_level=DEFAULT_DATA_SET to 80002450.tar [astroquery.esa.iso.core] - ...... - INFO: http://nida.esac.esa.int/nida-sl-tap/data? - retrieval_type=OBSERVATION&tdt=80000104&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] - INFO: Copying file to 80000104.tar... [astroquery.esa.iso.core] - INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data? - retrieval_type=OBSERVATION&tdt=80000104&product_level=DEFAULT_DATA_SET to 80000104.tar [astroquery.esa.iso.core] - - + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002450&product_level=DEFAULT_DATA_SET to 80002450.tar [astroquery.esa.iso.core] + '80002450.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002247&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Copying file to 80002247.tar... [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002247&product_level=DEFAULT_DATA_SET to 80002247.tar [astroquery.esa.iso.core] + '80002247.tar' + INFO: http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002014&product_level=DEFAULT_DATA_SET [astroquery.esa.iso.core] + INFO: Copying file to 80002014.tar... [astroquery.esa.iso.core] + INFO: Wrote http://nida.esac.esa.int/nida-sl-tap/data?retrieval_type=OBSERVATION&DATA_RETRIEVAL_ORIGIN=astroquery&tdt=80002014&product_level=DEFAULT_DATA_SET to 80002014.tar [astroquery.esa.iso.core] + '80002014.tar' ------------------------------- 2. Getting ISO postcards ------------------------------- -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.iso import ISO - >>> ISO.get_postcard('80001538', filename="postcard") - >>> from IPython.display import Image - >>> from IPython.core.display import HTML + >>> from IPython.core.display import HTML + >>> + >>> ISO.get_postcard('80001538', filename="postcard") # doctest: +IGNORE_OUTPUT >>> Image(filename = "postcard.png", width=400, height=100) - - Downloading URL http://nida.esac.esa.int/nida-sl-tap/data?&retrieval_type=POSTCARD&tdt=80001538 to - ~/.astropy/cache/astroquery/ISO/data?&retrieval_type=POSTCARD&tdt=80001538 ... [Done] - INFO: Copying file to postcard.png... [astroquery.esa.iso.core] - - + + .. figure:: images/campostcard.png :scale: 100% @@ -202,24 +210,24 @@ This will download the ISO postcard for the observation '80001538' and it will s 3. Getting ISO Tables Details through TAP ------------------------------------------ -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.iso import ISO - >>> ISO.get_tables() - + >>> ISO.get_tables() # doctest: +IGNORE_OUTPUT INFO: Retrieving tables... [astroquery.utils.tap.core] INFO: Parsing tables... [astroquery.utils.tap.core] INFO: Done. [astroquery.utils.tap.core] - ['hpdp.cam_sato', 'hpdp.cambendo', 'hpdp.chopc2i', 'hpdp.chopc2ii', 'hpdp.compkon', - 'hpdp.evolkon', 'hpdp.extrakon', 'hpdp.kon3p6i', 'hpdp.kon3p6ii', 'hpdp.konkoly', + ['hpdp.cam_sato', 'hpdp.cambendo', 'hpdp.chopc2i', 'hpdp.chopc2ii', 'hpdp.compkon', + 'hpdp.evolkon','hpdp.extrakon', 'hpdp.kon3p6i', 'hpdp.kon3p6ii', 'hpdp.konkoly', 'hpdp.lwsasti', 'hpdp.lwsastii', 'hpdp.misckon', 'hpdp.p32_c200', 'hpdp.p32virgo', - 'hpdp.scanskon', 'hpdp.sloansws', 'hpdp.solarkon', 'hpdp.sws01hrd', 'hpdp.ysokon', - 'tap_config.coord_sys', 'ida.dqr', 'ida.dqrflags', 'ida.footprints', 'ida.fov_info', - 'ida.iasd_line', 'ida.iso_wcs_info', 'ida.observers', 'ida.postcards', 'ida.proposals', - 'ida.usredata', 'ida.usredata_files', 'ida.object_type', 'ida.observations', - 'tap_schema.columns', 'tap_schema.key_columns', 'tap_schema.keys', 'tap_schema.schemas', - 'tap_schema.tables', 'ivoa.obscore', - 'ivoa.siap', 'ivoa.ssap'] + 'hpdp.scanskon', 'hpdp.sloansws', 'hpdp.solarkon','hpdp.sws01hrd', 'hpdp.ysokon', + 'tap_config.coord_sys', 'tap_schema.columns', 'tap_schema.key_columns','tap_schema.keys', + 'tap_schema.schemas', 'tap_schema.tables', 'ida.aph', 'ida.cam_expert', 'ida.cam_measurement', + 'ida.dqr', 'ida.dqrflags', 'ida.iasd_line', 'ida.lws_expert', 'ida.lws_extras', 'ida.lws_lsan', + 'ida.lws_measurement','ida.obs_pointing', 'ida.observers', 'ida.pht_expert', 'ida.postcards', + 'ida.proposals', 'ida.publication_authors', 'ida.sws_common', 'ida.sws_expert', 'ida.usredata', + 'ida.usredata_files', 'ida.object_type', 'ida.observations', 'ida.publications', 'ida.publications_observations', + 'ivoa.obscore', 'ivoa.siap', 'ivoa.ssap'] This will show the available tables in ISO TAP service in the ISO Data Archive. @@ -227,22 +235,21 @@ This will show the available tables in ISO TAP service in the ISO Data Archive. 4. Getting columns details of ISO TAP ------------------------------------- -.. code-block:: python - - >>> from astroquery.esa.iso import ISO - >>> ISO.get_columns('ida.observations') +.. doctest-remote-data:: + >>> from astroquery.esa.iso import ISO + >>> ISO.get_columns('ida.observations') # doctest: +IGNORE_OUTPUT INFO: Retrieving tables... [astroquery.utils.tap.core] INFO: Parsing tables... [astroquery.utils.tap.core] INFO: Done. [astroquery.utils.tap.core] - ['aotname', 'bp_valid', 'cal_flag', 'cam_par_flag', 'cdec', 'cra', 'croll', 'dec', - 'default_vo_product', 'display', 'dist_status','ehalind', 'end_time', 'fov', - 'hpdp_available', 'instid', 'instrument_mode', 'object_type', 'obsid', 'obsno', - 'obsno_char', 'osn', 'ott', 'prodqlty', 'propid', 'qltyver', 'ra', 'revno', 's_region', - 's_region_fov', 'start_time', 'target', 'targetno', 'tdt', 'tdt_char', 'type', - 'usredata_available', 'utc_end', 'utc_start', 'wavelengths'] - -This will show the column details of the table 'ida.observations' in ISO TAP service + ['aotname', 'bp_valid', 'cal_flag', 'cam_par_flag', 'caveat', 'cdec', 'comment', 'cra', 'croll', + 'dec', 'default_vo_product', 'display', 'dist_status', 'ehalind', 'end_time', 'fov', 'hpdp_available', + 'instid', 'instrument_mode', 'num_publications', 'object_type', 'obsid', 'obsno', 'obsno_char', 'osn', + 'ott', 'prodqlty', 'propid', 'qltyver', 'ra', 'ra_deg', 'revno', 's_region', 's_region_fov', 'speed', + 'start_time', 'target', 'targetno', 'tdt', 'tdt_char', 'type', 'usredata_available', 'utc_end', 'utc_start', 'wavelengths'] + + +This will show the column details of the table 'ida.observations' in ISO TAP service in the ISO Data Archive. @@ -250,7 +257,7 @@ in the ISO Data Archive. 4. Working with ISO VO tables ------------------------------------- -ISO provides Virtual Observatory compatible products and tables. Three different VO +ISO provides Virtual Observatory compatible products and tables. Three different VO compatible tables are provided: * ivoa.obscore: Compatible with the IVOA Obscore data model format @@ -259,62 +266,59 @@ compatible tables are provided: All these tables can be queried using the TAP interface and allow geometrical queries. -.. code-block:: python +.. doctest-remote-data:: - >>> # First we obtain the coordinates of a certain object (M31) in degrees + >>> from astroquery.esa.iso import ISO >>> from astropy import units as u >>> from astropy.coordinates import SkyCoord >>> from astroquery.simbad import Simbad + >>> + >>> # First we obtain the coordinates of a certain object (M31) in degrees >>> result_table = Simbad.query_object("M31") - >>> print(result_table) + >>> print(result_table) # doctest: +IGNORE_OUTPUT + MAIN_ID RA DEC ... COO_WAVELENGTH COO_BIBCODE + "h:m:s" "d:m:s" ... + ------- ------------ ------------ ... -------------- ------------------- + M 31 00 42 44.330 +41 16 07.50 ... I 2006AJ....131.1163S >>> c = SkyCoord(result_table['RA'], result_table['DEC'], unit=(u.hourangle, u.deg), - >>> frame='icrs') + ... frame='icrs') >>> ra = str(c.ra.degree[0]) >>> dec = str(c.dec.degree[0]) - - MAIN_ID RA DEC ... COO_WAVELENGTH COO_BIBCODE - "h:m:s" "d:m:s" ... - ------- ------------ ------------ ... -------------- ------------------- - M 31 00 42 44.330 +41 16 07.50 ... I 2006AJ....131.1163S - + >>> >>> # Then we use these coordinates to discover spectral data - >>> from astroquery.esa.iso import ISO - >>> table=ISO.query_ida_tap(query="SELECT target_name, ra, dec, reference " + - >>> "FROM ivoa.ssap WHERE " + - >>> "INTERSECTS(CIRCLE('ICRS'," + ra + "," + dec + - >>> ",0.08333333333333333)," + - >>> "s_region_fov)=1") - >>> table.pprint_all() - target_name ra dec reference - ------------------------------------ ------------ -------- ----------------------------------------------------------------------------------- - ISO LWS01 Spectrum Target: M31_BULGE 10.69170999 41.26998 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580021020 - ISO SWS01 Spectrum Target: M31_BULGE 10.6917 41.26997 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=400015010 - ISO LWS01 Spectrum Target: M31 10.684999995 41.26902 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580020010 - ISO LWS01 Spectrum Target: M31N 10.80459 41.38386 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=602020050 - - + >>> table = ISO.query_ida_tap(query="SELECT target_name, ra, dec, reference " + + ... "FROM ivoa.ssap WHERE " + + ... "INTERSECTS(CIRCLE('ICRS'," + ra + "," + dec + + ... ",0.08333333333333333)," + + ... "s_region_fov)=1") + >>> table.pprint_all() # doctest: +IGNORE_OUTPUT + target_name ra dec reference + ------------------------------------ ------------ -------- ----------------------------------------------------------------------------------- + ISO SWS01 Spectrum Target: M31_BULGE 10.6917 41.26997 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=400015010 + ISO LWS01 Spectrum Target: M31_BULGE 10.69170999 41.26998 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580021020 + ISO LWS01 Spectrum Target: M31 10.684999995 41.26902 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580020010 + ISO LWS01 Spectrum Target: M31N 10.80459 41.38386 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=602020050 This query displays spectra with a field of view that overlaps with the central point of M31. Same can be done to discover images M31 images: -.. code-block:: python +.. doctest-remote-data:: >>> # We use again the coordinates to discover image data - >>> table=ISO.query_ida_tap(query="SELECT image_title, ra, dec, access_url " + - ... "FROM ivoa.siap WHERE " + - ... "INTERSECTS(CIRCLE('ICRS'," + ra + "," + dec + - ... ",0.08333333333333333)," + + >>> table = ISO.query_ida_tap(query="SELECT image_title, ra, dec, access_url " + + ... "FROM ivoa.siap WHERE " + + ... "INTERSECTS(CIRCLE('ICRS'," + ra + "," + dec + + ... ",0.08333333333333333)," + ... "s_region_fov)=1") >>> table.pprint_all() - - image_title ra dec access_reference - deg deg - ------------------------------- -------- -------- ----------------------------------------------------------------------------------- - ISO CAM01 Image Target: M31_LW2 10.68375 41.26945 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583024020 - ISO CAM01 Image Target: M31_LW1 10.68375 41.26944 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583025040 - ISO CAM01 Image Target: M31_LW6 10.68375 41.26945 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583023050 - ISO CAM01 Image Target: M31_LW3 10.68375 41.26945 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583027030 + image_title ra dec access_url + deg deg + ------------------------------- -------- -------- ----------------------------------------------------------------------------------- + ISO CAM01 Image Target: M31_LW2 10.68375 41.26945 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583024020 + ISO CAM01 Image Target: M31_LW1 10.68375 41.26944 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583025040 + ISO CAM01 Image Target: M31_LW6 10.68375 41.26945 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583023050 + ISO CAM01 Image Target: M31_LW3 10.68375 41.26945 http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=583027030 ------------------------------------- 4. Working with ISO VO products @@ -323,34 +327,26 @@ Either by invocation of the URL provided in every row of previous section or usi Images can be displayed by using the following code: -.. code-block:: python +.. Skipping plotting example +.. doctest-skip:: - >>> #How to display an ISO image >>> from astroquery.esa.iso import ISO - >>> ISO.download_data('80001538', retrieval_type="STANDALONE", - ... filename="80001538") >>> from astropy.io import fits + >>> import matplotlib >>> from matplotlib import pyplot as plt - >>> f = fits.open('80001538.fits') + >>> from matplotlib.colors import LogNorm + >>> + >>> ISO.download_data('80001538', retrieval_type="STANDALONE", + ... filename="80001538") + '80001538.fits' + >>> f = fits.open('80001538.fits') # doctest: +IGNORE_WARNINGS >>> f.info() - - INFO: Copying file to 80001538.fits... [astroquery.esa.iso.core] Filename: 80001538.fits No. Name Ver Type Cards Dimensions Format - 0 PRIMARY 1 PrimaryHDU 75 (32, 32) float32 - - >>> # The image is in the primary extension - >>> image_data = f[0].data + 0 PRIMARY 1 PrimaryHDU 75 (32, 32) float32 + >>> image_data = f[0].data # The image is in the primary extension >>> f.close() >>> - >>> # Set up matplotlib and use a nicer set of plot parameters - >>> %config InlineBackend.rc = {} - >>> import matplotlib - >>> import matplotlib.pyplot as plt - >>> from matplotlib.colors import LogNorm - >>> - >>> #We configure the plot to be interactive - >>> # matplotlib widget >>> plt.ion() >>> plt.imshow(image_data, cmap='Reds') >>> plt.colorbar() @@ -360,73 +356,71 @@ Images can be displayed by using the following code: :alt: Dynamic exploration of CAM images in python - And spectra can be displayed by using the following code: -.. code-block:: python - - >>> # Search for M31 spectra - >>> from astroquery.esa.iso import ISO - >>> table=ISO.query_ida_tap(query="SELECT target_name, ra, dec, " + - ... "axes, units, reference FROM ivoa.ssap " + - ... "WHERE " + - ... "INTERSECTS(CIRCLE('ICRS',10.68470833,41.26875," + - ... "0.08333333333333333)," + - ... "s_region_fov)=1") - - >>> table.pprint_all() - target_name ra dec axes units reference - ------------------------------------ ------------ -------- --------- ------------------------- ----------------------------------------------------------------------------------- - ISO LWS01 Spectrum Target: M31_BULGE 10.69170999 41.26998 WAVE FLUX microns watts/cm^2/micron http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580021020 - ISO SWS01 Spectrum Target: M31_BULGE 10.6917 41.26997 WAVE FLUX um Jy http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=400015010 - ISO LWS01 Spectrum Target: M31 10.684999995 41.26902 WAVE FLUX microns watts/cm^2/micron http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580020010 - ISO LWS01 Spectrum Target: M31N 10.80459 41.38386 WAVE FLUX microns watts/cm^2/micron http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=602020050 +.. Skipping plotting example +.. doctest-skip:: - >>> # Download using the ISO astroquery module - >>> ISO.download_data('58002102', retrieval_type="STANDALONE", filename="58002102") - >>> - >>> # Download using the SSAP table URL invocation (both are equivalent) + >>> from astroquery.esa.iso import ISO >>> import urllib.request - >>> urllib.request.urlretrieve('http://nida.esac.esa.int/nida-sl-tap/data?' + - ... 'RETRIEVAL_TYPE=STANDALONE&obsno=580020010', - ... '58002102.fits') - - >>> # Opening the spectral fits file using astropy modules >>> from astropy.io import fits >>> from astropy import units as u >>> import numpy as np >>> from matplotlib import pyplot as plt >>> from astropy.visualization import quantity_support + >>> from specutils import Spectrum1D + >>> + >>> # Search for M31 spectra + >>> table=ISO.query_ida_tap(query="SELECT target_name, ra, dec, " + + ... "axes, units, reference FROM ivoa.ssap " + + ... "WHERE " + + ... "INTERSECTS(CIRCLE('ICRS',10.68470833,41.26875," + + ... "0.08333333333333333)," + + ... "s_region_fov)=1") + >>> table.pprint_all() + target_name ra dec axes units reference + ------------------------------------ ------------ -------- --------- ------------ ----------------------------------------------------------------------------------- + ISO SWS01 Spectrum Target: M31_BULGE 10.6917 41.26997 WAVE FLUX um Jy http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=400015010 + ISO LWS01 Spectrum Target: M31_BULGE 10.69170999 41.26998 WAVE FLUX um W/cm^2/um http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580021020 + ISO LWS01 Spectrum Target: M31 10.684999995 41.26902 WAVE FLUX um W/cm^2/um http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=580020010 + ISO LWS01 Spectrum Target: M31N 10.80459 41.38386 WAVE FLUX um W/cm^2/um http://nida.esac.esa.int/nida-sl-tap/data?RETRIEVAL_TYPE=STANDALONE&obsno=602020050 + >>> # Download using the ISO astroquery module + >>> ISO.download_data('58002102', retrieval_type="STANDALONE", filename="58002102") # doctest: +IGNORE_OUTPUT + >>> + >>> # Download using the SSAP table URL invocation (both are equivalent) + >>> urllib.request.urlretrieve('http://nida.esac.esa.int/nida-sl-tap/data?' + + ... 'RETRIEVAL_TYPE=STANDALONE&obsno=580020010', + ... '58002102.fits') # doctest: +IGNORE_OUTPUT + ('58002102.fits', ) + >>> # Opening the spectral fits file using astropy modules >>> quantity_support() - >>> f = fits.open('58002102.fits') + .MplQuantityConverter object at 0x11c1a9d60> + >>> f = fits.open('58002102.fits') >>> f.info() Filename: 58002102.fits No. Name Ver Type Cards Dimensions Format - 0 PRIMARY 1 PrimaryHDU 37 () - 1 1 TableHDU 39 958R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 2 1 TableHDU 39 962R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 3 1 TableHDU 39 962R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 4 1 TableHDU 39 961R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 5 1 TableHDU 39 958R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 6 1 TableHDU 39 961R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 7 1 TableHDU 39 959R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 8 1 TableHDU 39 959R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 9 1 TableHDU 39 959R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - 10 1 TableHDU 39 962R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 0 PRIMARY 1 PrimaryHDU 37 () + 1 1 TableHDU 39 958R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 2 1 TableHDU 39 962R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 3 1 TableHDU 39 962R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 4 1 TableHDU 39 961R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 5 1 TableHDU 39 958R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 6 1 TableHDU 39 961R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 7 1 TableHDU 39 959R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 8 1 TableHDU 39 959R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 9 1 TableHDU 39 959R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] + 10 1 TableHDU 39 962R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] 11 1 TableHDU 39 963R x 8C [F8.4, E11.3, E11.3, I2, I2, I2, I2, A42] - >>> # The spectrum is in the first HDU of this file. >>> specdata = f[1].data >>> f.close() - >>> from specutils import Spectrum1D >>> lamb = specdata['WAVE'] * u.um >>> flux = specdata['FLUX'] * u.Unit('W cm-2 um-1') >>> spec = Spectrum1D(spectral_axis=lamb, flux=flux) - >>> # matplotlib widget >>> plt.ion() - >>> f, ax = plt.subplots() - >>> ax.step(spec.spectral_axis, spec.flux) - + >>> f, ax = plt.subplots() + >>> ax.step(spec.spectral_axis, spec.flux) + [] .. figure:: images/spectradynamicDisplay.png :scale: 50% diff --git a/docs/esa/jwst/jwst.rst b/docs/esa/jwst/jwst.rst index f29710f991..9b5d2323fb 100644 --- a/docs/esa/jwst/jwst.rst +++ b/docs/esa/jwst/jwst.rst @@ -430,7 +430,7 @@ Query without saving results in a file: Output file: 1655977738493O-result.vot.gz Results: None >>> result = job.get_results() - >>> result + >>> result # doctest: +IGNORE_OUTPUT
instrument_name proposal_id calibrationlevel dataproducttype object object int32 object @@ -460,7 +460,7 @@ Query saving results in a file: Output file: 1655978085454O-result.vot.gz Results: None >>> result = job.get_results() - >>> result + >>> result # doctest: +IGNORE_OUTPUT
instrument_name proposal_id calibrationlevel dataproducttype object object int32 object @@ -518,7 +518,7 @@ Query without saving results in a file: Output file: async_20181116165244.vot Results: None >>> r = job.get_results() - >>> r['observationid'] + >>> r['observationid'] # doctest: +IGNORE_OUTPUT jw01070001002_04101_00003_nrca1 jw01070001002_04101_00003_nrca1 @@ -540,7 +540,7 @@ Query saving results in a file: Output file: 1635853688471D-result.vot.gz Results: None >>> r = job.get_results() - >>> r['instrument_name'] + >>> r['instrument_name'] # doctest: +IGNORE_OUTPUT NIRCAM NIRCAM diff --git a/docs/esa/xmm_newton/xmm_newton.rst b/docs/esa/xmm_newton/xmm_newton.rst index c6fa76aeea..d7a3ae2a55 100644 --- a/docs/esa/xmm_newton/xmm_newton.rst +++ b/docs/esa/xmm_newton/xmm_newton.rst @@ -1,5 +1,3 @@ -.. doctest-skip-all - .. _astroquery.esa.xmm_newton: **************************************************** @@ -7,12 +5,12 @@ ESA XMM-Newton Archive (`astroquery.esa.xmm_newton`) **************************************************** -The X-ray Multi-Mirror Mission, XMM-Newton, is an ESA X-ray observatory launched on 10 December 1999. -It carries 3 high-throughput X-ray telescopes with unprecedented effective area and an Optical Monitor, +The X-ray Multi-Mirror Mission, XMM-Newton, is an ESA X-ray observatory launched on 10 December 1999. +It carries 3 high-throughput X-ray telescopes with unprecedented effective area and an Optical Monitor, the first flown on an X-ray observatory. -This package allows the access to the `XMM-Newton Science Archive `__. -It has been developed by the ESAC Science Data Centre (ESDC) with requirements provided by the +This package allows the access to the `XMM-Newton Science Archive `__. +It has been developed by the ESAC Science Data Centre (ESDC) with requirements provided by the XMM-Newton Science Operations Centre. ======== @@ -23,15 +21,18 @@ Examples 1. Getting XMM-Newton data -------------------------- -.. code-block:: python +.. Skipping becuase the download takes too long +.. doctest-skip:: >>> from astroquery.esa.xmm_newton import XMMNewton >>> - >>> XMMNewton.download_data('0505720401',level="PPS",extension="PDF",instname="M1",filename="result0505720401.tar") - INFO: File result0505720401.tar downloaded to current directory [astroquery.esa.xmm_newton.core] + >>> XMMNewton.download_data('0505720401', level="PPS" ,extension="PDF", instname="M1", + ... filename="result0505720401") # doctest: +IGNORE_OUTPUT + Downloading URL https://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?obsno=0505720401&level=PPS&extension=PDF&instname=M1 to result0505720401.tar ... + |==============================================================| 7.4M/7.4M (100.00%) 9s -This will download all PPS files for the observation '0505720401' and instrument MOS1, with 'PDF' extension and -it will store them in a tar called 'result0505720401.tar'. The parameters available are detailed in the API. +This will download all PPS files for the observation '0505720401' and instrument MOS1, with 'PDF' extension and +it will store them in a tar called 'result0505720401.tar'. The parameters available are detailed in the API. For more details of the parameters check the section 3.4 at: 'http://nxsa.esac.esa.int/nxsa-web/#aio' @@ -53,11 +54,13 @@ variable to the XMMNewton.download_data method called credentials_file. This var If the credentials_file variable is not provided the method will ask for the username and password to be added manually from the commandline -.. code-block:: python +.. Skipping proprietary example +.. doctest-skip:: >>> from astroquery.esa.xmm_newton import XMMNewton >>> - >>> XMMNewton.download_data('0505720401',level="PPS",extension="PDF",instname="M1",filename="result0505720401.tar",prop=True) + >>> XMMNewton.download_data('0505720401', level="PPS", extension="PDF", instname="M1", + ... filename="result0505720401.tar", prop=True) INFO: File result0505720401.tar downloaded to current directory [astroquery.esa.xmm_newton.core] This will download all PPS files for the observation '0505720401' and instrument MOS1, with 'PDF' extension and any @@ -67,11 +70,11 @@ proprietary data. It will store them in a tar called 'result0505720401.tar'. 3. Getting XMM-Newton postcards ------------------------------- -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.xmm_newton import XMMNewton >>> - >>> XMMNewton.get_postcard('0505720401') + >>> XMMNewton.get_postcard('0505720401') # doctest: +IGNORE_OUTPUT INFO: File P0505720401EPX000OIMAGE8000.PNG downloaded to current directory [astroquery.esa.xmm_newton.core] 'P0505720401EPX000OIMAGE8000.PNG' @@ -85,67 +88,66 @@ This will download the EPIC postcard for the observation '0505720401' and it wil This function provides access to the XMM-Newton Science Archive database using the Table Access Protocol (TAP) and via the Astronomical Data Query Language (ADQL). -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.xmm_newton import XMMNewton >>> - >>> result = XMMNewton.query_xsa_tap("select top 10 * from v_public_observations", output_format='csv', output_file='results10.csv') - >>> print(result) + >>> result = XMMNewton.query_xsa_tap("select top 10 * from v_public_observations", + ... output_format='csv', output_file='results10.csv') + >>> print(result) # doctest: +IGNORE_OUTPUT bii dec duration ... target with_science -------------------- --------- -------- ... ---------------- ------------ - 4.1331178178373715 55.99944 32913 ... XTE J0421+560 true - 0.05069186370709437 -32.58167 17083 ... HD159176 true - 0.05069186370709437 -32.58167 9362 ... HD159176 true - 0.05069186370709437 -32.58167 10859 ... HD159176 true + 4.1331178178373715 55.99944 32913 ... XTE J0421+560 true + 0.05069186370709437 -32.58167 17083 ... HD159176 true + 0.05069186370709437 -32.58167 9362 ... HD159176 true + 0.05069186370709437 -32.58167 10859 ... HD159176 true -0.31119608673831345 6.135278 21939 ... HD47129 true -0.31119608673831345 6.135278 21863 ... HD47129 true - -51.687075256085755 10.68917 26609 ... IRAS F00235+1024 true - 73.04737400339847 10.18639 25192 ... IRAS F12514+1027 true - 46.71747372703565 -15.78639 12101 ... Denis-J1228 true - -15.881772371450268 -77.61555 33986 ... Cha-Ha-3 true + -51.687075256085755 10.68917 26609 ... IRAS F00235+1024 true + 73.04737400339847 10.18639 25192 ... IRAS F12514+1027 true + 46.71747372703565 -15.78639 12101 ... Denis-J1228 true + -15.881772371450268 -77.61555 33986 ... Cha-Ha-3 true -This will execute an ADQL query to download the first 10 observations in the XMM-Newton Science Archive. The result of the query will be +This will execute an ADQL query to download the first 10 observations in the XMM-Newton Science Archive. The result of the query will be stored in the file 'results10.csv'. The result of this query can be printed by doing print(result). - + ----------------------------------- 5. Getting table details of XSA TAP ----------------------------------- -.. code-block:: python +.. doctest-remote-data:: - >>> from astroquery.esa.xmm_newton import XMMNewton - >>> - >>> XMMNewton.get_tables() + >>> from astroquery.esa.xmm_newton import XMMNewton # doctest: +IGNORE_OUTPUT + >>> XMMNewton.get_tables() # doctest: +IGNORE_OUTPUT INFO: Retrieving tables... [astroquery.utils.tap.core] INFO: Parsing tables... [astroquery.utils.tap.core] INFO: Done. [astroquery.utils.tap.core] - ['tap_schema.columns', 'tap_schema.key_columns', 'tap_schema.keys', 'tap_schema.schemas', - 'tap_schema.tables', 'xsa.dual', 'xsa.v_all_observations', 'xsa.v_epic_source', - 'xsa.v_epic_source_cat', 'xsa.v_epic_xmm_stack_cat', 'xsa.v_exposure', 'xsa.v_instrument_mode', - 'xsa.v_om_source', 'xsa.v_om_source_cat', 'xsa.v_proposal', 'xsa.v_proposal_observation_info', - 'xsa.v_publication', 'xsa.v_publication_observation', 'xsa.v_publication_slew_observation', - 'xsa.v_public_observations', 'xsa.v_rgs_source', 'xsa.v_slew_exposure', 'xsa.v_slew_observation', - 'xsa.v_slew_source', 'xsa.v_slew_source_cat', 'xsa.v_target_type', 'xsa.v_uls_exposure_image', + ['tap_schema.columns', 'tap_schema.key_columns', 'tap_schema.keys', 'tap_schema.schemas', + 'tap_schema.tables', 'xsa.dual', 'xsa.v_all_observations', 'xsa.v_epic_source', + 'xsa.v_epic_source_cat', 'xsa.v_epic_xmm_stack_cat', 'xsa.v_exposure', 'xsa.v_instrument_mode', + 'xsa.v_om_source', 'xsa.v_om_source_cat', 'xsa.v_proposal', 'xsa.v_proposal_observation_info', + 'xsa.v_publication', 'xsa.v_publication_observation', 'xsa.v_publication_slew_observation', + 'xsa.v_public_observations', 'xsa.v_rgs_source', 'xsa.v_slew_exposure', 'xsa.v_slew_observation', + 'xsa.v_slew_source', 'xsa.v_slew_source_cat', 'xsa.v_target_type', 'xsa.v_uls_exposure_image', 'xsa.v_uls_slew_exposure_image'] This will show the available tables in XSA TAP service in the XMM-Newton Science Archive. - + ------------------------------------- 6. Getting columns details of XSA TAP ------------------------------------- -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.xmm_newton import XMMNewton - >>> - >>> XMMNewton.get_columns('public.v_all_observations') + >>> XMMNewton.get_columns('xsa.v_all_observations') # doctest: +IGNORE_OUTPUT INFO: Retrieving tables... [astroquery.utils.tap.core] INFO: Parsing tables... [astroquery.utils.tap.core] INFO: Done. [astroquery.utils.tap.core] - ['bii', 'citext', 'dec', 'duration', 'end_utc', 'footprint_fov', 'heasarc_code', 'lii', 'moving_target', - 'observation_equatorial_spoint', 'observation_fov_scircle', 'observation_galactic_spoint', 'observation_id', - 'observation_oid', 'odf_proc_date', 'odf_version', 'position_angle', 'pps_proc_date', 'pps_version', 'proposal_id', - 'proposal_oid', 'proprietary_end_date', 'ra', 'ra_nom', 'revolution', 'sas_version', 'start_utc', 'stc_s', 'with_science'] + ['bii', 'citext', 'dec', 'duration', 'end_utc', 'footprint_fov', 'heasarc_code', 'lii', 'moving_target', + 'observation_equatorial_spoint', 'observation_fov_scircle', 'observation_galactic_spoint', 'observation_id', + 'observation_oid', 'odf_proc_date', 'odf_version', 'position_angle', 'pps_proc_date', 'pps_version', 'proposal_id', + 'proposal_oid', 'proprietary_end_date', 'ra', 'ra_nom', 'revolution', 'sas_version', 'seq_id', 'start_utc', 'stc_s', 'with_science'] This will show the column details of the table 'v_all_observations' in XSA TAP service in the XMM-Newton Science Archive. @@ -153,11 +155,12 @@ This will show the column details of the table 'v_all_observations' in XSA TAP s 7. Getting EPIC images from a given TAR file -------------------------------------------- -.. code-block:: python +.. Skipping becuase the download takes too long +.. doctest-skip:: >>> from astroquery.esa.xmm_newton import XMMNewton >>> - >>> XMMNewton.download_data('0405320501') + >>> XMMNewton.download_data('0405320501') # doctest: +IGNORE_OUTPUT Downloading URL http://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?obsno=0405320501 to 0405320501.tar ... |===================================================================================================================================================| 540M/540M (100.00%) 57s >>> XMMNewton.get_epic_images('0405320501.tar', band=[1,2], instrument=['M1']) @@ -180,10 +183,9 @@ The EPIC metadata can be found in four tables in the XSA TAP: - xsa.v_epic_xmm_stack_cat - xsa.v_slew_source_cat -.. code-block:: python +.. doctest-remote-data:: >>> from astroquery.esa.xmm_newton import XMMNewton - >>> >>> epic_source, cat_4xmm, stack_4xmm, slew_source = XMMNewton.get_epic_metadata(target_name="4XMM J122934.7+015657") This will return the metadata within the four TAP tables in four `~astropy.table.Table` for the given target.