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

Refactor fit bragg peaks and add unit tests #53

Merged
merged 16 commits into from
Apr 14, 2023
Merged

Conversation

MialLewis
Copy link
Collaborator

@MialLewis MialLewis commented Mar 23, 2023

Description of work:

Refactors the _fit_bragg_peaks portion of EVSCalibrationFit, making it easier to follow and unit test. This was probably the most convoluted function.

Unit tests have been added where the code has been refactored.

To test:
Review code.
Review test changes.
Ensure all automated tests pass.
Ensure the tests in test_system.py pass locally (You can run the system tests using python -m unittest discover -s ./unpackaged/vesuvio_calibration/tests/system from the root of the repository.) Note that test_fit_bragg_peaks_copper and test_fit_bragg_peaks_lead are unreliable and fail on different detectors on different PCs. Please post the stack trace if they fail on your machine.

@MialLewis MialLewis marked this pull request as ready for review April 3, 2023 16:08
@robertapplin robertapplin self-assigned this Apr 12, 2023
Copy link
Collaborator

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

Lots of new tests which is great 👍 I have a few code suggestions but feel free to push back if you disagree

@MialLewis MialLewis requested a review from robertapplin April 14, 2023 08:54
@robertapplin
Copy link
Collaborator

I get one failure locally:

FAIL: test_fit_bragg_peaks_copper (test_system.TestEVSCalibrationFit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\mlc47243\AppData\Local\mambaforge\envs\mantidnightly\lib\site-packages\mock\mock.py", line 1417, in patched
    return func(*newargs, **newkeywargs)
  File "C:\Users\mlc47243\Documents\mantid-dev\vesuvio\unpackaged\vesuvio_calibration\tests\system\test_system.py", line 374, in test_fit_bragg_peaks_copper
    self.assert_fitted_positions_match_expected(expected_values, params_table,
  File "C:\Users\mlc47243\Documents\mantid-dev\vesuvio\unpackaged\vesuvio_calibration\tests\system\test_system.py", line 474, in assert_fitted_positions_match_expected
    raise AssertionError(error_dict)
AssertionError: {'f3.LorentzPos': ['Element 15: Expected 11323.436309381943, found 4574.390063160628. atol 6749.0462462213145, rtol 1.4753980646674738,max tol: 0.1']}

is this expected?

@MialLewis
Copy link
Collaborator Author

MialLewis commented Apr 14, 2023

Yes that's expected, going to let that failure go for now and fix in a later PR.

Copy link
Collaborator

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

Thanks, happy to approve in that case 👍

@MialLewis MialLewis merged commit b2ba5be into main Apr 14, 2023
@MialLewis MialLewis deleted the refactor_fit_bragg_peaks branch April 14, 2023 10:41
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.

2 participants