Closed ssolson closed 5 months ago
This is not something I've ever tested.
Through the dolfyn TimeBinner
or VelBinner
classes it should be able to handle if you want to enter a different # of FFT to calculate CSDs. Dolfyn will then check the length of the two signals - if they aren't the same length, it'll use cpsd_quasisync
and if they are, it'll use cpsd
.
Looks like cpsd_quasisync
does not return the half spectra; it only returns the full. cpsd
will return the half spectra if you give it the additional argument step=nfft//2
cpsd_1D(a, b, nfft, fs, window=custom_window, step=nfft//2)
will get you what you want.
Added the fix for the window argument here: https://github.com/MHKiT-Software/MHKiT-Python/pull/280/commits/98e1a144a9602295d2bbbab4bdb6d6fa54604ecf
@jmcvey3 can you let me know if I am approaching this incorrectly?
Description:
The docstring of
cpsd_quasisync_1D
claims that I can pass a custom np.array window.https://github.com/MHKiT-Software/MHKiT-Python/blob/2ccc286a65685e5e2f5ab68a467209917f0161d9/mhkit/dolfyn/tools/fft.py#L81-L162
However
_getwindow
has not implemented that logic:https://github.com/MHKiT-Software/MHKiT-Python/blob/2ccc286a65685e5e2f5ab68a467209917f0161d9/mhkit/dolfyn/tools/fft.py#L34-L41
Test Case Issue:
The following test will fail when I pass a custom window.
Proposed solution
I think
_getwindow
simply needs a check to make sure the passed window is within bounds and then return the custom window