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 phasor_at_harmonic function #65

Merged
merged 3 commits into from
May 9, 2024
Merged

Conversation

cgohlke
Copy link
Member

@cgohlke cgohlke commented May 8, 2024

Description

This PR adds a convenience function, phasor_at_harmonic, which calculates, given the real component of phasor coordinates of a single exponential lifetime at a certain harmonic, the phasor coordinates at other harmonics. It is implemented as a numpy ufunc in Cython.

Release note

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

Add phasor_at_harmonic 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 May 8, 2024
@cgohlke cgohlke requested a review from bruno-pannunzio May 8, 2024 19:22
@cgohlke cgohlke self-assigned this May 8, 2024
@cgohlke
Copy link
Member Author

cgohlke commented May 8, 2024

Hi @bruno-pannunzio . This implements the phasor_at_harmonic convenience function we discussed by email.

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.

Thanks @cgohlke ! I tested it and works as expected and it also simplifies the workflow compared to only working with phasor_form_lifetime at multiple frequencies.

I know that it is in the description of the function that works with phasors at the semicircle and that later in the real parameter it is stated that it must be monoexponential, but I feel it may lead up to some confusion and someone will try to use it for multi-exponential phasors as they may think the function is for other uses due to the given name. Maybe add a short line in the description also that it will only work with single exponential phasors?

@cgohlke
Copy link
Member Author

cgohlke commented May 9, 2024

Thanks for testing. I think you are right, there should be a sentence or two describing in little more detail.

What about the function name, phasor_at_harmonic? I couldn't come up with anything better...

@bruno-pannunzio
Copy link
Contributor

I thought about the name of the function but also couldn't think of a better one without it being too long. I think we can use this and maybe add a check to see if the phasor is located at the semicircle and if not raise an error?

@cgohlke
Copy link
Member Author

cgohlke commented May 9, 2024

maybe add a check to see if the phasor is located at the semicircle and if not raise an error?

Note that the function only takes the real part of the phasor coordinates as an input. The imaginary part is implied, assumed to be on the semicircle.

@bruno-pannunzio bruno-pannunzio self-requested a review May 9, 2024 19:22
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.

You're right. Then I think the users should use it with caution, but now the description is very explicit on the subject, so it should be OK.

@cgohlke cgohlke merged commit 8e9b123 into phasorpy:main May 9, 2024
13 checks passed
@cgohlke cgohlke deleted the phasor_at_harmonic branch May 9, 2024 22:02
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request May 17, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Jun 24, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Jun 24, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Jun 24, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Jun 24, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Jun 24, 2024
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.

2 participants