Skip to main content

A toolkit for Active Galactic Nuclei (AGN) time-series analysis.

Project description

tests Binder Documentation Status ascl:2201.001

EzTao (易道)

EzTao is a toolkit for conducting AGN time-series/variability analysis, mainly utilizing the continuous-time auto-regressive moving average model (CARMA)

Installation

pip install git+https://github.com/ywx649999311/EzTao.git

Dependencies

python = ">=3.9,<3.13"
celerite = ">= 0.3.0"
scipy = "> 1.5.0"
numba = ">= 0.57.0"
matplotlib = ">=3.3.3"
emcee = ">=0.3.0"

Quick Examples

Let's first simulate a DRW/CARMA(1,0) process with a variance of 0.3^2 and a relaxation timescale of 100 days. This time series will have a total of 200 data points and span 10 years.

import numpy as np
import matplotlib.pyplot as plt
from eztao.carma import DRW_term
from eztao.ts import gpSimRand

# define a DRW kernel & and simulate a process
amp = 0.2
tau = 100
DRW_kernel = DRW_term(np.log(amp), np.log(tau))
t, y, yerr = gpSimRand(DRW_kernel, 10, 365*10, 200)

# now, plot it
fig, ax = plt.subplots(1,1, dpi=150, figsize=(8,3))
ax.errorbar(t, y, yerr, fmt='.')
...

drw_sim

We can fit the simulated time series to the DRW model and see how well we can recover the input parameters.

from eztao.ts import drw_fit

best_fit = drw_fit(t, y, yerr)
print(f'Best-fit DRW parameters: {best_fit}')
Best-fit DRW parameters: [0.17356983 88.36262467]

How does the power spectrum density (PSD) compare?

from eztao.carma import gp_psd

# get psd functions
true_psd = gp_psd(DRW_kernel)
best_psd = gp_psd(DRW_term(*np.log(best_fit)))

# plot
fig, ax = plt.subplots(1,1, dpi=150, figsize=(6,3))
freq = np.logspace(-5, 2)
ax.plot(freq, true_psd(freq), label='Input PSD')
ax.plot(freq, best_psd(freq), label='Best-fit PSD')
...

drw_psd

Note: How well the input and best-fit PSD match is up to how good the best-fit parameters are, which is highly influenced by the quality of the input time series.

For more examples, please check out the online documentation or run the tutorial notebooks at -> Binder.

Development

poetry is used to solve dependencies and to build/publish this package. Below shows how setup the environment for development (assuming you already have poetry installed on your machine).

  1. Clone this repository, and enter the repository folder.
  2. Create a python virtual environment and activate it (the virtual environment name must be '.venv').
    python -m venv .venv
    source .venv/bin/activate
    
  3. Install dependencies and EzTao in editable mode.
    poetry install
    

Now you should be ready to start adding new features. Be sure to checkout the normal practice regarding how to use poetry on its website. When you are ready to push, also make sure the poetry.lock file is checked-in if any dependency has changed.

Citation

We are working on a paper to describe the full implementation of EzTao. In the meantime, if you find EzTao useful for your research, please consider acknowledging EzTao using the following:

@MISC{Yu2022,
       author = {{Yu}, Weixiang and {Richards}, Gordon T.},
        title = "{EzTao: Easier CARMA Modeling}",
     keywords = {Software},
 howpublished = {Astrophysics Source Code Library, record ascl:2201.001},
         year = 2022,
        month = jan,
          eid = {ascl:2201.001},
        pages = {ascl:2201.001},
archivePrefix = {ascl},
       eprint = {2201.001},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2022ascl.soft01001Y},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eztao-0.4.4.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eztao-0.4.4-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file eztao-0.4.4.tar.gz.

File metadata

  • Download URL: eztao-0.4.4.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.22 Linux/6.11.0-1015-azure

File hashes

Hashes for eztao-0.4.4.tar.gz
Algorithm Hash digest
SHA256 85e92c31d33ae0e6f155729d14d1e2b557b0db281696e1bf0c85a10652d687a4
MD5 65ff0c34b091d6fee7afc0f8daebc2b2
BLAKE2b-256 85363558c4f8a56a3478714e900799d2ff90fe3cdcae1abe5ee1f4232efd290d

See more details on using hashes here.

File details

Details for the file eztao-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: eztao-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.22 Linux/6.11.0-1015-azure

File hashes

Hashes for eztao-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e57ad31d5a9279b8502b86a90d43b9ff912e712213acd18015d781561eb3839d
MD5 43b6923d5ad773c2ed452f2c8354a969
BLAKE2b-256 93325ef2d2b5dd2d5504a93bec538348f4152bec8f8fa724b27e14f896031a38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page