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

Fast Dispersion Fitter: keep poles slightly away from input freqs #1672

Merged
merged 1 commit into from
May 8, 2024

Conversation

caseyflex
Copy link
Contributor

@caseyflex caseyflex commented May 3, 2024

Sometimes in the fitter, the poles move close to the input freqs. When they move too close, the response function is invalid and the fitter errors. This PR keeps them a certain distance (1e-10 rad/s) away.

This PR should fix this issue:
#1631

@caseyflex caseyflex linked an issue May 3, 2024 that may be closed by this pull request
@caseyflex caseyflex self-assigned this May 3, 2024
@caseyflex caseyflex added rc2 2nd pre-release 2.7 will go into version 2.7.* labels May 3, 2024
Copy link
Collaborator

@tylerflex tylerflex left a comment

Choose a reason for hiding this comment

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

Looks good, just wondering if we should warn when this gets triggered

for omega in self.omega
for pole in self.complex_poles
):
return self
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to warn or anything here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks. @weiliangjin2021 , do you think we should warn here? I actually think the resulting model in these cases is as expected / as desired, so no need to warn the user. The fix is just preventing the fitter from trying to further improve a model which is already quite good, when the improvement would limit in this error. But I'm not sure exactly about your use case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could also use fp_eps instead of 1e-10. Might be more robust that way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, since it's accurate enough, I think no need to warn.

@momchil-flex
Copy link
Collaborator

This can be merged right?

@caseyflex
Copy link
Contributor Author

caseyflex commented May 8, 2024 via email

@momchil-flex momchil-flex merged commit 484ca86 into pre/2.7 May 8, 2024
16 checks passed
@momchil-flex momchil-flex deleted the casey/fitterfix branch May 8, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7 will go into version 2.7.* rc2 2nd pre-release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Division by 0 error in FastFitter
4 participants