-
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 function to project multi-harmonic phasor coordinates onto principal plane #78
Conversation
Apparently the synthetic test data lead to significant different results across platforms. |
How about renaming the function to |
I think this is ready for review. |
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.
@cgohlke I added some minor comments but I think this is ready to be merged. We should test with real data as you commented in the tutorial. Maybe with hyperspectral data, as FLIM data seems to be not good due to noise (I also understood the same from the paper).
Hi @bruno-pannunzio : Thanks for the review. I added the reference and corrected the spelling. Let's try to find a real dataset that could profit from this projection and apply the cursor visualization. Do you think there could be any confusion from using the terms "components" (vs lifetime components) and "principal plane" (used in optics)?
Any thought about this? |
Oh sorry I didn't see the previous comment. I hadn't realized but you may be right that there could be some confusion with the lifetime components. That's why I think that although On the other hand, I don't think it will lead to confusion with the optical plane, since this is clearly an analysis and I am not aware of this kind of analysis related to the optical plane. Related to the |
Sounds good. Let's leave this PR open for now and briefly discuss tomorrow. |
OK, I am going to merge this even though it is an experimental/unproven feature. |
Description
This PR adds a single function,
phasor_to_principal_plane
, which projects multi-harmonic phasor coordinates onto the principal plane, along which coordinate axes the phasor coordinates have the largest variations. The function is implemented using PCA, finding the two most significant eigenvectors in the covariance matrix.The function also tries to rotate and scale the projected coordinates such that their center lies in same quadrant and the projection of [1, 0] lies at [1, 0]. This allows for a more familiar presentation.
The transformation (projection, rotation, scaling) is affine. It preserves collinearity and ratios of distances, such that it should be possible to use the projected coordinates instead of phasor coordinates in some of PhasorPy's visualization and analysis functions.
This PR is work in progress. I am not confident that the single synthetic test is adequate. The affine transformation should also preserve convexity, but during testing I came across cases where that was not the case. Maybe there is still something wrong with the implementation or the method is numerically unstable...
See also doi:10.1021/acs.jpclett.0c02319. In the supplement it raises an interesting concern that (if I understood correctly) in FLIM data there is correlation in the frequency-dimension due to the presence of shot noise, which makes the projection more noisy.
Release note
Summarize the changes in the code block below to be included in the
release notes:
Checklist