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

Bispectral analysis #2

Open
pavleb opened this issue Oct 11, 2020 · 2 comments
Open

Bispectral analysis #2

pavleb opened this issue Oct 11, 2020 · 2 comments
Assignees

Comments

@pavleb
Copy link
Collaborator

pavleb commented Oct 11, 2020

Checking from MODA, bispectral analysis can be implemented straightforward. In its calculation it relies on wavelet_transform.py. For two signals sig1 and sig2, the bispectral analysis requires spectra at frequencies so it becomes B(ω121 + ω2). When performing wavelet transform using wavelet_transform.py the frequencies at which the wavelet coefficients are calculated are selected using fmin and fmax as well as the number of voices nv.

However for bispectral analysis we need also frequencies that are sum of the pairs. What I suggest is the following:

Change the signature of the function wavelet_transform in wavelet_transform.py by adding new parameter sel_freqs = None. This would change two things how this function executes. If sel_freqs is set then the function will ignore fmin and fmax and calculate the wavelet transform at the provided list of frequencies.
This is achieved with these two blocks:

if sel_freqs is not None:
      fmin = np.min(sel_freqs)
      fmax = np.max(sel_freqs)
      nv = len(sel_freqs)

and

if sel_freqs is not None:
      freq = sel_freqs
    else:
      freq = 2 ** (
        arange(ceil(nv * np.log2(fmin)), np.floor(nv * np.log2(fmax)) + 1).conj().T / nv
    )

By doing so, we can implement bispectral analysis in no time. I have a prototype working, I can push it in a new branch. I just wanted to double check with you whether such a signature change to wavelet_transform function is acceptable for you. It remains backwards compatible but for my taste it becomes cumbersome. Maybe, we can separate the frequency interval calculation as an auxiliary function and decouple the process.

Please let me know what do you think.

@spmccormack
Copy link
Contributor

Sorry for the late reply, I'm a bit busy at the moment but I'll get back to you at the weekend. Looks like a good idea though, thanks for your time and effort!

@spmccormack spmccormack self-assigned this Oct 14, 2020
@spmccormack
Copy link
Contributor

Ok, sounds great! Feel free to push your branch and I'll be glad to take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants