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

adding bmin and bmax #126

Merged
merged 5 commits into from
Feb 8, 2024
Merged

adding bmin and bmax #126

merged 5 commits into from
Feb 8, 2024

Conversation

nneveu
Copy link
Member

@nneveu nneveu commented Jan 24, 2024

Re-ran yaml generation script to include bmin and bmax in most magnet yaml files. Screens are still missing some data in a few areas.

#103

@nneveu
Copy link
Member Author

nneveu commented Jan 29, 2024

I needed to add the new properties in the magnet class/PV list as well.

@nneveu
Copy link
Member Author

nneveu commented Jan 30, 2024

Not sure why this started failing on the fit test. Looking into it.

@nneveu
Copy link
Member Author

nneveu commented Jan 30, 2024

Output of fit test tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py seems to vary with # of runs. I'm looking into adjusting this test to be more consistent.

Output from running the test several times back to back:

(tools) PC101046:lcls-tools nneveu$ python -m unittest tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py
..failed returning param guesses: [4.176414857839097, 205, 100.0, 1.3921382859463656, 102.5, 50.0, 0.9064490469346526]
.


Ran 3 tests in 0.417s

OK

(tools) PC101046:lcls-tools nneveu$ python -m unittest tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py
./Users/nneveu/github/lcls-tools/lcls_tools/common/data_analysis/fitting_tool.py:214: RuntimeWarning: invalid value encountered in scalar power
return amp * np.exp((-abs(x - mu) ** (P)) / (2 * sig ** (P))) + offset
..


Ran 3 tests in 0.048s

OK

(tools) PC101046:lcls-tools nneveu$ python -m unittest tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py
...


Ran 3 tests in 0.024s

OK

(tools) PC101046:lcls-tools nneveu$ python -m unittest tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py
/Users/nneveu/miniconda3/envs/tools/lib/python3.11/site-packages/scipy/optimize/_minpack_py.py:1010: OptimizeWarning: Covariance of the parameters could not be estimated
warnings.warn('Covariance of the parameters could not be estimated',
...


Ran 3 tests in 0.014s

OK

(tools) PC101046:lcls-tools nneveu$ python -m unittest tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py
.F.
======================================================================
FAIL: test_fit_tool_gaussian (tests.unit_tests.lcls_tools.common.data_analysis.test_fit_gauss.TestFitTool.test_fit_tool_gaussian)


Traceback (most recent call last):
File "/Users/nneveu/github/lcls-tools/tests/unit_tests/lcls_tools/common/data_analysis/test_fit_gauss.py", line 37, in test_fit_tool_gaussian
self.assertLessEqual(val["rmse"], 0.4)
AssertionError: 0.8434927791146087 not less than or equal to 0.4


Ran 3 tests in 0.016s

FAILED (failures=1)

@nneveu
Copy link
Member Author

nneveu commented Feb 7, 2024

Opened new issue #130 to address the fit test failing problem. Will skip the fitting tests then merge this code if all other tests pass.

@nneveu
Copy link
Member Author

nneveu commented Feb 7, 2024

This PR is passing relevant tests now and is ready for review.

@MattKing06
Copy link
Collaborator

I couldn't access EPICS as I'm not on SLAC network but the unit test cases pass, so the attribute exists at least.

I can see the docstring says that bmin/bmax could be in kG or kGm^-1, I was wondering if adding a b_units property that was dependent on magnet type (which has been added) could be useful? Probably for another issue.

other than that I'm happy to merge as there is a separate issue opened for dealing with the skipped test cases.

Copy link
Collaborator

@lisazacarias lisazacarias 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, but I'll admit that I skimmed the yaml files lol

@nneveu nneveu merged commit 6510b5b into main Feb 8, 2024
2 checks passed
@nneveu nneveu deleted the 103_add_bmin_bmax_to_yaml branch February 8, 2024 19:00
Derikka pushed a commit to Derikka/lcls-tools that referenced this pull request Mar 17, 2024
* adding bmin and bmax to yamls and magnet device

* fixing tests

* formatting fixes

* skipping fitting tests that fail. Will fix in issue slaclab#130
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