Open apatlpo opened 5 years ago
What do you mean by two sided spectra? Also the negative frequencies? The Python wrapper currently only wraps the single and double precision floating point variants of the spectral computation.
But a single precision complex version does exist on the fortran side: https://github.com/krischer/mtspec/blob/c34b648dedc5a35916b4d3d92a41c84aad1631b5/mtspec/src/src/mtspec.f90#L1520
It should be fairly simple to add to the existing wrappers. I'm a bit short on time recently so I cannot tackle it but I'm happy to merge a PR and help along the way!
I mean the spectrum of a complex variable, for which we need to retain negative frequencies (as they will differ from positive ones).
What would the steps to wrap mtspec_c
?
Would you have another wrapping that could be used as a template?
I think it should just be two steps or so:
Add a complex64
variant here: https://github.com/krischer/mtspec/blob/c34b648dedc5a35916b4d3d92a41c84aad1631b5/mtspec/multitaper.py#L752 (Basically maps numpy dtype to the corresponding fortran subroutine).
Maybe that is it already. If not: Fiddle a bit here: https://github.com/krischer/mtspec/blob/c34b648dedc5a35916b4d3d92a41c84aad1631b5/mtspec/multitaper.py#L255
Testing should also be fairly simple: Passing in data with all complex values set to zero should result in a symmetric spectrum which can be tested against the already existing wrappers.
started working on it: #30 it is not as simple as I hoped for
I would need for my applications to keep two-sided spectra. This doesn't seem to be implemented. Do you think it would be possible to modify the library to do that ?