rework motor tweak

This commit is contained in:
2022-08-19 09:51:21 +02:00
parent 9e72b681a4
commit 3ef576f690
5 changed files with 108 additions and 73 deletions

View File

@@ -290,7 +290,7 @@ class Main(QMainWindow, Ui_MainWindow):
self.prepare_microscope_page()
self.prepare_embl_gui()
self.prepare_left_tabs()
#self.update_beam_marker(qoptic_zoom.get_position()) #ZAC: orig. code
#self.update_beam_marker(qoptic_zoom.get_sp()) #ZAC: orig. code
self._centerpiece_stack.setCurrentIndex(0)
self._centerpiece_stack.currentChanged.connect(self.center_piece_update)
self.init_validators()
@@ -300,7 +300,7 @@ class Main(QMainWindow, Ui_MainWindow):
self.create_helical_widgets() #ZAC: orig. code
self.center_piece_update(0) # start camera updater
curzoom = app._zoom.get_sp()
curzoom = app._zoom.get_val()
_log.debug(f"starting app with zoom at {curzoom}")
self.zoom_changed_cb(curzoom)
self._tabs_daq_methods.currentChanged.connect(self.switch_task)
@@ -973,9 +973,9 @@ class Main(QMainWindow, Ui_MainWindow):
app = QApplication.instance()
self._tab_daq_method_embl.setLayout(QVBoxLayout())
layout = self._tab_daq_method_embl.layout()
motors = self.get_gonio_motors()
#motors = self.get_gonio_motors()
self._embl_module = EmblWidget(self) #ZAC: orig. code
self._embl_module.configure(motors, app._camera, app._zoom)
#self._embl_module.configure(motors, app._camera, app._zoom)
layout.addWidget(self._embl_module)
def prepare_microscope_page(self):
@@ -1074,12 +1074,12 @@ class Main(QMainWindow, Ui_MainWindow):
# state = (zoom, fx, fy) (created at first call of self.track_objects() )
app=QApplication.instance()
geo=app._geometry
zoom = app._zoom.get_sp()
zoom = app._zoom.get_val()
fast_x=self.tweakers["fast_x"];fast_y=self.tweakers["fast_y"]
# TODO: get_position() is delayed as it is the RBV. do same as for the zoom
# TODO: and return the last set_point
fx=fast_x.get_position()
fy=fast_y.get_position()
fx=fast_x.get_val()
fy=fast_y.get_val()
try:
tracked=self._goTracked
zoom_old,fx_old,fy_old=tracked['state']
@@ -1176,7 +1176,7 @@ class Main(QMainWindow, Ui_MainWindow):
self._mouse_pos = pos
task = self.active_task()
xy = self._goImg.mapFromScene(pos)
z = app._zoom.get_sp()
z = app._zoom.get_val()
#_log.debug('mouse_pos:{} scene_pos:{} zoom:{}'.format(pos,xy,z))
#TODO: implement mouse handling
# if self._ppm_toolbox._force_ppm > 0:
@@ -1217,7 +1217,7 @@ class Main(QMainWindow, Ui_MainWindow):
def mouse_click_event_geometry_calib(self, event):
app=QApplication.instance()
zoom = app._zoom.get()
zoom = app._zoom.get_val()
fast_x=self.tweakers["fast_x"];fast_y=self.tweakers["fast_y"]
if self._btn_pix2pos.isChecked():
try:
@@ -1225,8 +1225,8 @@ class Main(QMainWindow, Ui_MainWindow):
except KeyError as e:
raw=app._raw_pix2pos[zoom]=list()
imgPos=self._goImg.mapFromScene(event.scenePos())
fx=fast_x.get_position();
fy=fast_y.get_position()
fx=fast_x.get_rbv();
fy=fast_y.get_rbv()
x=imgPos.x();y=imgPos.y()
_log.debug('append calib: zoom:{} stage_x_y:{}/{} cam_pix_x_y:{}/{}'.format(zoom, fx, fy, x, y))
raw.append((fx, fy, x, y))
@@ -1321,7 +1321,7 @@ class Main(QMainWindow, Ui_MainWindow):
event.ignore()
return
pos = event.scenePos()
zoom_level = app._zoom.get()
zoom_level = app._zoom.get_val()
_log.debug(" zoom {}".format(zoom_level))
try:
@@ -1440,7 +1440,7 @@ class Main(QMainWindow, Ui_MainWindow):
def get_beam_mark_on_camera_xy(self):
app=QApplication.instance()
z = app._zoom.get()
z = app._zoom.get_val()
try:
bx = self.beamx_fitter(z)
by = self.beamy_fitter(z)
@@ -2125,8 +2125,8 @@ class Main(QMainWindow, Ui_MainWindow):
def daq_grid_add_grid(self, gx=None, gy=None):
grid_index = len(self._grids)
if gx in (False, None):
gx=self.tweakers["fast_x"].get_position()
gy=self.tweakers["fast_y"].get_position()
gx=self.tweakers["fast_x"].get_rbv()
gy=self.tweakers["fast_y"].get_rbv()
xstep = self._sb_grid_x_step.value()
ystep = self._sb_grid_y_step.value()
xoffset = self._sb_grid_x_offset.value()