Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ShareParameters
Linear Objective #1320base: master
Are you sure you want to change the base?
Add
ShareParameters
Linear Objective #1320Changes from 4 commits
46da834
acbdfe4
760bb74
785d377
8463c97
c60b8db
3e6c9e6
51bda6f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought they didn't have to be the same type, just have the same attribute name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea but then I thought of all the ways this could mess up, like
Equilibrium.R_lmn
andFourierRZToroidalSurface.R_lmn
are the same name, yet even if they are the same shape it makes no sense to have them be shared.I can change it if you think that is not a good enough counterpoint not to, but is there an example where it makes sense to allow this?
Check warning on line 307 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L305-L307
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just check that getattr(thing, param).shape is consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or check the param dict directly
Check warning on line 313 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L313
Check warning on line 334 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L334
Check warning on line 341 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L337-L341
Check warning on line 343 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L343
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this account for things where idx is just a book to fix all/none?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so as all of my tests just use
True
for the param idx.The
default_params
andsetdefault
in this build method are what make sureself._indices
becomes the full arange or not if it is True or FalseCheck warning on line 346 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L346
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set target=0 in init this should happen automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I make sure that target does not get passed in ever with some sort of check in init? or is not including it in docstring enough to say that one should never pass it in? I worry someone will put a target of like what they wanna fix to and that will mess the objective up, as it would not really be caught anywhere (if the target is say a single number, as it would be broadcastable to the dim_f size)
Check warning on line 348 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L348
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May take more than 2 things
Check warning on line 384 in desc/objectives/linear_objectives.py
Codecov / codecov/patch
desc/objectives/linear_objectives.py#L383-L384