-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add phasor_to_signal function #86
Conversation
Hi @cgohlke! These modification and functionalities added all seem very good to me.
I think this is okay. I don't know if
These are both very nice and useful additions.
The
Yes! I think this makes much more sense than having two separate function for calculating the phasors. I think it will make documentation clearer and more easy to understand which function to use for creating the phasors, which the most important function of the whole library in my opinion. So it would be nice it's as direct as possible. |
You have a point. An alternative, more explicit, would be to allow
Good question. I'll try.
OK. I prefer to implement it in another PR unless there are larger changes necessary in this PR. |
Yes, that works as expected.
How about adding a |
I think that makes sense also and is quite direct to understand. I was also thinking that the problem with
Excelent! I see you already implemented this and looks great and also a great addition. |
The real component of the 0th harmonic is returned as the |
Description
This PR adds a
phasor_to_signal
function and improvesphasor_from_signal
andphasor_from_signal_fft
functions:harmonic
parameters across the functions.harmonic='all'
to return all harmonics for signal samples along axis.harmonic=[scalar]
to keep a length-one first axis in the phasor coordinates.rfft
function inphasor_to_signal_fft
, improving efficiency.phasorpy_phasor_from_signal
benchmark tutorial.numpy.nanmean
inplot
module. Some plots were silently failing when encountering NaN values (see also Add median filtering function #85).phasor_to_signal
function to reconstruct signal from phasor coordinates. While this function works perfectly for roundtrips likephasor_to_signal(*phasor_from_signal(signal)) == signal
, it does not work well for synthesizing signals from calculated phasor coordinates such asphasor_from_lifetime
orphasor_calibrate
. I was originally hoping to use this function to calculate exponential decays from lifetime distributions, but that did not work in practice. Hence, I have not used the function in a tutorial. In any case, it's nice to have a function that does the inverse ofphasor_from_signal
.reverse
parameter tophasor_calibrate
, which turned out useful to debug some artifacts related tophasor_to_signal
.Question: should we unify
phasor_from_signal
andphasor_from_signal_fft
into a single function?Release note
Summarize the changes in the code block below to be included in the
release notes:
Checklist