Skip to content
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 lifetime_to_signal function #93

Merged
merged 4 commits into from
Aug 5, 2024
Merged

Conversation

cgohlke
Copy link
Member

@cgohlke cgohlke commented Aug 5, 2024

Description

This PR makes several additions/changes to the phasor and _phasorpy.pyx modules:

  • Add lifetime_to_signal function, which generates time/frequency-domain decay/waveforms from specified lifetimes. The signals are convoluted with an instrument response function. Closes Add a lifetime calculator module #6
  • Add phasor_to_complex, phasor_multiply, and phasor_divide helper functions (originally proposed in Add phasor_to_complex, phasor_multiply, and phasor_divide helper functions #92).
  • Add private Cython functions to _phasorpy.pyx: _gaussian_signal, _phasor_multiply, and _phasor_divide.
  • Rename some functions such that the phasor module only contains function names starting with phasor_, polar_, and lifetime_:
    • frequency_from_lifetime -> lifetime_to_frequency
    • frequency_to_lifetime -> lifetime_from_frequency
    • fraction_from_amplitude -> lifetime_fraction_from_amplitude
    • fraction_to_amplitude -> lifetime_fraction_to_amplitude
  • Re-classify phasor_transform from "calibration" to "transformation" together with phasor_multiply and phasor_divide in the module docstring. Is that reasonable?
  • Add "Synthesize signals from lifetimes" tutorial.
  • Update "LFD Workshop Tutorial".

Release note

Summarize the changes in the code block below to be included in the
release notes:

Add lifetime_to_signal function

Checklist

  • The pull request title, summary, and description are concise.
  • Related issues are linked in the description.
  • New dependencies are explained.
  • The source code and documentation can be distributed under the MIT license.
  • The source code adheres to code standards.
  • New classes, functions, and features are thoroughly tested.
  • New, user-facing classes, functions, and features are documented.
  • New features are covered in tutorials.
  • No files other than source code, documentation, and project settings are added to the repository.

@cgohlke cgohlke added the enhancement New feature or request label Aug 5, 2024
@cgohlke cgohlke requested a review from bruno-pannunzio August 5, 2024 04:40
@cgohlke cgohlke self-assigned this Aug 5, 2024
Copy link
Contributor

@bruno-pannunzio bruno-pannunzio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cgohlke! Very nice functionalities you added in this PR. I think it all makes a lot of sense and looks good to me.

  • Re-classify phasor_transform from "calibration" to "transformation" together with phasor_multiply and phasor_divide in the module docstring. Is that reasonable?

Yes, I think this also makes sense and is good idea to group those functions together, rather than grouping with calibration.

While looking at the tutorial, in the time domain generated signal I see that different lifetimes have different max intensity. Is there a parameter I am not seeing to normalize the max intensity so that all have the same max intensity? I am thinking in some figures I have done in the past were it is more visual to see all curves "decaying from the same point in the max intensity", if it makes sense. I know normalization can be done after calculating the signals, but just in case.

@cgohlke
Copy link
Member Author

cgohlke commented Aug 5, 2024

While looking at the tutorial, in the time domain generated signal I see that different lifetimes have different max intensity. Is there a parameter I am not seeing to normalize the max intensity so that all have the same max intensity?

The intensities are normalized according to the mean parameter. It's consistent with other functions in the library. To normalize by maximum, simply do signal /= signal.max(), no?

@cgohlke cgohlke merged commit 4851a66 into phasorpy:main Aug 5, 2024
16 checks passed
@cgohlke cgohlke deleted the lifetime_to_signal branch August 5, 2024 16:53
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a lifetime calculator module
2 participants