22 lines
583 B
Python
22 lines
583 B
Python
import ch.psi.pshell.imaging.Data as Data
|
|
class Exposure(Writable):
|
|
def write(self,pos):
|
|
cam.setExposure(pos)
|
|
exposure=Exposure()
|
|
|
|
|
|
class Contrast(Readable):
|
|
def read(self):
|
|
data = img.getData()
|
|
roi = Data(data.getRectSelection(500,300,700,600))
|
|
return roi.getGradientVariance()
|
|
contrast=Contrast()
|
|
|
|
|
|
#a= lscan(exposure,img.getContrast(), 0.5, 1.0, 0.01, 0.5)
|
|
a= lscan(exposure,contrast, 0.2, 0.4, 0.01, 0.7)
|
|
|
|
(n, m, s) = fit(a.getReadable(0), xdata=a.getPositions(0))
|
|
if m is not None:
|
|
print "Setting exposure = ", m
|
|
exposure.write(m) |