Skip to content

Bispectral analysis #2

@pavleb

Description

@pavleb

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions