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

Improve passivity enforcement near high-Q poles in FastDispersionFitter #1894

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

caseyflex
Copy link
Contributor

@caseyflex caseyflex commented Aug 8, 2024

The passivity enforcement including imag_ep_extrema and omega_range was not sufficient when the fit PoleResidue model contained high-Q poles. This PR adds extra samples around each pole in order to improve the passivity enforcement. Specifically, the samples are computed using an explicit formula for extrema around a single pole.

The fit for the example data in the issue remains poor -- this is to be expected, since the data exhibits dispersion but has no loss.

@caseyflex caseyflex linked an issue Aug 8, 2024 that may be closed by this pull request
@caseyflex caseyflex added the 2.7 will go into version 2.7.* label Aug 8, 2024
@caseyflex caseyflex self-assigned this Aug 8, 2024
@caseyflex caseyflex force-pushed the casey/activefitter branch 2 times, most recently from 1367bb8 to b2cbedc Compare August 8, 2024 13:41
Copy link
Contributor

@alec-flexcompute alec-flexcompute 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 if it passes this test! Not sure how the fixes you made exactly work but it looks reasonable :)

@caseyflex
Copy link
Contributor Author

caseyflex commented Aug 8, 2024 via email

@caseyflex caseyflex marked this pull request as draft August 8, 2024 15:00
@caseyflex
Copy link
Contributor Author

caseyflex commented Aug 8, 2024

OK, I'm happy with this now. I fixed the formula and am no longer rejecting models on the basis of being high-Q. This PR just adds one or two extra samples around each pole, except for marginally-stable poles, the handling of which is not changed.

It might be worth checking some of the material_library fits to see if anything changed (indicating that previously the fit wasn't actually passive)

@caseyflex caseyflex marked this pull request as ready for review August 8, 2024 15:30
@alec-flexcompute
Copy link
Contributor

ah, this is a good point. Nice work @caseyflex!

@caseyflex
Copy link
Contributor Author

ah, this is a good point. Nice work @caseyflex!

thanks for finding the issue!

Copy link
Collaborator

@weiliangjin2021 weiliangjin2021 left a comment

Choose a reason for hiding this comment

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

Nice work! When I tried Alec's medium, the original extrema finder is able to find the frequency that violates the passivity. Is the fix to sample more frequency points around this region?

Also I wonder if it's better to merge to pre/2.8 to avoid resolving lots of conflicts?

@caseyflex
Copy link
Contributor Author

Nice work! When I tried Alec's medium, the original extrema finder is able to find the frequency that violates the passivity. Is the fix to sample more frequency points around this region?

Also I wonder if it's better to merge to pre/2.8 to avoid resolving lots of conflicts?

So originally, I tried using logic as in imag_ep_extrema_with_samples, using an additional frequency range based on the data frequency range. However, the fitter was able to come up with a model that was passive at these additional frequencies too, while still not being uniformly passive, even in the frequency range of interest. So I concluded that the sampling was not working well because of these high-Q poles. The new samples I added should be tailored to the poles themselves, so as to avoid this pitfall of uniform logspace sampling.

Regarding pre/2.8 or develop: technically this is a bug fix, so typically it would go in develop. I think either way I'll be the one resolving the conflicts, and since I did both the fitter separation PR and this one, I should be able to do it without much difficulty either way.

@weiliangjin2021
Copy link
Collaborator

So originally, I tried using logic as in imag_ep_extrema_with_samples, using an additional frequency range based on the data frequency range. However, the fitter was able to come up with a model that was passive at these additional frequencies too, while still not being uniformly passive, even in the frequency range of interest. So I concluded that the sampling was not working well because of these high-Q poles. The new samples I added should be tailored to the poles themselves, so as to avoid this pitfall of uniform logspace sampling.

What a smart fitter!

Regarding pre/2.8 or develop: technically this is a bug fix, so typically it would go in develop. I think either way I'll be the one resolving the conflicts, and since I did both the fitter separation PR and this one, I should be able to do it without much difficulty either way.

Sounds good.

@caseyflex
Copy link
Contributor Author

I checked against most of the material_library. It didn't seem to change most of the fits at all; it changed the following fits in a very small / insignificant way:

AlAs/FernOnton1971
Si3N4/Luke2015PMLStable
Si3N4/Luke2015Sellmeier

so it's possible that the fitter was previously returning mediums that slightly violated passivity at some frequencies for these materials; but anyway it's ok, we aren't using the fitter result in the material library.

And this confirms that the fitter still works well with this change, so we should be OK to merge this.

@momchil-flex momchil-flex merged commit 99c2d10 into develop Aug 21, 2024
15 checks passed
@momchil-flex momchil-flex deleted the casey/activefitter branch August 21, 2024 12:37
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.*
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fitting creates active material
5 participants