diff --git a/Readme.md b/Readme.md
index 55801f6..8db93a0 100644
--- a/Readme.md
+++ b/Readme.md
@@ -588,7 +588,7 @@ cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg
gpasciiCommander --host $PPMAC -i
$$$***
!common()
-!SAR-EXPMX2()
+!SAR-EXPMX3()
caput SAR-EXPMX3:ASYN.AOUT '&1;#1..5j/;cpx call 15'
caput SAR-EXPMX3:ASYN.AOUT '&1;cpx jog1..5=000;call 16'
diff --git a/cfg/MX3_setup.cfg b/cfg/MX3_setup.cfg
index 2cdc0df..4108bd3 100644
--- a/cfg/MX3_setup.cfg
+++ b/cfg/MX3_setup.cfg
@@ -7,20 +7,25 @@
//#4: homeoffset: -87830.7554146
//#5: homeoffset: -47956.2759182
-!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)
-!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-20907.)
+!encoder_ssi(enc=1,numBits=18,posSf=-5625./4096.)
+//!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
+!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
-!encoder_ssi(enc=2,numBits=18,posSf=5625./4096.)
-!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=102320.)
+!encoder_ssi(enc=2,numBits=18,posSf=-5625./4096.)
+//!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
+!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
-!encoder_ssi(enc=3,numBits=18,posSf=5625./4096.)
-!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=168946.)
+!encoder_ssi(enc=3,numBits=18,posSf=-5625./4096.)
+//!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
+!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
-!encoder_ssi(enc=4,numBits=18,posSf=5625./4096.)
-!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-87830.)
+!encoder_ssi(enc=4,numBits=18,posSf=-5625./4096.)
+//!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
+!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
-!encoder_ssi(enc=5,numBits=18,posSf=5625./4096.)
-!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-47956.)
+!encoder_ssi(enc=5,numBits=18,posSf=-5625./4096.)
+//!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
+!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
define(SP_RelBrk='15',SP_LockBrk='16')
diff --git a/cfg/SAR-EXPMX3.cfg b/cfg/SAR-EXPMX3.cfg
index 8d067e1..0b04988 100644
--- a/cfg/SAR-EXPMX3.cfg
+++ b/cfg/SAR-EXPMX3.cfg
@@ -42,7 +42,7 @@ open plc 0
if (Motor[5].ActPos-Motor[5].HomePos>180000)
Motor[5].HomePos=Motor[5].HomePos+360000
disable plc 0
-close plc 0```
+close // plc 0
enable plc 0
diff --git a/python/5camMeas.py b/python/5camMeas.py
index 6b7ed23..a96f34a 100755
--- a/python/5camMeas.py
+++ b/python/5camMeas.py
@@ -72,7 +72,8 @@ def plot():
meas_rot_ctr(d,1)
plt.plot(d)
plt.show()
+
gen_code()
-plot()
+#plot()
diff --git a/python/findxtal.py b/python/findxtal.py
index ea2f8bb..6aa2fd0 100755
--- a/python/findxtal.py
+++ b/python/findxtal.py
@@ -8,82 +8,16 @@
'''
implements an image alalyser for ESB MX
'''
-
+import os
from scipy import fftpack, ndimage
import scipy.ndimage as ndi
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
-#plt.ion()
+import imgStack
-def ffttest():
- for phi in np.arange(0.,180.,10.):
- ffttest2(phi=phi)
- plt.show()
- pass
-
-def ffttest2(phi=45.,frq=4.2,amp=1.,n=256.):
- #find the main frequency and phase in 1-D
- #plt.ion()
- plt.figure(1)
+def findGrid(image,numPeak=2,minFrq=2,maxFrq=None,debug=0):
d2r=np.pi/180.
- x=np.arange(n)
- phi=phi*d2r
- y=amp*np.cos(frq*x/n*2.*np.pi-phi)
- plt.plot(x,y,'y')
- #y[np.where(y<-.5)]=0
- #y*=np.hamming(n)
- w=np.hanning(n)
- plt.plot(x,w,'y')
- y*=w
- #y*=1.-np.cos(x/(n-1.)*2.*np.pi)
-
- #y=[1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1]
- plt.stem(x,y)
-
- fy=np.fft.fft(y)
- fya=np.abs(fy)
- plt.figure(2)
- plt.subplot(211)
- plt.stem(x,fya)
- plt.subplot(212)
- plt.stem(x,np.angle(fy)/d2r)
- print(np.angle(fy[frq])/d2r)
-
- fya[0]=0
- i=(fya.reshape(2,-1)[0,:]).argmax()
- (vn,v0,vp)=fya[i-1:i+2]
- frq_=i+(vn-vp)/(2.*(vp+vn-2*v0))
- print('freq: %g phase %g %g %g'%((frq_,)+tuple(np.angle(fy[i-1:i+2])/d2r)))
-
- #PHASE CALCULATION
- plt.figure(1)
- y=np.zeros(x.shape)
- z=np.zeros(x.shape)
- for ii in (i,i-1,i+1):
- y+=np.abs(fy[ii])/n*np.cos(ii*x/n*2.*np.pi+np.angle(fy[ii]))
- z+=np.abs(fy[ii])/n*np.sin(ii*x/n*2.*np.pi+np.angle(fy[ii]))
- y*=2 #double because of conjugate part
- z*=2 #double because of conjugate part
- plt.plot(x,y,'r')
- amp_=fya[i-1:i+2].sum()/n*2.
- t=int(n/2)-1
- #->phase: find maximum or where the sin is 0
- w=np.arccos(y[t]/amp_)
- if(z[t]<0): w=-w
- print('amplitude %g, value at middle (%d) cos->%g sin->%g -> acos %g deg'%(amp_,t,y[t],z[t],w/d2r))
- #rot angle at middle x=127 =frq_*t/n*2.*np.pi-phi_=w '%(amp_,t,y[t],phi_/d2r))
- phi_=frq_*t/n*2.*np.pi-w
- y=amp_*np.cos(frq_*x/n*2.*np.pi-phi_)
- print('y[%d] %g'%(t,y[t]))
-
- plt.plot(x,y,'g')
-
- pass
-
-def findGrid(image,numPeak=2,limFrq=None,debug=255):
- d2r=np.pi/180.
- #image = ndimage.imread('/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/images/grid_20180409_115332.png', flatten=True) # flatten=True gives a greyscale image
s=image.shape
w1=np.hamming(s[0]).reshape((-1,1))
w2=np.hamming(s[1]).reshape((1,-1))
@@ -91,8 +25,9 @@ def findGrid(image,numPeak=2,limFrq=None,debug=255):
#plt.figure(num='hamming window')
#plt.imshow(wnd, interpolation="nearest")
image=wnd*image
- #plt.figure(num='hamming window*img')
- #plt.imshow(image, interpolation="nearest")
+ if debug&1:
+ plt.figure(num='hamming window*img')
+ plt.imshow(image, interpolation="nearest")
fft2 = np.fft.fft2(image)
fft2=np.fft.fftshift(fft2)
@@ -103,11 +38,11 @@ def findGrid(image,numPeak=2,limFrq=None,debug=255):
#plt.xlim(s[1]/2-50, s[1]/2+50);plt.ylim(s[0]/2-50, s[0]/2+50)
ctr=np.array(image.shape,dtype=np.int16)/2
- fa[ctr[0] - 1:ctr[0] + 2, ctr[1] - 1:ctr[1] + 2]=0 # set dc to 0
+ fa[ctr[0]-minFrq+1:ctr[0]+minFrq, ctr[1]-minFrq+1:ctr[1]+minFrq]=0 # set dc to 0
# limit to maximal frequency
- if limFrq is not None:
- fa[:ctr[0]-limFrq,:]=0;fa[ctr[0]+limFrq:,:]=0
- fa[:,:ctr[1]-limFrq]=0;fa[:,ctr[1]+limFrq:]=0
+ if maxFrq is not None:
+ fa[:ctr[0]-maxFrq,:]=0;fa[ctr[0]+maxFrq:,:]=0
+ fa[:,:ctr[1]-maxFrq]=0;fa[:,ctr[1]+maxFrq:]=0
x=np.arange(s[1])/float(s[1])*2.*np.pi
y=np.arange(s[0])/float(s[0])*2.*np.pi
if debug&1:
@@ -232,6 +167,28 @@ def plotGrid(grid,shape):
plt.plot(p[:,0],p[:,1],'r+',markeredgewidth=2, markersize=10)
plt.axis('image')
pass
+
+def ShowImage(img,title=None,cmap='gray',vmin=None, vmax=None):
+ plt.figure(title)
+ plt.imshow(img, interpolation="nearest", cmap=cmap,vmin=vmin,vmax=vmax) # ,vmin=m-3*s, vmax=m+3*s)
+ plt.colorbar()
+
+def imgEqualize(img,num_bins=256):
+ # get image histogram
+ hist, bins = np.histogram(image.flatten(), num_bins, normed=True)
+ cdf = hist.cumsum() # cumulative distribution function
+ cdf = 255 * cdf / cdf[-1] # normalize
+
+ # use linear interpolation of cdf to find new pixel values
+ imgEqu=np.interp(img.flatten(), bins[:-1], cdf)
+ imgEqu=np.uint8(imgEqu.reshape(img.shape))
+
+ plt.figure();plt.plot(hist)
+ h2,b2=np.histogram(imgEqu.flatten(), num_bins, normed=True)
+ plt.figure();plt.plot(h2)
+ return imgEqu.reshape(img.shape)#, cdf
+
+
def findObj(image,objSize=150,tol=0,debug=0):
#objSiz is the rough diameter of the searched features in pixels
@@ -239,35 +196,51 @@ def findObj(image,objSize=150,tol=0,debug=0):
#tolShape = roudness tolerance in object roundness (not yet implemented)
from scipy.signal import convolve2d
- #plt.ion()
+ plt.ion()
+ image=image[500:2500,1000:2500]
s=image.shape
- #box=np.ones((1,objSize*3),dtype=np.float32)/500.
+ f=np.array([0.9595264, 0.9600567, 0.9608751, 0.9620137, 0.9634765, 0.9652363, 0.9672352, 0.9693891, 0.9715959, 0.9737464, 0.9757344, 0.9774676, 0.9788761, 0.9799176, 0.9805792, 0.9808776, 0.9808528, 0.9805624, 0.9800734, 0.9794550])
+ f=f*1000
+ f=f-f.mean()
- #img2=ndi.filters.convolve1d(image,box.reshape(-1),0)
- #img2=ndi.filters.convolve1d(img2,box.reshape(-1),1)
- img2=ndi.filters.uniform_filter(np.float32(image),objSize*2)
+ m=image.mean();s=image.std()
+ ShowImage(image,vmin=-.85,vmax=-.99)
+ ShowImage(image,vmin=m-3*s,vmax=m+3*s)
+ ieq=imgEqualize(image)
+ ShowImage(ieq)
+ m=image.mean();s=image.std()
+ i2=(image-m)*(256./(3*s))+128.
+ i2[i2>255.]=255.
+ i2[i2<0.]=0.
+ i2=np.uint8(i2)
+ ShowImage(i2)
+ image=ndi.filters.gaussian_filter1d(image,sigma=5./3,truncate=3.,axis=0)
+ image=ndi.filters.gaussian_filter1d(image,sigma=5./3,truncate=3.,axis=1)
+ ShowImage(image,vmin=-.85,vmax=-.99)
- if debug&32:
- plt.imshow(image, interpolation="nearest", cmap='gray')
- plt.figure()
- plt.imshow(img2, interpolation="nearest", cmap='gray')
- #plt.show()
- w=np.where(img2>image)
- img2[w]=image[w]
- img3=image-img2
- if debug&16:
- plt.figure()
- plt.imshow(img3, interpolation="nearest", cmap='gray')
- #plt.show()
- l=int(objSize/30)
- if l>0:
- img4=ndi.binary_fill_holes(img3, structure=np.ones((l,l)))
- if debug&8:
- plt.figure()
- plt.imshow(img4, interpolation="nearest", cmap='gray')
- #plt.show()
- else:
- img4=img3
+ img2=ndi.filters.convolve1d(image,f,0)
+ ShowImage(img2,vmin=-3,vmax=3)
+
+ img3=ndi.filters.convolve1d(image,f,1)
+ ShowImage(img3,vmin=-3,vmax=3)
+ img4=np.maximum(abs(img2),abs(img3))
+ ShowImage(img4,vmin=0,vmax=3)
+
+ m=image.mean();s=image.std()
+ img5=np.zeros(image.shape)
+ w=np.where(img4>1.5)
+ img5[w]=1
+ ShowImage(img5)
+ #imgStack.Run([image, img2,img3,img4,img5])
+ #w=np.where(img2>image*1.01)
+ #img2[:]=0
+ #img2[w]=1
+ l=int(objSize/30);l=5
+ img6=ndi.binary_fill_holes(img5, structure=np.ones((l,l)))
+
+ #img6 = ndi.binary_dilation(img5, iterations=2)
+ #img6 = ndi.binary_erosion(img5, iterations=2)
+ ShowImage(img6)
l=int(objSize/5)#=int(objSize/10)
if l>=3:
@@ -310,7 +283,7 @@ def findObj(image,objSize=150,tol=0,debug=0):
m00=m['m00']
m10=m['m10']
m01=m['m01']
- print m00
+ #print m00
if m00>1000 and m00<7000:
ctr2[i,:]=(m10/m00,m01/m00)
i+=1
@@ -342,39 +315,180 @@ def genImg(shape,*args):
image += np.cos(freq_x * xx + freq_y * yy - phase)
return image
+def phase_retrieval_intensity_tranport(image, mu, delta, I_in, M, pixel_size, R2):
+ '''calculates the projected thickness as in eq. 12 of Paganin et al, 2002, J. Microscopy,
+ from an image, the absoption coefficient mu (um-1), the real part of the deviation of the refractive index
+ from unity delta, the uniform intensity of the incident radiation I_in (ph/s/um2), the magnification of the
+ image from the point source illumination M, the pixel size (um), the propagation distance R2 (um).'''
+ F = np.fft.rfft2(image)
+ k_x = 1/(pixel_size*image.shape[0]) # is there a 2pi factor?
+ k_y = 1/(pixel_size*image.shape[1]) # is there a 2pi factor?
+ #print k_x,k_y
+ k_array = np.zeros((F.shape[0],F.shape[1]))
+ A = np.zeros((F.shape[0],F.shape[1]), dtype=np.complex128)
+ for i_k in range(k_array.shape[0]):
+ for j_k in range(k_array.shape[1]):
+ k_array[i_k,j_k] = np.sqrt((i_k * k_x)**2 + (j_k * k_y)**2)
+ A[i_k,j_k] = mu * F[i_k,j_k] / (I_in * (R2 * delta * k_array[i_k,j_k]**2 / M + mu))
+ Fm1 = np.fft.irfft2(A)
+ T = np.multiply(-1/mu, np.log(Fm1))
+ return T
+
if __name__ == '__main__':
- #plt.ion()
- #ffttest()
+ def testfftLoop():
+ plt.ioff()
+ for phi in np.arange(0.,180.,10.):
+ testfft(phi=phi)
+ plt.show()
+ pass
- image = ndimage.imread('/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/images/honeycomb.png')
- image=-image
- grid=findGrid(image,numPeak=2,limFrq=25,debug=2)
+ def testfft(phi=45.,frq=4.2,amp=1.,n=256.):
+ #find the main frequency and phase in 1-D
+ plt.figure(1)
+ d2r=np.pi/180.
+ x=np.arange(n)
+ phi=phi*d2r
+ y=amp*np.cos(frq*x/n*2.*np.pi-phi)
+ plt.plot(x,y,'y')
+ #y[np.where(y<-.5)]=0
+ #y*=np.hamming(n)
+ w=np.hanning(n)
+ plt.plot(x,w,'y')
+ y*=w
+ #y*=1.-np.cos(x/(n-1.)*2.*np.pi)
+
+ #y=[1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1]
+ plt.stem(x,y)
+
+ fy=np.fft.fft(y)
+ fya=np.abs(fy)
+ plt.figure(2)
+ plt.subplot(211)
+ plt.stem(x,fya)
+ plt.subplot(212)
+ plt.stem(x,np.angle(fy)/d2r)
+ print(np.angle(fy[frq])/d2r)
+
+ fya[0]=0
+ i=(fya.reshape(2,-1)[0,:]).argmax()
+ (vn,v0,vp)=fya[i-1:i+2]
+ frq_=i+(vn-vp)/(2.*(vp+vn-2*v0))
+ print('freq: %g phase %g %g %g'%((frq_,)+tuple(np.angle(fy[i-1:i+2])/d2r)))
+
+ #PHASE CALCULATION
+ plt.figure(1)
+ y=np.zeros(x.shape)
+ z=np.zeros(x.shape)
+ for ii in (i,i-1,i+1):
+ y+=np.abs(fy[ii])/n*np.cos(ii*x/n*2.*np.pi+np.angle(fy[ii]))
+ z+=np.abs(fy[ii])/n*np.sin(ii*x/n*2.*np.pi+np.angle(fy[ii]))
+ y*=2 #double because of conjugate part
+ z*=2 #double because of conjugate part
+ plt.plot(x,y,'r')
+ amp_=fya[i-1:i+2].sum()/n*2.
+ t=int(n/2)-1
+ #->phase: find maximum or where the sin is 0
+ w=np.arccos(y[t]/amp_)
+ if(z[t]<0): w=-w
+ print('amplitude %g, value at middle (%d) cos->%g sin->%g -> acos %g deg'%(amp_,t,y[t],z[t],w/d2r))
+ #rot angle at middle x=127 =frq_*t/n*2.*np.pi-phi_=w '%(amp_,t,y[t],phi_/d2r))
+ phi_=frq_*t/n*2.*np.pi-w
+ y=amp_*np.cos(frq_*x/n*2.*np.pi-phi_)
+ print('y[%d] %g'%(t,y[t]))
+
+ plt.plot(x,y,'g')
+ pass
+
+ def testFindGrid():
+ plt.ioff()
+ imggrid=(
+ ('grid_20180409_115332_45deg.png', 2,None),
+ ('grid_20180409_115332.png', 2,None),
+ ('honeycomb.png', 2,25),
+ ('MS01_20180411_110544.png', 10,None),
+ ('MS02_20180411_120354.png', 10,None),
+ ('MS03_20180411_135524.png', 10,None),
+ ('MS04_20180411_143045.png', 10,None),
+ ('MS04_20180411_144239.png', 10,None),
+ )
+ for (file,minFrq,maxFrq) in imggrid:
+ image = ndimage.imread(os.path.join(basePath,file))
+ image=-image
+ grid=findGrid(image,minFrq=minFrq,maxFrq=maxFrq,numPeak=2)
+ plt.figure('grid');plt.imshow(image, interpolation="nearest", cmap='gray')
+ plotGrid(grid, image.shape)
+ plt.show()
+
+ def testFindObj():
+ plt.ioff()
+ imggrid=(
+ ('grid_20180409_115332_45deg.png', 2,None),
+ )
+ for (file,p0,p1) in imggrid:
+ image = ndimage.imread(os.path.join(basePath,file))
+ image=-image
+ objPos=findObj(image,debug=0)
+ plt.figure('findObj');plt.imshow(image, interpolation="nearest", cmap='gray')
+ plt.plot(objPos[:,1],objPos[:,0],'r+',markeredgewidth=2, markersize=10)
+ plt.axis('image')
+ plt.show()
+
+ def testPhaseEnhance():
+
+ mu=0.001 # um-1, optimal value found is 0.001
+ phase_shift=-0.4 # rad/um, optimal value found is -1
+ E=18 # keV
+ wavelength=12.4/E/10000 # um
+ delta=-wavelength/(2*np.pi)*phase_shift
+ delta=4.38560287631e-06
+ M=1
+ R2=19*1e4 # um
+ pixel_size=0.325 # um
+ flux=1e12 # ph/s
+ for fn in ('lyso1_scan_18keV_190mm_MosaicJ_noblend_crop.tif',
+ 'PepT2_scan_18keV_190mm_MosaicJ_noblend_crop_FFT40.tif',
+ 'SiN_lysoS1_scan_18keV_190mm_MosaicJ_noblend_crop_FFT40.tif',
+ 'SiN_PepT2_scan_18keV_190mm_MosaicJ_noblend_crop.tif',):
+ img = ndimage.imread(os.path.join(basePath,fn))
+ FOV_pix = img.shape
+ FOV_um = (FOV_pix[0] * pixel_size, FOV_pix[1] * pixel_size)
+ I_in = flux / (FOV_um[0] * FOV_um[1]) # ph/s/um2
+ phase_image = phase_retrieval_intensity_tranport(img, mu, delta, I_in, M, pixel_size, R2)
+ phase_image_flipped = phase_retrieval_intensity_tranport(np.fliplr(img), mu, delta, I_in, M, pixel_size, R2)
+ added_image = np.add(phase_image,np.fliplr(phase_image_flipped))
+
+
+ m=img.mean();s=img.std()
+ ShowImage(img, title=fn+' raw', vmin=m-3*s, vmax=m+3*s)
+ m=added_image.mean();s=added_image.std()
+ ShowImage(added_image, title=fn+' phase retrival', vmin=m-3*s, vmax=m+3*s)
+ plt.show()
+
+ basePath='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/images/'
+ #testfftLoop()
+ testFindGrid()
+ #testFindObj()
+ #testPhaseEnhance()
+ exit(0)
+
+ plt.ion()
+ #image = ndimage.imread(os.path.join(basePath, 'lyso1_scan_18keV_190mm_MosaicJ_noblend_crop.tif'))
+ image = ndimage.imread(os.path.join(basePath, 'lyso1_scan_18keV_190mm_MosaicJ_noblend_crop.tif'))
+ #image = ndimage.imread(os.path.join(basePath, 'grid_20180409_115332.png'))
+ image = -image
+ #plt.figure('input');
+ #plt.imshow(image, interpolation="nearest", cmap='gray')
+ #sbl=ndi.sobel(image)
+ #plt.figure('sobel');
+ #plt.imshow(sbl, interpolation="nearest", cmap='gray')
+ objPos = findObj(image, objSize=50,debug=255)
+ plt.figure('findObj');
plt.imshow(image, interpolation="nearest", cmap='gray')
- plotGrid(grid,image.shape)
+ plt.plot(objPos[:, 1], objPos[:, 0], 'r+', markeredgewidth=2, markersize=10)
+ plt.axis('image')
plt.show()
- image = ndimage.imread('/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/images/grid_20180409_115332.png')
- image=-image
- grid=findGrid(image,numPeak=2,debug=2)
- plt.imshow(image, interpolation="nearest", cmap='gray')
- plotGrid(grid,image.shape)
- plt.show()
-
- image = ndimage.imread('/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/images/grid_20180409_115332_45deg.png')
- image=-image
- grid=findGrid(image,numPeak=2,debug=2)
- plt.imshow(image, interpolation="nearest", cmap='gray')
- plotGrid(grid,image.shape)
- plt.show()
-
- objPos=findObj(image,debug=1)
- plt.show()
-
-
- d2r=np.pi/180.
- #for phi in np.arange(0.,180.,10.):
- # image = genImg((600, 800), (4.5, .2, phi*d2r))
- # plt.show()
+ #d2r=np.pi/180.
#image=genImg((600,800),(4.,1.0,10.*d2r))
#image=genImg((600,800),(4.5,-3.2,70.*d2r))
#image=genImg((600,800),(-4.5,3.2,290.*d2r)) #same image
@@ -383,7 +497,10 @@ if __name__ == '__main__':
#for v in np.arange(0,2,.3):
# image=genImg((600,800),(8,.2+v,40.*d2r),(.4,5.2,30.*d2r))
- # grid=findGrid(image,numPeak=2,debug=2)
+ # #image = genImg((600, 800), (.4,5.2,30.))
+ # plt.figure(10);plt.cla()
+ # plt.imshow(image)
+ # grid=findGrid(image,numPeak=2,debug=255)
# plt.figure(1);plt.cla()
# plt.imshow(image, interpolation="nearest", cmap='gray')
# plotGrid(grid,image.shape)
diff --git a/qt/ESB_MX_exp.ui b/qt/ESB_MX_exp.ui
index 9113de1..45ce74f 100644
--- a/qt/ESB_MX_exp.ui
+++ b/qt/ESB_MX_exp.ui
@@ -256,7 +256,7 @@ P=$(P),M=MOT_GIRDER5
Smaract
- ESB_MX_SMARACT_main.ui
+ ESB_MX_SmarAct_main.ui
P=SARES30-ESBMX