-
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
Various additions and improvements to the phasor module #32
Conversation
Hi @cgohlke, thanks for improving the docstrings of the functions that had some errors. I don't think this overlaps with anything I am working on so no problem with that. I like the idea very much of starting to implement some thing in cython to speed up the processing, maybe we can talk about it today in the meeting. I also believe that the tests should be improved as there are many cases that are not testes, we can focus on improving this on the following weeks. Regarding the |
Hi @bruno-pannunzio . Thanks for the feedback. OK, I will remove Besides the tests marked with |
I think those are ok. I think they also apply to the tests from my previous PR because not all functions cover all those test cases you added to the TODO. So I will improve those tests also when possible. |
Regarding today's discussion about using plain SI units: should I integrate it into this PR as a commit? Then we'll see how things look and if we don't like can just revert the commit... |
That would be great. If you need I can also do some work on it but may be caotic if we both do stuff at the same time. Let me know If you want me to work on something related. Also, before I forget although is not related to this PR. I was reading some papers and some terms used for transforming the coordinates are 'phase shift' and 'modulation ratio'. Could it be a good idea to rename |
Yes, I like |
You are right, maybe its something that we can discuss if it make sense or if it can lead to misunderstandings. I will get feedback on this topic. |
OK, that did not go too well. I now think we should not handle/store lifetimes and frequencies in s and Hz. The precision of 32-bit floating point Anyway, I think the current implementation of |
Interesting benchmark results: the
|
Hi @bruno-pannunzio. I think this is ready for review. You can download the docs, including formulas and tutorial as a build artifact at https://github.com/phasorpy/phasorpy/actions/runs/7825054348?pr=32 Never mind the long |
I see the following issues with the
|
Hi Christoph, sorry I didn't reply before, I was on a trip until yesterday. I will go through your comments and will get back to you on the aspects you pointed out. |
Hi @cgohlke, I tested the I also tested the The tutorial looks really good and easy to understand. The only thing I see is a bit distracting is the code for |
# pure numpy implementation for reference: | ||
# shape = [1] * signal.ndim | ||
# shape[axis] = sample_phase.size | ||
# sample_phase = sample_phase.reshape(shape) # make broadcastable | ||
# mean = numpy.mean(signal, axis=axis) | ||
# real = numpy.mean(signal * numpy.cos(sample_phase), axis=axis) | ||
# real /= mean | ||
# imag = numpy.mean(signal * numpy.sin(sample_phase), axis=axis) | ||
# imag /= mean | ||
# return mean, real, imag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep this commented implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking to move it into test_phasor.py
or phasorpy.testing_utils.py
, but then the test function would need to be tested too. Also, the plan is to test phasor_from_signal_f1
against phasor_from_signal
once implemented, or to merge those functions into one...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, it can be a good a idea to keep that implementation somewhere to compare. The proposed phasor_from_signal
is also different from that implementation, so maybe we can keep and compare the three of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now there is no need for this in the tests, which use known values. So I think to leave it as a comment in this PR. Another option would be to implement it as a reference in a tutorial/benchmark that compares various implementations.
Thanks for the feedback.
Yes, unfortunately there's no official support for OpenMP on macOS/Xcode. It's unbelievable. I applied the workaround in the
Exactly, that function will be moved to |
Hi @bruno-pannunzio Do you think this can be merged? |
@cgohlke I was just going to comment that I believe this can be merged and we can keep working/discussing the points were we can have more input. |
Btw, wheels for the main branch are available at https://github.com/phasorpy/phasorpy/actions/workflows/build_wheels.yml. Just follow the latest workflow run and go to artifacts, for example, https://github.com/phasorpy/phasorpy/actions/runs/7933102707#artifacts |
Description
This PR proposes various additions and improvements to the
phasorpy.phasor
module and the build infrastructure:phasor_from_lifetime
, including speedups written in Cythonphasor_from_lifetime
phasor_from_signal_f1
function, including speedups in Cython. Alternative to Add phasor_from_signal function #20phasor_from_signal
phasor_from_polar
function. Replaces Lifetime module branch #13phasor_coordinates
phasor_semicircle
helper function:math:
for formulasThe following are being postponed to a later PR:
phasor_from_apparent_lifetime
andphasor_to_apparent_lifetime
.A Python compatible C compiler is now required for developing the PhasorPy library.
Release note
Summarize the changes in the code block below to be included in the
release notes:
Checklist