have swissmx.py running with some commented modules in ESC network

git dt 98297263 swissmx.py
 git dt 7445a5aa CustomROI.py app_config.py app_utils.py epics_widgets/MotorTweak.py epics_widgets/SmaractMotorTweak.py
This commit is contained in:
2022-07-15 09:41:21 +02:00
parent 7445a5aae6
commit db7e5e537f
6 changed files with 124 additions and 105 deletions

View File

@@ -8,12 +8,15 @@
'''
coordinate systems, optical center, xray axis, pixel sizes etc.
'''
import logging
import numpy as np
_log = logging.getLogger(__name__)
class geometry:
def __init__(self):
pass
def find_optical_center(p):
def find_optical_center(self,p):
# p is an array of
# at zoom out: (p1x,p1y),(p2x,p2y),(p3x,p3y),...
# at zoom in : (p1x,p1y),(p2x,p2y),(p3x,p3y),...
@@ -24,7 +27,7 @@ class geometry:
# this coordinate represents also the origin of other coordinates
pass
def zoom2pixsz(zoom):
def zoom2pixsz(self,zoom):
# this returns the pixel size at a given zoom level
# the returned value is a 2x2 matrix:
# [pxx pxy]
@@ -34,7 +37,7 @@ class geometry:
# [pyx pyy]*[ny] results in a vector in meter of a vector [nx,ny] pixels in x and y direction
pass
def set_zoom2pixsz(meas):
def set_zoom2pixsz(self,meas):
#calculates _lut_z2p out of measurements
# the _lut_z2p is dictionaty a lookuptable
# zoom {1,200,400,600,800,1000}
@@ -44,23 +47,23 @@ class geometry:
'zoom': np.array((1,200,400,600,800,1000),dtype=np.float32),
'pixsz': np.array(
#((pxx,pxy),(pyx,pyy)), # zoom n
(( 1,0),(0, 1)), # zoom 1
((( 1,0),(0, 1)), # zoom 1
(( 2,0),(0, 2)), # zoom 200
(( 4,0),(0, 4)), # zoom 400
(( 6,0),(0, 6)), # zoom 600
(( 8,0),(0, 8)), # zoom 800
((10,0),(0,10)), # zoom 1000
((10,0),(0,10))), # zoom 1000
dtype=np.float32)}
n=len(meas)
zoom =np.ndarray(shape=n,dtype=np.float32)
pixsz=np.ndarray(shape=(n,2,2),dtype=np.float32)
n=len(meas)
zoom =np.ndarray(shape=n,dtype=np.float32)
pixsz=np.ndarray(shape=(n,2,2),dtype=np.float32)
for i,(k,v) in enumerate(meas):
pass
self._lut_z2p={ 'zoom': zoom, 'pixsz': pixsz}
for i,(k,v) in enumerate(meas):
pass
self._lut_z2p={ 'zoom': zoom, 'pixsz': pixsz}
def autofocus():
def autofocus(self):
# cam camera object
# mot motor object
# rng region (min max relative to current position) to seek
@@ -69,17 +72,17 @@ class geometry:
# mode mode to calculate sharpness (sum/max-min/hist? of edge detection in roi)
pass
def pix2pos(p,zoom=None):
def pix2pos(self,p,zoom=None):
# returns the position m(x,y) in meter relative to the optical center at a given zoom level of the pixel p(x,y)
# if zoom=None, the last zoom value is used
pass
def pos2pix(p,zoom=None):
def pos2pix(self,p,zoom=None):
# returns the pixel p(x,y) of the position m(x,y) in meter relative to the optical center at a given zoom level
# if zoom=None, the last zoom value is used
pass
def optctr2xray():
def optctr2xray(self):
# returns the vector m(x,y) of the optical center to the xray
pass