.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_tutorials/lightcurves/lightcurve_query.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_lightcurves_lightcurve_query.py: ######################### Working with Light Curves ######################### Performing a Light Curve Query ============================== Light curves can be fetched in the same way as in :doc:`previous tutorials <../getting_started/data_query>`. For this tutorial, an ASAS-SN query will be performed: .. GENERATED FROM PYTHON SOURCE LINES 9-15 .. code-block:: Python from ATK import query asassn_query = query("lightcurve", targets=6050296829033196032, survey="asassn", path="example_lightcurve.fits.gz") asassn_query.show(show_types=True) .. rst-class:: sphx-glr-script-out .. code-block:: none .kind (str): Lightcurve .targets (list): 6050296829033196032 | 245.447° -22.886° (icrs, 2016-01-01T00:00:00.000, 3.0″) .exception (bool): False .data (list): survey (str): asassn band (str): v correction (str): full search_pos (astropy.SkyCoord): 245.447° -22.886° (icrs, 2015-01-01T00:00:00.000) separation (astropy.Quantity): 0.026″ mjd (astropy.Quantity): [56783.46, 56785.411, ..., 58382.027, 58384.005] d mag (astropy.Quantity): [15.352, 14.668, ..., 14.913, 15.388] mag mag_err (astropy.Quantity): [0.022, 0.023, ..., 0.03, 0.038] mag ra (astropy.Quantity): [245.447, 245.447, ..., 245.447, 245.447] ° dec (astropy.Quantity): [-22.886, -22.886, ..., -22.886, -22.886] ° survey (str): asassn band (str): g correction (str): full search_pos (astropy.SkyCoord): 245.447° -22.886° (icrs, 2015-01-01T00:00:00.000) separation (astropy.Quantity): 0.026″ mjd (astropy.Quantity): [58143.538, 58145.531, ..., 60841.348, 60844.164] d mag (astropy.Quantity): [15.537, 15.752, ..., 15.134, 14.93] mag mag_err (astropy.Quantity): [0.066, 0.046, ..., 0.071, 0.016] mag ra (astropy.Quantity): [245.447, 245.447, ..., 245.447, 245.447] ° dec (astropy.Quantity): [-22.886, -22.886, ..., -22.886, -22.886] ° Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store() .. GENERATED FROM PYTHON SOURCE LINES 30-52 | The returned :class:`~ATK.Models.DataSet`'s :attr:`~ATK.Models.DataSet.data` attribute is a list of :class:`~ATK.Models.Lightcurve` objects (**one per photometric band per target, subject to data availability**). | .. note:: ATK supports queries to the following lightcurve surveys and bands: .. include:: supported_lightcurve_surveys.rst For a refresher on :func:`~ATK.Tools.query` fundamentals, see :doc:`previous tutorials <../getting_started/data_query>`. If the desired survey is not listed above, see :doc:`here <../extension/external_data>` for a tutorial on utilising external data. | | Plotting the Returned Data ========================== To plot a :class:`~ATK.Models.Lightcurve` and open it in the default browser: .. GENERATED FROM PYTHON SOURCE LINES 52-55 .. code-block:: Python asassn_query.open() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 65-75 .. note:: For a refresher on plotting fundamentals, see :doc:`previous tutorials <../images/image_query>`. | | Splitting by Survey ID ====================== **By default, light curves are returned as forced-photometry** (i.e. all photometric detections in the requested radius are returned as a single :class:`~ATK.Models.Lightcurve` per band). However, in some cases - e.g. in crowded regions or when using a large search radius - this assumption breaks down: .. GENERATED FROM PYTHON SOURCE LINES 75-82 .. code-block:: Python import astropy.units as u asassn_query = query("lightcurve", targets=587316166180416640, survey="asassn", radius = 60 * u.arcsec, path="example_lightcurve_2.fits.gz") asassn_query.show(show_types=True) asassn_query.open() .. rst-class:: sphx-glr-script-out .. code-block:: none .kind (str): Lightcurve .targets (list): 587316166180416640 | 141.185° 8.031° (icrs, 2016-01-01T00:00:00.000, 60.0″) .exception (bool): False .data (list): survey (str): asassn band (str): v correction (str): full search_pos (astropy.SkyCoord): 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation (astropy.Quantity): 36.096″ mjd (astropy.Quantity): [55946.483, 55954.478, ..., 58431.588, 58441.629] d mag (astropy.Quantity): [17.58, 17.911, ..., 17.287, 17.574] mag mag_err (astropy.Quantity): [0.152, 0.177, ..., 0.153, 0.164] mag ra (astropy.Quantity): [141.185, 141.185, ..., 141.201, 141.201] ° dec (astropy.Quantity): [8.031, 8.031, ..., 8.026, 8.026] ° survey (str): asassn band (str): g correction (str): full search_pos (astropy.SkyCoord): 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation (astropy.Quantity): 35.333″ mjd (astropy.Quantity): [58056.48, 58080.455, ..., 60704.982, 60706.938] d mag (astropy.Quantity): [17.774, 18.085, ..., 18.242, 18.153] mag mag_err (astropy.Quantity): [0.181, 0.204, ..., 0.19, 0.191] mag ra (astropy.Quantity): [141.185, 141.185, ..., 141.201, 141.201] ° dec (astropy.Quantity): [8.031, 8.031, ..., 8.026, 8.026] ° Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 92-95 | **It is clear that the returned** :class:`~ATK.Models.Lightcurve` **objects contain photometry of at least two stars.** In this case, it may be helpful to split the returned photometry by a per-survey observation/object ID. This can be done by passing ``split=True`` to :func:`~ATK.Tools.query`: .. GENERATED FROM PYTHON SOURCE LINES 95-101 .. code-block:: Python import astropy.units as u asassn_query = query("lightcurve", targets=587316166180416640, survey="asassn", radius = 60 * u.arcsec, split=True, path="example_lightcurve_3.fits.gz") asassn_query.show(show_all=True) .. rst-class:: sphx-glr-script-out .. code-block:: none .kind: Lightcurve .targets: 587316166180416640 | 141.185° 8.031° (icrs, 2016-01-01T00:00:00.000, 60.0″) .exception: False .data: survey: asassn band: v correction: full search_pos: 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation: 36.55″ obj_id: 103080678062 mjd: [55946.483, 55950.478, ..., 58446.596, 58447.606] d mag: [14.405, 14.491, ..., 14.446, 14.509] mag mag_err: [0.008, 0.011, ..., 0.048, 0.025] mag ra: [141.195, 141.195, ..., 141.195, 141.195] ° dec: [8.034, 8.034, ..., 8.034, 8.034] ° survey: asassn band: g correction: full search_pos: 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation: 36.55″ obj_id: 103080678062 mjd: [58054.5, 58055.488, ..., 60837.983, 60837.987] d mag: [14.596, 14.673, ..., 14.77, 14.678] mag mag_err: [0.028, 0.008, ..., 0.049, 0.03] mag ra: [141.195, 141.195, ..., 141.195, 141.195] ° dec: [8.034, 8.034, ..., 8.034, 8.034] ° survey: asassn band: v correction: full search_pos: 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation: 0.243″ obj_id: 661428731552 mjd: [55946.483, 55954.478, ..., 58407.619, 58431.588] d mag: [17.58, 17.911, ..., 17.3, 17.53] mag mag_err: [0.152, 0.177, ..., 0.179, 0.202] mag ra: [141.185, 141.185, ..., 141.185, 141.185] ° dec: [8.031, 8.031, ..., 8.031, 8.031] ° survey: asassn band: g correction: full search_pos: 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation: 0.243″ obj_id: 661428731552 mjd: [58056.48, 58080.455, ..., 60674.38, 60704.982] d mag: [17.774, 18.085, ..., 17.467, 18.217] mag mag_err: [0.181, 0.204, ..., 0.097, 0.188] mag ra: [141.185, 141.185, ..., 141.185, 141.185] ° dec: [8.031, 8.031, ..., 8.031, 8.031] ° survey: asassn band: v correction: full search_pos: 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation: 58.99″ obj_id: 661436975834 mjd: [55946.483, 55954.478, ..., 58431.588, 58441.629] d mag: [17.702, 17.777, ..., 17.287, 17.574] mag mag_err: [0.143, 0.161, ..., 0.153, 0.164] mag ra: [141.201, 141.201, ..., 141.201, 141.201] ° dec: [8.026, 8.026, ..., 8.026, 8.026] ° survey: asassn band: g correction: full search_pos: 141.185° 8.031° (icrs, 2015-01-01T00:00:00.000) separation: 58.99″ obj_id: 661436975834 mjd: [58056.48, 58059.471, ..., 60704.982, 60706.938] d mag: [17.605, 18.065, ..., 18.242, 18.153] mag mag_err: [0.158, 0.185, ..., 0.19, 0.191] mag ra: [141.201, 141.201, ..., 141.201, 141.201] ° dec: [8.026, 8.026, ..., 8.026, 8.026] ° Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store() .. GENERATED FROM PYTHON SOURCE LINES 105-114 | .. note:: By default, :meth:`~ATK.Models.DataSet.show` truncates printing of the :attr:`~ATK.Models.DataSet.data` attribute if it contains a large number of containers. This can be disabled by passing ``show_all=True`` to :meth:`~ATK.Models.DataSet.show`. | The split light curves can then be plotted in the same way as before - now producing a grid with three figures (one per unique source): .. GENERATED FROM PYTHON SOURCE LINES 114-117 .. code-block:: Python asassn_query.open() .. raw:: html
Bokeh Figure


.. GENERATED FROM PYTHON SOURCE LINES 127-145 .. warning:: As ``split`` utilises a per-survey object ID to separate detections, its efficacy depends heavily on the specific implementation provided by each survey. | | Data Quality Filtering ====================== By default, basic quality filtering is enabled for the following surveys: **ATLAS**: Filtering is performed as advised `here `_. **TESS**: ``Flux significance > 3``, ``quality flag = 0``. | To disable all **unrequired** filtering, pass ``filter=False`` to :func:`~ATK.Tools.query` when retrieving data from one the above surveys. .. GENERATED FROM PYTHON SOURCE LINES 147-152 | | | .. rubric:: Download this Tutorial .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.839 seconds) .. _sphx_glr_download_auto_tutorials_lightcurves_lightcurve_query.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: lightcurve_query.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: lightcurve_query.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: lightcurve_query.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_