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

Added fast dispersion fitter #977

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Added fast dispersion fitter #977

merged 1 commit into from
Jul 26, 2023

Conversation

caseyflex
Copy link
Contributor

@caseyflex caseyflex commented Jun 27, 2023

Features:

  • Passivity enforcement and lossless materials via lower and upper bounds on loss
  • Weighting real / imaginary part
  • Fitting of eps_inf

Known limitations:

  • Running with eps_inf=None can give worse results than running with fixed eps_inf
  • Works quite well on every material in library except the following two:
    • Pd-JohnsonChristy1972, Ni-JohnsonChristy1972

@dbochkov-flexcompute
Copy link
Contributor

some random feedback, not sure if it is already addressed: I happened to play with different fittings recently, and it seemed like fit_fast ignores wvl_range parameter, i.e. it always tries to fit all provided data?

@caseyflex caseyflex changed the base branch from pre/2.3 to pre/2.4 July 17, 2023 23:53
@caseyflex
Copy link
Contributor Author

some random feedback, not sure if it is already addressed: I happened to play with different fittings recently, and it seemed like fit_fast ignores wvl_range parameter, i.e. it always tries to fit all provided data?

thanks, should be fixed now

@caseyflex caseyflex force-pushed the casey/fitter branch 2 times, most recently from 0e1bfbc to a211d5b Compare July 18, 2023 19:37
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.

Looks quite good! It now works well with several metals in my tests. Since we start to support gain medium recently, to fit a gain medium, is it by either setting loss_bounds=(-np.inf, np.inf) or passivity_num_iters=0? As for the latter, it is currently a PositiveInt, so might be good to change it to an int?

@caseyflex caseyflex force-pushed the casey/fitter branch 2 times, most recently from b316e76 to 34000a5 Compare July 18, 2023 23:34
@caseyflex
Copy link
Contributor Author

Looks quite good! It now works well with several metals in my tests. Since we start to support gain medium recently, to fit a gain medium, is it by either setting loss_bounds=(-np.inf, np.inf) or passivity_num_iters=0? As for the latter, it is currently a PositiveInt, so might be good to change it to an int?

Thanks for the comments. It's by setting loss_bounds. I improved the docstrings to make this more clear.

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 to me, I don't understand many of the internals so most of my comments are pretty surface level. More generally, are we considering adding more fitters in the future? If so, it would probably be nice to have a more unified interface in terms of parameters, the general .fit() method (what is displayed, how progress bars work), and the testing. Thanks Casey!

@tylerflex
Copy link
Collaborator

Also, what I've been trying out is marking PRs as "draft" before they are ready for review and then marking "ready for review" when it is ready to review and merge.
image

Copy link
Collaborator

@lucas-flexcompute lucas-flexcompute left a comment

Choose a reason for hiding this comment

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

I don't have much to add from my previous comments or Tyler's points. One thing I noticed is that max_num_poles and min_num_poles seem very similar in purpose, but are accessible in different parts of the API. Is there any deeper reason for this choice (maybe compatibility with other fitters)?

Other than that, I believe we talked about making this fitter the easy default for the user. Is this change in API supposed to be included in this PR? In that case, it should probably be followed by changes in the docs.

@caseyflex
Copy link
Contributor Author

caseyflex commented Jul 19, 2023

Looks good to me, I don't understand many of the internals so most of my comments are pretty surface level. More generally, are we considering adding more fitters in the future? If so, it would probably be nice to have a more unified interface in terms of parameters, the general .fit() method (what is displayed, how progress bars work), and the testing. Thanks Casey!

Thanks for the comments. I don't think we are considering adding more fitters in the future. Just keeping the stable fitter as a backup.

@caseyflex
Copy link
Contributor Author

I don't have much to add from my previous comments or Tyler's points. One thing I noticed is that max_num_poles and min_num_poles seem very similar in purpose, but are accessible in different parts of the API. Is there any deeper reason for this choice (maybe compatibility with other fitters)?

Other than that, I believe we talked about making this fitter the easy default for the user. Is this change in API supposed to be included in this PR? In that case, it should probably be followed by changes in the docs.

Thanks, changed this so they are both optional arguments now. As discussed, I will change the fitter notebook to showcase this one as the default.

@caseyflex caseyflex marked this pull request as ready for review July 19, 2023 20:01
@caseyflex caseyflex requested a review from tylerflex July 19, 2023 20:09
@tylerflex
Copy link
Collaborator

tylerflex commented Jul 25, 2023

@weiliangjin2021 @lucas-flexcompute if you both approve of the PR can you formally approve it through GitHub and then I'll merge it. If you want changes, please request them. thanks!

@tylerflex tylerflex merged commit d301c3b into pre/2.4 Jul 26, 2023
@tylerflex tylerflex deleted the casey/fitter branch July 26, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants