{"action":"created","issue":{"url":"https://api.github.com/repos/PyWavelets/pywt/issues/96","labels_url":"https://api.github.com/repos/PyWavelets/pywt/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/PyWavelets/pywt/issues/96/comments","events_url":"https://api.github.com/repos/PyWavelets/pywt/issues/96/events","html_url":"https://github.com/PyWavelets/pywt/issues/96","id":99226643,"number":96,"title":"handling complex dtypes","user":{"login":"grlee77","id":6528957,"avatar_url":"https://avatars.githubusercontent.com/u/6528957?v=3","gravatar_id":"","url":"https://api.github.com/users/grlee77","html_url":"https://github.com/grlee77","followers_url":"https://api.github.com/users/grlee77/followers","following_url":"https://api.github.com/users/grlee77/following{/other_user}","gists_url":"https://api.github.com/users/grlee77/gists{/gist_id}","starred_url":"https://api.github.com/users/grlee77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grlee77/subscriptions","organizations_url":"https://api.github.com/users/grlee77/orgs","repos_url":"https://api.github.com/users/grlee77/repos","events_url":"https://api.github.com/users/grlee77/events{/privacy}","received_events_url":"https://api.github.com/users/grlee77/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PyWavelets/pywt/labels/task","name":"task","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-05T15:06:36Z","updated_at":"2015-12-16T21:30:45Z","closed_at":"2015-12-16T21:30:45Z","body":"This is a request for feedback on a potential enhancement to handle complex data for transforms provided by pywt.  Personally, I work with MRI images where the data is complex and both the image magnitude and phase are often of interest.\r\n\r\nCurrently one can perform complex transforms via separate calls on the real and imaginary parts, but this is a bit cumbersome:\r\n```python\r\ncoeffs_real = pywt.dwt(data.real, wavelet)\r\ncoeffs_imag = pywt.dwt(data.imag, wavelet)\r\n\r\nreconstructed_data = pywt.idwt(coeffs_real, wavelet) + 1j*pywt.idwt(coeffs_imag, wavelet)\r\n```\r\n\r\nIs this too niche a case to be worth supporting here in pywt?  I see three potential approaches in ascending order of the work required, but would be happy for feedback on others:\r\n\r\n1. leave it up to the user to handle as above.\r\n2. modify functions such as dwt to accept complex inputs, but run the real and complex parts   independently using the existing C codebase.  This would essentially operate like in the example above, but the data/coeffs input/returned would be complex.  The separate real/imag calls would be transparent to users of the functions.\r\n3. update the C code to support ``np.complex64`` and ``np.complex128`` in addition to the currently supported ``np.float32`` and ``np.float64``.\r\n\r\nEven if it is determined not to add complex support, I think we should raise errors on complex input as the current code will just discard the imaginary part.  This does issue a warning ``ComplexWarning: Casting complex values to real discards the imaginary part``, but that could be easy to miss.\r\n"},"comment":{"url":"https://api.github.com/repos/PyWavelets/pywt/issues/comments/165254758","html_url":"https://github.com/PyWavelets/pywt/issues/96#issuecomment-165254758","issue_url":"https://api.github.com/repos/PyWavelets/pywt/issues/96","id":165254758,"user":{"login":"grlee77","id":6528957,"avatar_url":"https://avatars.githubusercontent.com/u/6528957?v=3","gravatar_id":"","url":"https://api.github.com/users/grlee77","html_url":"https://github.com/grlee77","followers_url":"https://api.github.com/users/grlee77/followers","following_url":"https://api.github.com/users/grlee77/following{/other_user}","gists_url":"https://api.github.com/users/grlee77/gists{/gist_id}","starred_url":"https://api.github.com/users/grlee77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grlee77/subscriptions","organizations_url":"https://api.github.com/users/grlee77/orgs","repos_url":"https://api.github.com/users/grlee77/repos","events_url":"https://api.github.com/users/grlee77/events{/privacy}","received_events_url":"https://api.github.com/users/grlee77/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T21:30:45Z","updated_at":"2015-12-16T21:30:45Z","body":"This was resolved by #99"}}