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

Separate physics package and detector filters #1773

Merged
merged 14 commits into from
Jan 10, 2025

Conversation

bnmajor
Copy link
Collaborator

@bnmajor bnmajor commented Jan 8, 2025

All instruments should have the option to apply the physics package, the absorption correction, or both. This PR:

  • Removes restrictions around which instruments have the option to add a physics package
  • Removes restrictions around which instruments have the option to apply absorption correction
  • The physics package is no longer a prerequisite for absorption correction

Relies on HEXRD/hexrd#741

Brianna Major added 4 commits January 8, 2025 08:56
Rather than using the update_physics_package function to also remove the
package (set it to None), set it to None explicitly. The update function should
only be used for actually updating the package.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
If the physics package is needed but missing, warn users and allow them to make
the decision.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
Users can have one without the other - remove any interdependencies that
previously prevented this.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
@pep8speaks
Copy link

pep8speaks commented Jan 8, 2025

Hello @bnmajor! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 17:80: E501 line too long (81 > 79 characters)

Comment last updated at 2025-01-10 01:16:50 UTC

Brianna Major added 4 commits January 9, 2025 11:55
Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
The physics package option in the "edit" menu is no longer hidden based on
instrument type. There are now two options: apply physics package, and edit
physics package.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
- Whether or not the Physics Package is used is now indicated by a separate
  flag: "use_physics_package".
- Users can only edit the physics package if "use_physics_package" is true
- If "apply physics package" is selected the package manager dialog will
  automatically be displayed
- While the physics package is no longer limited to PXRDIP and TARDIS it is
  still automatically applied after using the LLNL Import tool.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
@bnmajor bnmajor force-pushed the physics-pkg-and-filters branch from 0098a81 to 9b6226e Compare January 9, 2025 16:55
@bnmajor bnmajor requested a review from psavery January 9, 2025 17:07
@bnmajor bnmajor marked this pull request as ready for review January 9, 2025 17:07
@bnmajor bnmajor force-pushed the physics-pkg-and-filters branch from 59a4f21 to d8b11a4 Compare January 9, 2025 17:37
Brianna Major added 5 commits January 9, 2025 16:52
If "apply physics package" is selected make sure that we have a default physics
package set if it was None. If we're setting the physics package to default we
can infer we want to apply it as well. Keep the two states in sync.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
This is for backwards compatability. Previously, when detector coatings were
set after using the LLNL import tool the "default" detector (used to represent
the current detector during import) was not removed after import was complete.
This means that some old state files will have this value and try to fetch this
detector's information, even though it no longer exists.

Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
Signed-off-by: Brianna Major <brianna.major@taloid.khq.kitware.com>
@bnmajor bnmajor force-pushed the physics-pkg-and-filters branch from d8b11a4 to 4a7a949 Compare January 9, 2025 21:53
@psavery psavery force-pushed the physics-pkg-and-filters branch from db29ee3 to 1629fbb Compare January 10, 2025 01:08
dialog.show()
# Always assume Physics Package is needed for LLNL import
dialog.ui.complete.clicked.connect(
lambda: self.on_action_include_physics_package_toggled(True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would create a new connection every time the LLNL import tool is shown. I'll move this to setup_connections() instead. Otherwise, this could get triggered multiple times.

# This will require a physics package
HexrdConfig().create_default_physics_package()
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to continue creating a default physics package for backward compatibility with old state files, that had tth_distortion set but the physics package did not exist yet. I'll fix this.

I removed the `use_physics_package` variable from `HexrdConfig()` because
it could have been simplified by simply checking if the physics package
existed.

I also fixed a few issues and cleaned up a few things.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@psavery psavery force-pushed the physics-pkg-and-filters branch from 1629fbb to d363b6d Compare January 10, 2025 01:16
Copy link
Collaborator

@psavery psavery left a comment

Choose a reason for hiding this comment

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

LGTM in the things I've tested so far.

@psavery psavery merged commit 8393744 into HEXRD:master Jan 10, 2025
9 checks passed
@psavery psavery deleted the physics-pkg-and-filters branch January 10, 2025 01:21
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.

3 participants