-
Notifications
You must be signed in to change notification settings - Fork 52
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
Updated versions of DESY P11 HO (PR 800, 854) #856
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2efe26a
Updated versions of DESY P11 HO (PR 800, 854)
ed5d80e
Black and autopep8
28207a5
Code cleanup (PR 856)
4183d64
Changed prints to logging (PR856)
4a6e8c9
Merge branch 'mxcube:develop' into p11_develop_HO
agruzinov f99b368
Bumped the year
dafc144
Linting
4a6577c
autoflate step
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Project: MXCuBE | ||
# https://github.com/mxcube | ||
# | ||
# This file is part of MXCuBE software. | ||
# | ||
# MXCuBE is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# MXCuBE is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with MXCuBE. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""P11Beam""" | ||
|
||
from mxcubecore.HardwareObjects.abstract.AbstractBeam import AbstractBeam | ||
from mxcubecore.BaseHardwareObjects import HardwareObjectState | ||
|
||
|
||
__credits__ = ["DESY P11"] | ||
__license__ = "LGPLv3+" | ||
__category__ = "General" | ||
|
||
|
||
class P11Beam(AbstractBeam): | ||
def __init__(self, *args): | ||
super().__init__(*args) | ||
|
||
self._beam_size_dict = {"aperture": [9999, 9999], "slits": [9999, 9999]} | ||
|
||
self._beam_position_on_screen = [340, 256] | ||
|
||
self.focus_sizes = { | ||
-1: {"label": "unknown", "size": (0.2, 0.2)}, | ||
0: {"label": "flat", "size": (0.2, 0.2)}, | ||
1: {"label": "200x200", "size": (0.2, 0.2)}, | ||
2: {"label": "100x100", "size": (0.1, 0.1)}, | ||
3: {"label": "50x50", "size": (0.05, 0.05)}, | ||
4: {"label": "20x20", "size": (0.02, 0.02)}, | ||
5: {"label": "4x9", "size": (0.009, 0.004)}, | ||
} | ||
|
||
def init(self): | ||
self.mirror_idx_ch = self.get_channel_object("beamsize") | ||
self.mirror_state_ch = self.get_channel_object("state") | ||
|
||
if self.mirror_idx_ch is not None: | ||
self.mirror_idx_ch.connect_signal("update", self.mirror_idx_changed) | ||
if self.mirror_state_ch is not None: | ||
self.mirror_state_ch.connect_signal("update", self.mirror_state_changed) | ||
|
||
self.mirror_idx_changed() | ||
self.mirror_state_changed() | ||
|
||
def get_beam_info_state(self): | ||
if self.mirror_state_ch is not None: | ||
tango_state = self.mirror_state_ch.get_value() | ||
return self._convert_tango_state(tango_state) | ||
|
||
return self.STATES_READY | ||
|
||
def get_slits_gap(self): | ||
return None, None | ||
|
||
def mirror_state_changed(self, state=None): | ||
|
||
if state is None: | ||
state = self.get_beam_info_state() | ||
|
||
self.update_state(self._convert_tango_state(state)) | ||
|
||
def _convert_tango_state(self, state): | ||
str_state = str(state) | ||
|
||
if str_state == "ON": | ||
_state = self.STATES.READY | ||
elif str_state == "MOVING": | ||
_state = self.STATES.BUSY | ||
else: | ||
_state = self.STATES.FAULT | ||
return _state | ||
|
||
def mirror_idx_changed(self, value=None): | ||
|
||
if value is None: | ||
value = self.mirror_idx_ch.get_value() | ||
|
||
self.log.debug(f"P11Beam - mirror idx changed. now is {value}") | ||
|
||
if value not in self.focus_sizes: | ||
value = -1 | ||
self.log.debug(f" - UNKNOWN mirror index") | ||
|
||
curr_size_item = self.focus_sizes[value] | ||
self.log.debug( | ||
f" current mirror focus is {curr_size_item['label']}: {curr_size_item['size']}" | ||
) | ||
|
||
self._beam_size_dict["aperture"] = curr_size_item["size"] | ||
|
||
self.evaluate_beam_info() | ||
self.re_emit_values() |
Oops, something went wrong.
Oops, something went wrong.
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.
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 like the idea of this the AlbulaView, as I understand it it starts Albula on the same machine as MXCuBE is running and gets the images from the detector zero-mq stream ?
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.
Yes, but it is not completely implemented. Also in the python 3.11 this line leads to the segfault anyway. This will require a bit more work yet.
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.
Ok, i see. Did you also foresee to display a certain image on demand ?
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.
Ideally it is working right now with in-house software as a standard viewer (made by Jan). It shows the monitor interfaces during data collection and than changes to the recently collected file and shows it afterwards, so one can scroll back if needed. I was trying to understand whether the Adxv can show anything during data collection, but before hdf5 is saved, there is no way I guess.
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.
Hm, not sure. I don't think so