/kanchay

A tool for measuring stellar rotation periods using light curves

Primary LanguageJupyter NotebookMIT LicenseMIT

kanchay

https://img.shields.io/badge/powered%20by-lightkurve-red https://img.shields.io/badge/powered%20by-starspot-red https://img.shields.io/badge/powered%20by-exoplanet-red

kanchay means light in the Inca–Andean–Quechua cosmovision. kanchay is a simple tool based on lightkurve, starspot and exoplanet codes to download light curves and measure their rotational periods using methods such as Lomb-Scargle Periodograms (LS), autocorrelation functions (ACFs), Phase Dispersion Minimization (PDM), and Gaussian Processes (GPs). Such methods are well described in starspot and exoplanet.

Installation

Installing kanchay requires only one step. Please run the following pip command:

pip install kanchay

Note that you will need Python (>=3.7-3.9) installed. If you already have terra installed, you should consider upgrading to the latest version via:

pip install kanchay --upgrade

Dependencies

The main dependencies of kanchay are lightkurve, starspot and exoplanet. However, there are other dependences such as PyMC3, PyMC3 Extras, and celerite2. To properly install these codes, we strongly recomend following the instructions shown below:

conda install -c conda-forge pymc3 theano-pymc mkl mkl-service
python -m pip install lightkurve --upgrade
python -m pip install -U exoplanet
python -m pip install -U celerite2
python -m pip install -U pymc3-ext

And finally install starspot from source:

git clone https://github.com/RuthAngus/starspot.git
cd starspot
python setup.py install

Aditionally, kanchay needs LaTex to generate light curve plots. Follow this link to install LaTex on Linux (linux mint, ubuntu, debian).

Note that kanchay requires of Pandas < 1.4.

Example usage

from kanchay import kan

# Search TESS light curves of a given star
# The tool downloads and plots all the SPOC light curves (LC) observed by TESS in several sectors
# The tool also normalizes and applies sigma clipping to the LCs. The resultant LC is stored in arrays in x (time), y (flux) and yerr (flux error).
starid='Gaia DR2 2395082091638750848'
x, y, yerr = kan.tess_lk(starid, exptime=120, author='SPOC')

# You can also plot a region of interest of the LC
import matplotlib.pyplot as plt
plt.scatter(x[0][2000:8500], y[0][2000:8500])

# You can determine rotational periods with only one command (thanks to the starspot code)
# The rotational period is estimated using three methods (LS, ACF, PDM)
kan.rotation_calc(x[0][2000:8500], y[0][2000:8500], yerr[0][2000:8500])

# You can also determine rotational periods using GP (thanks to the exoplanet code)
kan.rotation_calc(x[0][2000:8500], y[0][2000:8500], yerr[0][2000:8500], gp='yes')

#For more details please see the kanchay's tutorial

Contributing

kanchay is a simple tool created to help undergraduate students measure stellar rotational periods in an easy and simple way. Therefore, the tool needs input to improve. Please contact me (ramstojh@alumni.usp.br) if you have questions. Users are welcome to propose new features or report bugs by opening an issue on GitHub.

Authors

License & attribution

Copyright 2022, Jhon Yana Galarza.

The source code is made available under the terms of the MIT license.

If you make use of this code, please cite this package and its dependencies.