.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_tutorials/extension/vizier.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_tutorials_extension_vizier.py: ######################### Setting Survey Parameters ######################### The Survey File =============== ATK stores all survey parameters in a file, which can be opened either from the commandline: .. code-block:: console $ ATKsurvey open or from inside a script: .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG.open() | To see the current state of the **survey file**, use: .. code-block:: console $ ATKsurvey show .. GENERATED FROM PYTHON SOURCE LINES 29-34 .. code-block:: Python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG.show() .. rst-class:: sphx-glr-script-out .. code-block:: none [vizier] id = I/355/gaiadr3 epoch = 2016-01-01T00:00:00.000 mags: Gmag, BPmag, RPmag errors: e_Gmag, e_BPmag, e_RPmag lon = RA_ICRS lat = DE_ICRS frame = icrs id = II/335/galex_ais epoch = 2006-08-01T00:00:00.000 mags: NUVmag, FUVmag errors: e_NUVmag, e_FUVmag lon = RAJ2000 lat = DEJ2000 frame = icrs id = II/311/wise epoch = 2010-06-01T00:00:00.000 mags: W1mag, W2mag, W3mag, W4mag errors: e_W1mag, e_W2mag, e_W3mag, e_W4mag lon = RAJ2000 lat = DEJ2000 frame = icrs id = V/154/sdss16 epoch = 2006-01-01T00:00:00.000 mags: uPmag, gPmag, rPmag, iPmag, zPmag errors: e_uPmag, e_gPmag, e_rPmag, e_iPmag, e_zPmag lon = RA_ICRS lat = DE_ICRS frame = icrs <2mass> id = II/246/out epoch = 1999-01-01T00:00:00.000 mags: Jmag, Hmag, Kmag errors: e_Jmag, e_Hmag, e_Kmag lon = RAJ2000 lat = DEJ2000 frame = icrs id = II/379/smssdr4 epoch = 2016-01-01T00:00:00.000 mags: gPSF, rPSF, iPSF, zPSF, uPSF, vPSF errors: e_gPSF, e_rPSF, e_iPSF, e_zPSF, e_uPSF, e_vPSF lon = RAICRS lat = DEICRS frame = icrs id = II/349/ps1 epoch = 2012-01-01T00:00:00.000 mags: gmag, rmag, imag, zmag, ymag errors: e_gmag, e_rmag, e_imag, e_zmag, e_ymag lon = RAJ2000 lat = DEJ2000 frame = icrs id = IX/11/rosatsrc epoch = 1991-01-01T00:00:00.000 lon = RAJ2000 lat = DEJ2000 frame = icrs id = J/A+A/682/A34/erass1-m epoch = 2022-01-01T00:00:00.000 lon = RA_ICRS lat = DE_ICRS frame = icrs [image] epoch = 2012-01-01T00:00:00.000 epoch = 2016-01-01T00:00:00.000 epoch = 1955-01-01T00:00:00.000 epoch = 1990-01-01T00:00:00.000 epoch = 2010-01-01T00:00:00.000 <2mass> epoch = 1999-01-01T00:00:00.000 epoch = 2005-01-01T00:00:00.000 [lightcurve] epoch = 2019-01-01T00:00:00.000 epoch = 2016-01-01T00:00:00.000 epoch = 2015-01-01T00:00:00.000 epoch = 2008-01-01T00:00:00.000 epoch = 2020-01-01T00:00:00.000 [spectrum] epoch = 2017-01-01T00:00:0.000 epoch = 2020-01-01T00:00:00.000 .. GENERATED FROM PYTHON SOURCE LINES 44-50 | | Adding a Catalogue Alias ======================== Any `Vizier `_ catalogue can be immediately accessed by passing its catalogue ID to :func:`~ATK.Tools.query`: .. GENERATED FROM PYTHON SOURCE LINES 50-56 .. code-block:: Python from ATK import query allwise_query = query("vizier", targets=2552928187080872832, survey="II/328/allwise") .. GENERATED FROM PYTHON SOURCE LINES 60-95 | However, it may become tedious to remember catalogue IDs in prolonged workloads. Additionally, and perhaps more importantly, **the above does not benefit from proper motion correction as ATK doesn't know the catalogue's epoch.** Both of these problems can be solved by adding a catalogue alias to the **survey file**. In this tutorial, :func:`~ATK.Tools.query` will be extended with **AllWISE**. | Editing the Survey File ----------------------- To add an **AllWISE** alias, the following must be added to the **survey file**, under ``vizier``: .. code-block:: console allwise id = II/328/allwise | This can be done manually by opening **survey file** in the default text editor, or by setting it directly: .. code-block:: console $ ATKsurvey set vizier allwise --id II/328/allwise .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG["vizier"]["allwise"]["id"] = "II/328/allwise" | Testing the New Alias --------------------- .. GENERATED FROM PYTHON SOURCE LINES 95-102 .. code-block:: Python from ATK import query target = 2552928187080872832 allwise_query = query("vizier", targets=target, survey="allwise", path="allwise_data_1.fits.gz") allwise_query.show() .. rst-class:: sphx-glr-script-out .. code-block:: none .kind: vizier .targets: 2552928187080872832 | 12.297° 5.377° (icrs, 2016-01-01T00:00:00.000, 3.0″) .exception: False .data: Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store() .. GENERATED FROM PYTHON SOURCE LINES 109-122 | The new alias is working, but **the query has not returned any data.** This is because **no epoch information has been added.** This can be amended by setting the ``epoch`` key with the median epoch of **AllWISE** (approximately ``2010-05-01T00:00:00.000``): .. code-block:: console $ ATKsurvey set vizier allwise --epoch 2010-05-01T00:00:00.000 .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG["vizier"]["allwise"]["epoch"] = "2010-05-01T00:00:00.000" .. GENERATED FROM PYTHON SOURCE LINES 124-127 | **Upon running the same query again, data is now returned:** .. GENERATED FROM PYTHON SOURCE LINES 127-134 .. code-block:: Python from ATK import query target = 2552928187080872832 allwise_query = query("vizier", targets=target, survey="allwise", path="allwise_data_2.fits.gz") allwise_query.show() .. rst-class:: sphx-glr-script-out .. code-block:: none .kind: Record .targets: 2552928187080872832 | 12.297° 5.377° (icrs, 2016-01-01T00:00:00.000, 3.0″) .exception: False .data: survey: allwise catalogue: II/328/allwise correction: full search_pos: 12.295° 5.381° (icrs, 2010-05-01T00:00:00.000) table: (astropy.Table) AllWISE: [J004910.78+052249.8] RAJ2000: [12.295] ° DEJ2000: [5.381] ° eeMaj: [0.038] ″ eeMin: [0.036] ″ eePA: [61.5] ° Im: [Im] W1mag: [11.40999984741211] mag e_W1mag: [0.023000000044703484] mag W2mag: [11.357000350952148] mag e_W2mag: [0.019999999552965164] mag W3mag: [11.380000114440918] mag e_W3mag: [0.19699999690055847] mag W4mag: [8.880000114440918] mag e_W4mag: [nan] mag Jmag: [nan] mag e_Jmag: [nan] mag Hmag: [nan] mag e_Hmag: [nan] mag Kmag: [nan] mag e_Kmag: [nan] mag wx: [1675.304] pix wy: [274.91] pix ID: [121106001351004903] snr1: [47.6] chi2W1: [10.199999809265137] snr2: [53.5] chi2W2: [5.179999828338623] snr3: [5.5] chi2W3: [1.0] snr4: [-0.8] chi2W4: [0.8550000190734863] chi2: [5.239999771118164] nb: [1] na: [0] sat1: [0.0] sat2: [0.0] sat3: [0.0] sat4: [0.0] ccf: [0000] ex: [1] var: [20nn] nW1: [23] mW1: [23] nW2: [20] mW2: [20] nW3: [2] mW3: [13] nW4: [0] mW4: [13] satnum: [0] RA_pm: [12.295] ° e_RA_pm: [0.038] ″ DE_pm: [5.381] ° e_DE_pm: [0.038] ″ cosig_pm: [0.008] ″ pmRA: [367.0] mas yr⁻¹ e_pmRA: [49.0] mas yr⁻¹ pmDE: [-3180.0] mas yr⁻¹ e_pmDE: [49.0] mas yr⁻¹ chi2W1_pm: [3.890000104904175] chi2W2_pm: [1.5399999618530273] chi2W3_pm: [1.0099999904632568] chi2W4_pm: [0.8539999723434448] chi2pm: [2.0899999141693115] qpm: [2N004] qph: [AABU] fdet: [7] fmoon: [2333] covW1: [23.852] covW2: [20.877] covW3: [13.922] covW4: [13.867] 2Mkey: [nan] d2M: [nan] ″ 2M: [2M] Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store() .. GENERATED FROM PYTHON SOURCE LINES 138-162 | | Defining an Image Overlay ========================= The **AllWISE** `Vizier `_ catalogue alias added above can be extended into an image overlay definition by adding some extra information. **As a minimum, all overlay definitions require three columns for positional information: a longitude column, a latitude column, and a frame on which these are based.** In the case of **AllWISE**, this means adding the following: .. code-block:: console $ ATKsurvey set vizier allwise --lon RAJ2000 --lat DEJ2000 --frame icrs .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG["vizier"]["allwise"]["lon"] = "RAJ2000" SURVEY_CONFIG["vizier"]["allwise"]["lat"] = "DEJ2000" SURVEY_CONFIG["vizier"]["allwise"]["frame"] = "icrs" | Once these keys have been added, an **AllWISE** overlay can be requested in an image :func:`~ATK.Tools.query`: .. GENERATED FROM PYTHON SOURCE LINES 163-171 .. code-block:: Python from ATK import query import astropy.units as u target = 2552928187080872832 panstarrs_query = query("image", targets=target, survey="panstarrs", band="g", size=90*u.arcsec, overlays=["allwise"], path="image_data_1.fits.gz") panstarrs_query.open() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 186-206 | Adding Photometric Information ------------------------------ Providing positional information is already enough to generate corrected detections - but for photometric surveys like **AllWISE**, magnitude information can also be added by supplying a list of **magnitude** and **magnitude error** columns: .. code-block:: console $ ATKsurvey set vizier allwise --mags W1mag W2mag W3mag W4mag --errors e_W1mag e_W2mag e_W3mag e_W4mag .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG["vizier"]["allwise"]["mags"] = ["W1mag", "W2mag", "W3mag", "W4mag"] SURVEY_CONFIG["vizier"]["allwise"]["errors"] = ["e_W1mag", "e_W2mag", "e_W3mag", "e_W4mag"] | This turns the **AllWISE** detection overlay into a **photometric** detection overlay, which scales marker sizes with magnitude and adds photometric information to the hover interaction: .. GENERATED FROM PYTHON SOURCE LINES 206-211 .. code-block:: Python target = 2552928187080872832 panstarrs_query = query("image", targets=target, survey="panstarrs", band="g", size=90*u.arcsec, overlays=["allwise"], path="image_data_2.fits.gz") panstarrs_query.open() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 225-261 | | Additional Survey File Operations ================================= Resetting the Survey File ------------------------- To reset the **survey file** to its default state: .. code-block:: console $ ATKsurvey reset .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG.reset() | Deleting an Alias ----------------- To delete an alias (in this case the **AllWISE** alias created in this tutorial) from the **survey file**, either delete it from the commandline: .. code-block:: console $ ATKsurvey del allwise or set it to ``None``: .. code-block:: python from ATK.Config import SURVEY_CONFIG SURVEY_CONFIG["vizier"]["allwise"] = None .. GENERATED FROM PYTHON SOURCE LINES 263-268 | | | .. rubric:: Download this Tutorial .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.919 seconds) .. _sphx_glr_download_auto_tutorials_extension_vizier.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: vizier.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: vizier.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: vizier.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_