Giter Site home page Giter Site logo

dioph / periodicity Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 5.0 3.3 MB

Useful tools for periodicity analysis in time series data.

Home Page: https://periodicity.readthedocs.io

License: MIT License

Python 100.00%
gaussian-processes periodicity-analysis spectral-analysis time-series wavelets

periodicity's People

Contributors

dioph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

periodicity's Issues

ValueError: Digital filter critical frequencies must be 0 < Wn < 1

I'm trying to execute your code below
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)
model.minimize()
samples = model.mcmc(nwalkers=32, nsteps=5000, burn=500)

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

And it returns an error

ValueError Traceback (most recent call last)

in ()
10
11 model = FastGPModeler(t, x)
---> 12 model.prior = make_gaussian_prior(t, x)
13 model.minimize()
14 samples = model.mcmc(nwalkers=32, nsteps=5000, burn=500)

Getting an error while working on AGN data

Hi, I wanted to incorporate this analysis in my work. While doing my analysis i am getting an error, which is as fellow:

siga = TSeries(t,y)
siga


AssertionError Traceback (most recent call last)
Cell In[28], line 1
----> 1 siga = TSeries(t,y)
2 siga

File /opt/anaconda3/envs/periodicity/lib/python3.8/site-packages/periodicity/core.py:472, in TSeries.init(self, time, values, assume_sorted)
470 raise ValueError("Input arrays have incompatible lengths.")
471 time = dict(time=time)
--> 472 super().init(data, time, fastpath=True)
473 if (
474 not assume_sorted
475 and not self.coords["time"]._data.array.is_monotonic_increasing
476 ):
477 self._array = self._array.sortby("time")

File /opt/anaconda3/envs/periodicity/lib/python3.8/site-packages/periodicity/core.py:58, in Signal.init(self, *args, **kwargs)
57 def init(self, *args, **kwargs):
---> 58 self._array = xr.DataArray(*args, **kwargs)

File /opt/anaconda3/envs/periodicity/lib/python3.8/site-packages/xarray/core/dataarray.py:400, in DataArray.init(self, data, coords, dims, name, attrs, indexes, fastpath)
398 assert dims is None
399 assert attrs is None
--> 400 assert indexes is not None
401 else:
402 # TODO: (benbovy - explicit indexes) remove
403 # once it becomes part of the public interface
404 if indexes is not None:

AssertionError:

Please help me to resolve this problem.

TypeError: 'Signal' object is not subscriptable

Hi,
When using Signal.find_peaks(), the line peaks = self[maxima] returns error TypeError: 'Signal' object is not subscriptable.
The context was :

gls = GLS(fmin=fmin, fmax=fmax)
pg = gls(x)
z= pg.val * Signal(y)  # y is an np array
z.find_peaks()

N.M.

Weird multiplication with a TimeSeries behaviour

While trying to multiply a Periodogram with coefficients y, I get different results :
Context :

gls = GLS(fmin=fmin, fmax=fmax)
pg = gls(x)
z= pg.val * y # y is an np array

I get results fine, but cannot do z.find_peaks() because z is a np array

So I switched to z= pg.val * Timeseries(time=periods, val=y)
This works (return a result), BUT z here is not equal to z in the first test.

I would assume it to gave same result, because of :

    def __mul__(self, other):
        result = self.copy()
        if isinstance(other, Signal):
            if len(self) != len(other):
                raise ValueError("Cannot multiply two Signals with different lengths.")
            result.val = self.val * other.val
        else:
            result.val = self.val * other
        return result

Am I missing something here ?

Some more infos :
pg.val and y are of size (7215,)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.