pywavelet / case_studies

0 stars 0 forks source link

MCMC with gaps #1

Open avivajpeyi opened 1 week ago

avivajpeyi commented 1 week ago

Data generation

We take a ~4 day long signal:

$$y(a,f,\dot{f}, t) = a \left( \sin \left( 2 \pi \left( f t + 0.5 \dot{f} t^2 \right) \right) \right)$$

with

A_TRUE = 1e-21
F_TRUE =  3e-3
FDOT_TRUE = 1e-8

and add a ~6hr gap in the middle.

We then take each 'chunk' of timeseries, zero-pad and WDM transform it (bottom plot is the PSD): gaped_data

Single parameter likelihood

I set up a small search range:

A_RANGE = [9e-22, 1e-20]
LN_F_RANGE = [LN_F_TRUE-0.2, LN_F_TRUE+0.2]
LN_FDOT_RANGE = [LN_FDOT_TRUE-0.2, LN_FDOT_TRUE+0.2]

and compute the likelihood, changing one parameter at a time:

a f fdot
a_lnl ln_f_lnl ln_fdot_lnl

MCMC

Seems like the MCMC is taking a while to converge... corner mcmc

avivajpeyi commented 1 week ago

Can we just wavelet transform the entire timeseries with the gap? -- Maybe this will be hard due to correlations in the noise.

When we have gaps in timedomain, we need noise covar matrix in timedomain.

We need to take into account the noise correlations in the wavelet domain.

avivajpeyi commented 1 week ago
avivajpeyi commented 1 week ago

Nt, Nf = 4, 8 ND = 32

Wnm.flatten = [...] shape-> 32

Flattened Wnm and Wn'm' covar matrix --> 32x32

We want to show that we can use the var (the diagonal)

Then we can take the flattened Wnm covariance matrix, and recast recast --> 4x8x??

if we want to use the FULL covar matrix: s covar s

avivajpeyi commented 1 week ago

repeat 100s of times: noise --> from PSD take noise --> WDM transform with and without windows.

WDM without windows:

WDM with window:

Compute magnitude of off-diagonal terms

avivajpeyi commented 4 days ago

Ollie has made some progress on this. See https://github.com/pywavelet/case_studies/compare/db6b90b...4e04dfd

He says:

You can see with the Cornish style noise (high red noise) that the MCMC will not converge properly if noise is included (with the gap). It works very well if you set the filter kwarg to true… that is, if we filter out that nasty red noise then we converge to the true parameters. Cool.

avivajpeyi commented 2 days ago

The MCMC doesnnt seem to be working with noise... Sadness...

Is the noise correct?

No noise

Gapped:

data corner

No Gap:

data corner

Noise

(maybe filtering is incorrect? in the data plots i don't see the signal at all...)

Gap

data corner

No gap

data corner