towards new pix2pos calibration part 2
This commit is contained in:
53
swissmx.py
53
swissmx.py
@@ -75,8 +75,7 @@ TASK_PRELOCATED = "prelocated"
|
||||
TASK_HELICAL = "helical"
|
||||
TASK_EMBL = "embl"
|
||||
|
||||
|
||||
import PrelocatedCoordinatesModel
|
||||
import PrelocatedCoordinatesModel # ZAC: orig. code
|
||||
from EmblModule import EmblWidget #ZAC: orig. code
|
||||
from HelicalTable import HelicalTableWidget #ZAC: orig. code
|
||||
#from Wigis import Spinner, Checkbox #ZAC: orig. code
|
||||
@@ -798,7 +797,6 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
grp.layout().addWidget(self._ppm_feature_size_spinbox, 0, 1)
|
||||
self._ppm_calibration = but = QPushButton("Start calibration")
|
||||
but.setCheckable(True)
|
||||
#but.clicked.connect(lambda x: self.update_ppm_fitters())
|
||||
but.clicked.connect(self.update_ppm_fitters)
|
||||
grp.layout().addWidget(but, 1, 0, 1, 2)
|
||||
help = QTextBrowser()
|
||||
@@ -973,46 +971,6 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
del app._ppmRaw
|
||||
return
|
||||
|
||||
|
||||
|
||||
if calib is not None:
|
||||
_log.info("received new calibration for PPM")
|
||||
self._zoom_to_ppm = calib
|
||||
|
||||
# self._zoom_to_ppm = { # FIXME: eventually automate
|
||||
# 1: 830,
|
||||
# 100: 940,
|
||||
# 200: 1220,
|
||||
# 400: 1950,
|
||||
# 600: 3460,
|
||||
# 800: 5400,
|
||||
# 900: 7150,
|
||||
# 1000: 9200,
|
||||
# }
|
||||
|
||||
num_points = len(self._zoom_to_ppm)
|
||||
if num_points < 2:
|
||||
return
|
||||
elif num_points < 4:
|
||||
order = 2
|
||||
elif num_points < 6:
|
||||
order = 3
|
||||
else:
|
||||
order = 4
|
||||
|
||||
_log.debug("polynomial fitting using {} data points of order {}".format(num_points, order))
|
||||
bx = [(z, ppm) for z, ppm in self._zoom_to_ppm.items()]
|
||||
nbx = np.asarray(bx).T
|
||||
bx_coefs = np.polyfit(nbx[0], nbx[1], order)
|
||||
_log.debug(".... ppm fitting coeficients {}".format(bx_coefs))
|
||||
self.ppm_fitter = np.poly1d(bx_coefs)
|
||||
|
||||
def getFastX(self):
|
||||
return self.tweakers["fast_x"].get_position()
|
||||
|
||||
def getFastY(self):
|
||||
return self.tweakers["fast_y"].get_position()
|
||||
|
||||
def zoom_changed_cb(self, value):
|
||||
self.zoomChanged.emit(value)
|
||||
try:
|
||||
@@ -1125,8 +1083,6 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
raw=app._ppmRaw[zoom]
|
||||
except (AttributeError,KeyError) as e:
|
||||
if type(e) is AttributeError:
|
||||
_log.info("")
|
||||
msg="SwissMX *POST-SAMPLE-TUBE* configuration is incomplete!!!"
|
||||
QMessageBox.warning(self, "pix2pos calibration", "Press 'Start calibration' button first")
|
||||
return
|
||||
app._ppmRaw=dict()
|
||||
@@ -1967,7 +1923,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, gy = self.getFastX(), self.getFastY()
|
||||
gx=self.tweakers["fast_x"].get_position()
|
||||
gy=self.tweakers["fast_y"].get_position()
|
||||
xstep = self._sb_grid_x_step.value()
|
||||
ystep = self._sb_grid_y_step.value()
|
||||
xoffset = self._sb_grid_x_offset.value()
|
||||
@@ -3174,8 +3131,8 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
if SKIP_ESCAPE_TRANSITIONS_IF_SAFE not in keys:
|
||||
settings.setValue(SKIP_ESCAPE_TRANSITIONS_IF_SAFE, False)
|
||||
|
||||
if EXPERIMENT_PGROUP not in keys:
|
||||
self.update_user_and_storage()
|
||||
#if EXPERIMENT_PGROUP not in keys:
|
||||
# self.update_user_and_storage()
|
||||
|
||||
if "hits/marker_size" not in keys:
|
||||
settings.setValue("hits/marker_size", 10)
|
||||
|
||||
Reference in New Issue
Block a user