WIP Adapted Qt-relevant files to let Qt version work with the new AbstractDiffractometer - #1659
WIP Adapted Qt-relevant files to let Qt version work with the new AbstractDiffractometer#1659rhfogh wants to merge 10 commits into
Conversation
|
|
||
| logging.getLogger("HWR").debug("X=%s,Y=%s", X, Y) | ||
| chi_angle = math.radians(chi_angle) | ||
| chi_angle = math.radians(chi_angle) if chi_angle else 0. |
There was a problem hiding this comment.
Dont think you need if chi_angle else 0 as you use a kwarg for chi_angle above ?
| sampx.motor: float(sampx.get_value() + sampx.direction * dx), | ||
| sampy.motor: float(sampy.get_value() + sampy.direction * dy), | ||
| phiz.motor: ( | ||
| sampx: float(sampx.get_value() + sampx.direction * dx), |
There was a problem hiding this comment.
Not sure about this one. The previous code used a Motor object as a key while this code would use CentringMotor object. Would that still be compatible with the calling code ? Neither is good practice but I don't think this is the good moment to change that ?
| pixels_per_mm = diffr.get_pixels_per_mm() | ||
| diffr.wait_status_ready(5) | ||
|
|
||
| print(f"self.centring_motors {self.centring_motors}") |
There was a problem hiding this comment.
Please Replace with log if the print is needed
| "centringFailed", | ||
| self.diffractometer_centring_failed, | ||
| ) | ||
| #self.connect( |
There was a problem hiding this comment.
I think this could or most likely will break a number of things ?
| self.emit("centringAccepted", (True, self.get_centring_status())) | ||
| args = (True, self.get_centring_status()) | ||
| self.emit("centringAccepted", args) | ||
| self.create_centring_point(*args) |
There was a problem hiding this comment.
I think this should be done in the handler that listens to centringAccepted
There was a problem hiding this comment.
Indeed only the signal emit is needed here.
|
Looks good overall, I'm concerned about the changes made to sample_centring.py
|
|
@marcus-oscarsson Thanks for checking. I have changed this to WIP, and I think we need to wait for Martin Savko's input. He was the one who did the changes, and I had done a quick smoke test, found it worked, and made the PR. Maybe that was a mistake. Anyway with some of your comments I think we had better hear from Martin either why this is all OK, or that he does not think this is yet ready for merging and what might need doing. |
|
No problem, its of course very much appreciated that both of you would like to advance. You did well :). We are using both |
MotorMockup.py: default direction is 1 sample_centring.py: motor.motor -> motor e.g. sampx.motor -> sampx queue_model_objects.py: call set_diffractometer_motor_names(names) in __init__()
comment out lights for now in the config file for now.
822ecec to
981be73
Compare
There was a problem hiding this comment.
Dear @rhfogh, thanks for doing the adaptation of the Qt. Most of it is fine, just few comments:
The GenericDiffractometer should not be involved if you go for AbstractDiffractometer.
Some of the changes in SampleView will actually break it.
| def accept_centring(self): | ||
| return True | ||
|
|
||
| def user_confirms_centring(self): | ||
| return False |
There was a problem hiding this comment.
Everything concerning the centring is now in SampleView.
| def accept_centring(self): | |
| return True | |
| def user_confirms_centring(self): | |
| return False |
|
|
||
| def use_sample_changer(self): | ||
| return True | ||
|
|
|
|
||
| CENTRING_MOTORS_NAME = [ | ||
| "phi", | ||
| "omega", |
There was a problem hiding this comment.
GenericDiffractometer should be replaced by AbstractDiffractometer.
| for key, val in self.centring_motors.items(): | ||
| motors_dict.update({key: val.motor.get_value()}) | ||
| motors_dict = dict( | ||
| (key, val.get_value()) for key, val in self.centring_motors.items() |
There was a problem hiding this comment.
| (key, val.get_value()) for key, val in self.centring_motors.items() | |
| (key, val.motor.get_value()) for key, val in self.centring_motors.items() |
Do you really need to change this for the sake of a one line less? 😄
| pixels_per_mm = diffr.get_pixels_per_mm() | ||
| diffr.wait_status_ready(5) | ||
|
|
||
| print(f"self.centring_motors {self.centring_motors}") |
| self.emit("centringAccepted", (True, self.get_centring_status())) | ||
| args = (True, self.get_centring_status()) | ||
| self.emit("centringAccepted", args) | ||
| self.create_centring_point(*args) |
There was a problem hiding this comment.
Indeed only the signal emit is needed here.
| args = (False, self.get_centring_status()) | ||
| self.emit("centringAccepted", args) |
There was a problem hiding this comment.
What was the reason to define args?
| for mot in self.motors_hwobj_dict.values(): | ||
| mot.set_value(random.uniform(0.0, 8.8)) | ||
| self.omega.set_value(random.uniform(0, 359.9)) | ||
| self.omega.set_value(random.uniform(0, 360)) |
|
|
||
| def get_image_scale_list(self): | ||
| return [1] |
There was a problem hiding this comment.
Could you, please, tell us what is this used for?
|
@beteva As I said to Marcus, this is (almost) all Martin's work, and it is possible that I went with an incomplete version. I take your comments on board, but I think we need Martin to react to them first before I start making changes. |
The main work is by Martin Savko, making QtGraphicsManager a subtype of SampleView - which should impact the Qt version only. There are other adjustments, and some GPhL-specific fixes. The version is smoke-tested with both the Qt and web version in mock mode.