Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V042 #77

Merged
merged 17 commits into from
Dec 12, 2023
Merged

V042 #77

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
30 changes: 15 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ name: publish to pypi
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.7"
python-version: "3.8"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
Expand All @@ -34,14 +34,14 @@ jobs:
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
run: poetry install
# install dependencies if cache does not exist
#----------------------------------------------
run: poetry install --without docs
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
#----------------------------------------------
# config poetry and publish to pypi
#----------------------------------------------
# config poetry and publish to pypi
#----------------------------------------------
- name: Config
run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- name: Publish
- name: Publish
run: poetry publish --build
30 changes: 15 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,46 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8]
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
if: "! contains(toJSON(github.event.commits.*.message), '[skip-tests]')"
steps:
#----------------------------------------------
# check-out repo and set-up python
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.6
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
run: poetry install
run: poetry install --without docs
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
#----------------------------------------------
# run tests
#----------------------------------------------
#----------------------------------------------
- name: Run tests
run: |
source .venv/bin/activate
poetry run pytest --cov tests/
poetry run pytest --cov tests/
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
exclude: '^.md'
default_language_version:
python: python3.8


repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "23.11.0"
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.6"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.8"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
25 changes: 0 additions & 25 deletions .readthedocs.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
- Fitting functions (i.e., `drw_fit`) are now fully modular (allow user provided optimization function, prior function and etc.)
- A new `addNoise` function to simulated random noise given measurement errors.
- **Bug fixes:** #44
- **API changes:** `n_iter` -> `n_opt` in fitting functions.
- **API changes:** `n_iter` -> `n_opt` in fitting functions.

0.3.0 (2021-01-07)
+++++++++++++++++++++

- update parameter initialization in fit functions; removed `de` option #26, #27
- update parameter initialization in fit functions; removed `de` option #26, #27
- add few utils functions #30, #25
- add mcmc module #29
- ts simulation now support linear error
Expand Down Expand Up @@ -48,4 +48,4 @@ First release!

- Fully working CARMA kernels: `DRW_term`, `DHO_term` and `CARMA_term`
- Functions to simulate CARMA time series given a kernel
- Functions to fit arbitrary time series to CARMA models (still having instability issues with CARMA models higher than DHO/CARMA(2,1))
- Functions to fit arbitrary time series to CARMA models (still having instability issues with CARMA models higher than DHO/CARMA(2,1))
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![tests](https://github.com/ywx649999311/EzTao/workflows/tests/badge.svg)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ywx649999311/EzTao/v0.4.1?filepath=docs/notebooks)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ywx649999311/EzTao/v0.4.2?filepath=docs/notebooks)
[![Documentation Status](https://readthedocs.org/projects/eztao/badge/?version=latest)](https://eztao.readthedocs.io/en/latest/)
<a href="https://ascl.net/2201.001"><img src="https://img.shields.io/badge/ascl-2201.001-blue.svg?colorB=262255" alt="ascl:2201.001" /></a>
# EzTao (易道)
Expand All @@ -15,12 +15,12 @@ pip install git+https://github.com/ywx649999311/EzTao.git
```
### Dependencies
>```
>python = "^3.7"
>python = ">=3.8,<3.12"
>celerite = ">= 0.3.0"
>matplotlib = "^3.3.0"
>scipy = "> 1.5.0"
>numba = ">= 0.51.0"
>emcee = ">=3.0.0"
>matplotlib = ">=3.3.3"
>emcee = ">=0.3.0"
>```

## Quick Examples
Expand Down Expand Up @@ -72,7 +72,7 @@ ax.plot(freq, best_psd(freq), label='Best-fit PSD')
```
![drw_psd](include/drw_psd.png)

__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.
__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](https://eztao.readthedocs.io/en/latest/) or run the tutorial notebooks at ->
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ywx649999311/EzTao/v0.4.0?filepath=docs/notebooks).
Expand All @@ -81,7 +81,7 @@ For more examples, please check out the [online documentation](https://eztao.rea
`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). _**Warning:**_ `poetry` is having issue installing `llvmlite = 0.34.0` (used for `eztao = ^0.4.0`) under Python 3.9. The issue disappears for Python 3.8.

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').
2. Create a python virtual environment and activate it (the virtual environment name must be '.venv').
```
python -m venv .venv
source .venv/bin/activate
Expand All @@ -91,7 +91,7 @@ For more examples, please check out the [online documentation](https://eztao.rea
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.
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:
Expand All @@ -112,4 +112,3 @@ archivePrefix = {ascl},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
```

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# -- Project information -----------------------------------------------------

project = "EzTao"
copyright = "2020, Weixiang Yu"
copyright = "2020-2023, Weixiang Yu"
author = "Weixiang Yu"

# The full version, including alpha/beta/rc tags
Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
EzTao
=====
**EzTao** is a Python toolkit for conducting time-series analysis using continuous-time autoregressive moving average (CARMA) processes. It uses `celerite`_ (a fast gaussian processes regression library) to compute the likelihood of a set of proposed CARMA parameters given the input time series. Comparing to existing tools for performing CARMA analysis in Python which use *Kalman filter* to evaluate the likelihood function (e.g., `Kali`_), **EzTao** offers a more scalable solution (see the `celerite paper`_ for a comparison).
**EzTao** is a Python toolkit for conducting time-series analysis using continuous-time autoregressive moving average (CARMA) processes. It uses `celerite`_ (a fast gaussian processes regression library) to compute the likelihood of a set of proposed CARMA parameters given the input time series. Comparing to existing tools for performing CARMA analysis in Python which use *Kalman filter* to evaluate the likelihood function (e.g., `Kali`_), **EzTao** offers a more scalable solution (see the `celerite paper`_ for a comparison).

**EzTao** consist of tools to both simulate CARMA processes and fit (maximum likelihood estimation or MLE) time series to CARMA models. The current version of **EzTao** is built on top of `celerite`_, future versions will take advantage of `celerite2`_ (still under active development) for a better integration with other probabilistic programing libraries such as `PyMC3`_.
**EzTao** consist of tools to both simulate CARMA processes and fit (maximum likelihood estimation or MLE) time series to CARMA models. The current version of **EzTao** is built on top of `celerite`_, future versions will take advantage of `celerite2`_ (still under active development) for a better integration with other probabilistic programing libraries such as `PyMC3`_.

Installation
------------
Expand Down Expand Up @@ -49,4 +49,4 @@ Changelog
.. _celerite paper: https://iopscience.iop.org/article/10.3847/1538-3881/aa9332
.. _celerite2: https://github.com/exoplanet-dev/celerite2
.. _PyMC3: https://docs.pymc.io/
.. _pip: https://pip.pypa.io/en/stable/
.. _pip: https://pip.pypa.io/en/stable/
4 changes: 2 additions & 2 deletions docs/python/carma.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CARMA

CARMA GP kernels
----------------
.. note:: `term` is a `celerite` nomenclature, a `term` is just a GP kernel. For example, a ``DRW_term`` object defines a DRW kernel.
.. note:: `term` is a `celerite` nomenclature, a `term` is just a GP kernel. For example, a ``DRW_term`` object defines a DRW kernel.

.. automodule:: eztao.carma.CARMATerm
:members:
Expand All @@ -12,4 +12,4 @@ CARMA GP kernels
CARMA utility functions
-----------------------
.. automodule:: eztao.carma.model_utils
:members:
:members:
2 changes: 1 addition & 1 deletion docs/python/ts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ MCMC
Time series utility functions
-----------------------------
.. automodule:: eztao.ts.utils
:members:
:members:
2 changes: 1 addition & 1 deletion docs/python/viz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Visualization Tools
===================

.. automodule:: eztao.viz.mpl_viz
:members:
:members:
12 changes: 6 additions & 6 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# docs/requirements.txt
jinja2<3.1
sphinx==3.4.1
sphinx_rtd_theme==0.5.0
nbsphinx>=0.8.6
sphinx-copybutton==0.3.1
toml==0.10.2
ipykernel
numba==0.51.0
celerite==0.4.0
scipy==1.5.0
emcee==3.0.0
matplotlib==3.3.3
jinja2<3.1
numba>=0.51.0
celerite>=0.4.0
scipy>=1.5.0
emcee>=3.0.0
matplotlib>=3.3.3
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ channels:
- defaults
- conda-forge
dependencies:
- python=3.7
- python=3.8
- matplotlib
- numpy
- emcee
- pip:
- corner
- eztao==0.4.1
- eztao==0.4.2
- importlib-metadata
Loading