Skip to main content

Useful tools for analysis of periodicities in time series data

Project description

Periodicity

Useful tools for analysis of periodicities in time series data.

Includes:

  • Auto-Correlation Function
  • Fourier methods:
    • Lomb-Scargle periodogram
    • Wavelet Transform (in progress)
  • Phase-folding methods:
    • String Length
    • Analysis of Variance (in progress)
  • Gaussian Processes:
    • george implementation
    • celerite implementation
    • pymc3 implementation (in progress)

Quick start

Installing current release from pypi (v0.1.0-alpha)

$ pip install periodicity

Installing current development version

$ git clone https://github.com/dioph/periodicity.git
$ cd periodicity
$ python setup.py install

Example using GP with astronomical data

from periodicity.gp import *
from lightkurve import search_lightcurvefile

lcs = search_lightcurvefile(target=9895037, quarter=[4,5]).download_all()
lc = lcs[0].PDCSAP_FLUX.normalize().append(lcs[1].PDCSAP_FLUX.normalize())
lc = lc.remove_nans().remove_outliers().bin(binsize=4)

t, x = lc.time, lc.flux
x = x - x.mean()

model = FastGPModeler(t, x)
model.prior = make_gaussian_prior(t, x, pmin=2)
model.minimize()
samples = model.mcmc(nwalkers=32, nsteps=5000, burn=500)

print('Median period: {:.2f}'.format(np.exp(np.median(samples[:, 4]))))

Visualization of this example:

gp_example

gp_example

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

periodicity-0.1.0b2.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

periodicity-0.1.0b2-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

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