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

Possible error in tftb.processing.reassigned.smoothed_pseudo_wigner_ville #179

Open
billp000 opened this issue Jan 8, 2024 · 0 comments

Comments

@billp000
Copy link

billp000 commented Jan 8, 2024

I got two questions and truly hope someone can answer. Thank you in advance!!
1.
Considering the following has been given,

tfr[0, icol] = (g2 * xx).sum()
tf2[0, icol] = (tg2 * xx).sum()
tf3[0, icol] = dh[lh + 1] * tfr[0, icol]

Should tau starts from 1 in "for tau in range(int(taumax)):"? Or, it should be something like

for tau in range(int(taumax)):
        points = np.arange(-min([lg, xrow - ti - tau]),
                           min([lg, ti - tau - 1]) + 1)
        g2 = twindow[lg + points]
        g2 = g2 / g2.sum()
        tg2 = g2 * points
        xx = signal[ti + tau - 1 - points] * np.conj(signal[ti - tau - 1 - points])
        tfr[1+tau, icol] = (g2 * xx).sum() * fwindow[1+lh + tau]
        tf2[1+tau, icol] = fwindow[1+lh + tau] * (tg2 * xx).sum()
        tf3[1+tau, icol] = dh[1+lh + tau] * (g2 * xx).sum()
        tfr[n_fbins - tau - 1, icol] = (g2 * np.conj(xx)).sum() * fwindow[1+lh - tau]
        tf2[n_fbins - tau - 1, icol] = (tg2 * np.conj(xx)).sum() * fwindow[1+lh - tau]
        tf3[n_fbins - tau - 1, icol] = dh[1+lh - tau] * (g2 * np.conj(xx)).sum()

Otherwise, tfr will be unequal to SPWVD.

  1. The results in this module, tfr and rtfr are equal due to the following code at the end of the module.
for icol in range(tcol):
        for jcol in range(n_fbins):
            if np.abs(tfr[jcol, icol]) > threshold:
                icolhat = min(max([icol - tf2[jcol, icol], 1]), tcol)
                jcolhat = jcol - tf3[jcol, icol]
                jcolhat = (((int(jcolhat) - 1) % n_fbins) + n_fbins) % n_fbins + 1
                rtfr[jcol, icol] += tfr[jcol, icol]
                tf2[jcol, icol] = jcolhat + 1j * icolhat
            else:
                tf2[jcol, icol] = np.inf * (1 + 1j)
                rtfr[jcol, icol] += tfr[jcol, icol]

I don't think it's reassigning the result.
Should it be like following?

for icol in range(tcol):
    for jcol in range(n_fbins):
        if np.abs(tfr[jcol, icol]) > threshold:
            icolhat = icol - np.round(np.abs(tf2[jcol, icol]))
            icolhat = min([max([icolhat, 1]), tcol])

            jcolhat = jcol - tf3[jcol, icol]
            jcolhat = (((int(jcolhat) - 1) % n_fbins) + n_fbins) % n_fbins + 1
            rtfr[int(jcolhat) - 1, int(icolhat) - 1] += tfr[jcol, icol]
            tf2[jcol, icol] = jcolhat + 1j * icolhat
        else:
            tf2[jcol, icol] = np.inf * (1 + 1j)
            rtfr[jcol, icol] += tfr[jcol, icol]

I'm new to this field, so please forgive me for asking such simple questions.

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

1 participant