dioph / periodicity Goto Github PK
View Code? Open in Web Editor NEWUseful tools for periodicity analysis in time series data.
Home Page: https://periodicity.readthedocs.io
License: MIT License
Useful tools for periodicity analysis in time series data.
Home Page: https://periodicity.readthedocs.io
License: MIT License
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)
emcee's multiprocessing functionality requires the likelihood function to be picklable
AttributeError: Can't pickle local object 'make_gaussian_prior.<locals>.gaussian_prior'
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.
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.
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,)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.