Closedown

This commit is contained in:
sfop
2016-08-31 15:27:48 +02:00
parent 966c3a28f5
commit 241f85df96
4 changed files with 42 additions and 36 deletions

View File

@@ -1,3 +1,4 @@
Camtool.java=enabled
Cameras.java=disabled
LaserGunAlignment.java=enabled
test2.java=disabled

View File

@@ -44,11 +44,11 @@ if (use_bpm):
multiple_background = False
else:
latch = True
#if get_device("image_stats") is None:
print "Instantiating camtool"
add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = latch, camera = "SINEG01-DSCR190"), True)
if (latch):
image_stats.start()
if get_device("image_stats") is None:
print "Instantiating camtool"
add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = latch, camera = "SINEG01-DSCR190"), True)
if (latch):
image_stats.start()
#add_device(ImageStats("image_stats", get_simulated_source(image)), True)
image_stats.setNumberOfImages(max(number_images,1))

View File

@@ -44,11 +44,11 @@ if (use_bpm):
multiple_background = False
else:
latch = True
#if get_device("image_stats") is None:
print "Instantiating camtool"
add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = latch, camera = "SINEG01-DSCR190"), True)
if (latch):
image_stats.start()
if get_device("image_stats") is None:
print "Instantiating camtool"
add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = latch, camera = "SINEG01-DSCR190"), True)
if (latch):
image_stats.start()
#add_device(ImageStats("image_stats", get_simulated_source(image)), True)
image_stats.setNumberOfImages(max(number_images,1))

View File

@@ -43,8 +43,10 @@ class CamTool(DeviceBase):
self.egu = egu
self.mode = "latch" if latch else "pipeline"
self.data_prefix = prefix + self.mode + "."
self.cam_run = Channel(prefix + "camera.run", alias = name + " run")
self.cam_latch = Channel(prefix + "latch.capture", 'l', alias = name + " latch")
self.cam_run = create_channel_device(prefix + "camera.run", type='i', size=None, deviceName=name + " run") # Channel(prefix + "camera.run", alias = name + " run")
self.cam_latch = create_channel_device(prefix + "latch.capture", type='l', size=None, deviceName=name + " latch") # Channel(prefix + "latch.capture", 'l', alias = name + " latch")
if self.latch:
self.start()
time.sleep(3.0)
@@ -56,25 +58,21 @@ class CamTool(DeviceBase):
self.waitForChannel(self.data_prefix + "timestamp",20)
self.waitForChannel(self.data_prefix + "image.shape",20)
self.stop()
self.timestamp = Channel(self.data_prefix + "timestamp",type = 'd', alias = name + " timestamp") #[D1, D2, ...]
#self.timestamp.set_monitored(True)
self.timestamp = create_channel_device(self.data_prefix + "timestamp", type='d', size=None, deviceName=name + " timestamp") # Channel(self.data_prefix + "timestamp",type = 'd', alias = name + " timestamp") #[D1, D2, ...]
self.timestamp.setMonitored(True)#self.timestamp.set_monitored(True)
if egu:
self.com_x = Channel(self.data_prefix + "x_stats.com_egu", alias = name + " com_egu x")
self.com_y = Channel(self.data_prefix + "y_stats.com_egu", alias = name + " com_egu y")
self.com_x = create_channel_device(self.data_prefix + "x_stats.com_egu", type='d', size=None, deviceName=name + " com_egu x") #Channel(self.data_prefix + "x_stats.com_egu", alias = name + " com_egu x")
self.com_y = create_channel_device(self.data_prefix + "y_stats.com_egu", type='d', size=None, deviceName=name + " com_egu y") #Channel(self.data_prefix + "y_stats.com_egu", alias = name + " com_egu y")
else:
self.com_x = Channel(self.data_prefix + "x_stats.com", alias = name + " com x")
self.com_y = Channel(self.data_prefix + "y_stats.com", alias = name + " com y")
self.profile_x = Channel(self.data_prefix + "profile.x", alias = name + " profile x")
self.profile_y = Channel(self.data_prefix + "profile.y", alias = name + " profile y")
self.com_x = create_channel_device(self.data_prefix + "x_stats.com", type='d', size=None, deviceName=name + " com x") #Channel(self.data_prefix + "x_stats.com", alias = name + " com x")
self.com_y = create_channel_device(self.data_prefix + "y_stats.com", type='d', size=None, deviceName=name + " com x") #Channel(self.data_prefix + "y_stats.com", alias = name + " com y")
self.profile_x = create_channel_device(self.data_prefix + "profile.x", type='d', size=None, deviceName=name + " profile x") #Channel(self.data_prefix + "profile.x", alias = name + " profile x")
self.profile_y = create_channel_device(self.data_prefix + "profile.y", type='d', size=None, deviceName=name + " profile y") #Channel(self.data_prefix + "profile.y", alias = name + " profile y")
self.data = Channel(self.data_prefix + "image", alias = name + " data")
self.shape = Channel(self.data_prefix + "image.shape", alias = name + " shape") #[D1, D2, ...]
#self.bg_image = Channel(self.data_prefix + "bg_image", alias = name + "bg image") #[D1, D2, ...]
#self.bg_en = Channel(self.prefix + "bg.enabled", type = 'l', alias = name + " bg enabled")
#self.bg_capture = Channel(self.prefix + "bg.capture", type = 'l', alias = name + " bg capture")
#self.bg_capture_remain = Channel(self.prefix + "bg.capture_remain", alias = name + " capture remain")
self.bg_en = Channel(prefix + "pipeline.bg.enabled", type = 'l', alias = name + " bg enabled")
self.bg_capture = Channel(prefix + "pipeline.bg.capture", type = 'l', alias = name + " bg capture")
self.bg_capture_remain = Channel(prefix + "pipeline.bg.capture_remain", alias = name + " capture remain")
self.bg_en = create_channel_device(prefix + "pipeline.bg.enabled", type='l', size=None, deviceName=name + " bg enabled") #self.bg_en = Channel(prefix + "pipeline.bg.enabled", type = 'l', alias = name + " bg enabled")
self.bg_capture = create_channel_device(prefix + "pipeline.bg.capture", type='l', size=None, deviceName=name + " bg capture") #self.bg_capture = Channel(prefix + "pipeline.bg.capture", type = 'l', alias = name + " bg capture")
self.bg_capture_remain = create_channel_device(prefix + "pipeline.bg.capture_remain", type='l', size=None, deviceName=name + " capture remain") #self.bg_capture_remain = Channel(prefix + "pipeline.bg.capture_remain", alias = name + " capture remain")
self.num_images = 1
self.grab_timeout = 5.0
self.image = CamToolImage(self)
@@ -137,19 +135,23 @@ class CamTool(DeviceBase):
timestamp = self.timestamp.read()
print "Current timestamp: ", timestamp
if not self.latch:
self.cam_run.write(1)
self.cam_run.write(1)
else:
self.cam_latch.write(1)
print "Latched"
start = time.time()
print "!",
while(True):
print "*",
val = self.timestamp.read()
print ".",
if timestamp != val:
print "New timestamp: ", val
self.setCache(val)
return
time.sleep(0.001)
return
if (time.time()-start) > self.grab_timeout:
raise Exception("Frame timeout")
time.sleep(0.01)
except Exception, e:
retries = retries -1
print "---------------- Exception ------------------------"
@@ -201,13 +203,16 @@ class CamTool(DeviceBase):
self.bg_capture_remain.close()
#self.image.close()
try:
if get_device("camtool") is None:
add_device(CamTool("camtool", prefix = "SINEG01-DSCR190:", latch = True, camera = "SINEG01-DSCR190"), True)
camtool.enableBackground(True)
for i in range (1000):
camtool.capture()
print i, camtool.take(), camtool.com_x.read(), camtool.com_y.read()
camera_tool = CamTool("camtool", prefix = "SINEG01-DSCR190:", latch = True, camera = "SINEG01-DSCR190")
add_device(camera_tool, True)
camera_tool.enableBackground(True)
for i in range (1000):
camera_tool.capture()
print i, camera_tool.take(), camera_tool.com_x.read(), camera_tool.com_y.read()
finally:
print ""
"""