Skip to content

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

Description

@billp000

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions