wip simulated mode

This commit is contained in:
2022-07-14 14:16:25 +02:00
parent 3815a07cdf
commit 52d0dd0b79
5 changed files with 168 additions and 17 deletions

View File

@@ -9,7 +9,7 @@
coordinate systems, optical center, xray axis, pixel sizes etc.
'''
class gepmetry:
class geometry:
def __init__(self):
pass
@@ -34,9 +34,8 @@ class gepmetry:
# [pyx pyy]*[ny] results in a vector in meter of a vector [nx,ny] pixels in x and y direction
pass
def set_zoom2pixsz():
#tx: 2d-vector in m when moving px pixel in x direction
#ty: 2d-vector in m when moving py pixel in y direction
def set_zoom2pixsz(meas):
#calculates _lut_z2p out of measurements
# the _lut_z2p is dictionaty a lookuptable
# zoom {1,200,400,600,800,1000}
#[pxx pxy]
@@ -53,6 +52,14 @@ class gepmetry:
((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)
for i,(k,v) in enumerate(meas):
pass
self._lut_z2p={ 'zoom': zoom, 'pixsz': pixsz}
def autofocus():
# cam camera object
# mot motor object
@@ -78,5 +85,63 @@ class gepmetry:
if __name__ == "__main__":
import argparse
logging.basicConfig(level=logging.DEBUG,format='%(levelname)s:%(module)s:%(lineno)d:%(funcName)s:%(message)s ')
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--mode', help='mode')
parser.add_argument("-t", "--test", help="test sequence", action="store_true")
args = parser.parse_args()
_log.info('Arguments:{}'.format(args.__dict__))
# recorded data:
# x y x y
#Zoom 1 x+1.2 97 543 -> 1100 507
# y+1.0 607 941 -> 575 106
#Zoom 200 x+0.6 93 504 -> 853 510
# y+0.4 475 897 -> 472 157
#Zoom 400 x+0.5 88 615 -> 1094 579
# y+0.4 705 991 -> 673 190
#Zoom 600 x+0.3 32 460 -> 103 416
# y+0.25 551 937 -> 520 106
#Zoom 800 x+0.18 65 524 -> 1050 484
# y+0.14 632 946 -> 602 168
#Zoom 1000 x+0.1 121 632 -> 1044 592
# y+0.08 593 883 -> 570 145
measure={
1:{'x': (+1.2 , ( 97, 543),(1100, 507)),
'y': (+1.0 , ( 607, 941),( 575, 106))},
200:{'x': (+0.6 , ( 93, 504),( 853, 510)),
'y': (+0.4 , ( 475, 897),( 472, 157))},
400:{'x': (+0.5 , ( 88, 615),(1094, 579)),
'y': (+0.4 , ( 705, 991),( 673, 190))},
600:{'x': (+0.3 , ( 32, 460),( 103, 416)),
'y': (+0.25 , ( 551, 937),( 520, 106))},
800:{'x': (+0.18 , ( 65, 524),(1050, 484)),
'y': (+0.14 , ( 632, 946),( 602, 168))},
1000:{'x': (+0.1 , ( 121, 632),(1044, 592)),
'y': (+0.08 , ( 593, 883),( 570, 145))},
}
obj=geometry()
obj.calc_zoom2pixsz(measure)