-
Notifications
You must be signed in to change notification settings - Fork 102
Propose update in calib.py import #2695
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
Conversation
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.
Apparently, putting widgets outside of the try/except block breaks the tests on windows ...
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 did first pip install . in my env. Then I tried to run the notebook, but it failed.
The cell starting with
%matplotlib widget
calib = Calibration(img, calibrant=AgBh, wavelength=wavelength, detector=pilatus)failed with an error in calib.py in line 22 self.mplw = widgets.Output()
I just run python run_tests.py (without -xo) again:
Ran 569 tests in 306.110s
OK (skipped=48)With -xo
----------------------------------------------------------------------
Ran 495 tests in 248.661s
OK (skipped=20)Do you mean the tests test_bug_2538 until test_sort4?
Then I have to go back and figure out another solution.
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.
@kif I would like to make the following suggestion for calib.py
try:
from IPython.display import display
import ipywidgets as widgets
except (ImportError, ModuleNotFoundError):
try:
# for compatibility with older Python
from IPython.core.display import display
import ipywidgets as widgets
except (ImportError, ModuleNotFoundError):
from ...utils.callback import dangling_callback as displayIPython.core.displayreplaced byIPython.displayfor modern IPython.- Fallback kept for backward compatibility.
- Catch now
(ImportError, ModuleNotFoundError)instead of a bareexcept.
https://ipython.readthedocs.io/en/stable/whatsnew/version7.html#pending-deprecated-imports
The test statistics are the same with this snippet with python run_tests.py
----------------------------------------------------------------------
Ran 569 tests in 295.597s
OK (skipped=48)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.
Why did you add the PONI-file to the test ?
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 you might prefer an updated file that fits the outcome of the ipynb. But I can add *.poni to my .gitignore.
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.
It is just that the notebook is re-run at each release and it makes no sense to update the file as it comes from a least squares refinement of randomly selected points: not deterministic.
Added import for ipywidgets to enhance Jupyter compatibility.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
kif
left a comment
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.
The modification on the notebook look great.
Calibration Notebook and widgets Update
Summary of Changes
Calibration Widget Fix
ipywidgetsinpyFAI/gui/jupyter/calib.pyto ensure thewidgetsnamespace is always defined.IPython.displayandipywidgetsimports for better compatibility in different environments (VS Code, JupyterLab, Jupyter Notebook).Notebook Cleanup
calibration_with_jupyter.ipynb.Behavior
Notes