diff --git a/config/devices.properties b/config/devices.properties index f583ed0..e9dae38 100755 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,4 +1,4 @@ -gun_solenoid=ch.psi.pshell.epics.Positioner|SINEG01-MSOL130:I-SET SINEG01-MSOL130:I-READ|||true +$gun_solenoid=ch.psi.pshell.epics.Positioner|SINEG01-MSOL130:I-SET SINEG01-MSOL130:I-READ|||true gun_phase=ch.psi.pshell.epics.Positioner|SINEG01-RSYS:SET-BEAM-PHASE SINEG01-RSYS:GET-BEAM-PHASE|||true #SINSB01_phase=ch.psi.pshell.epics.Positioner|VA-SINSB01-RSYS100:SET-BEAM-PHASE VA-SINSB01-RSYS100:GET-BEAM-PHASE|||true #BC1_energy=ch.psi.pshell.epics.ChannelDouble|VA-SINBC02-DBPM140:ENERGY|Read||true diff --git a/script/Alignment/Gun_solenoid_alignment.py b/script/Alignment/Gun_solenoid_alignment.py index db88f90..afa1b63 100755 --- a/script/Alignment/Gun_solenoid_alignment.py +++ b/script/Alignment/Gun_solenoid_alignment.py @@ -32,9 +32,9 @@ print "Parameters: ", I1, I2, dI, settling_time, plot_image, number_images, use_ plot_name = datetime.datetime.fromtimestamp(time.time()).strftime('%H%M%S') -add_device(CamTool("camtool") , True) -camtool.setNumberOfImages(max(number_images,1)) -camtool.enableBackground (use_background) +#add_device(CamTool("camtool") , True) +#camtool.setNumberOfImages(max(number_images,1)) +#camtool.enableBackground (use_background) if use_background: laser_off() if not multiple_background: @@ -68,9 +68,11 @@ def after_sample(): r = None if not multiple_background: laser_on() + try: #sensors = [camtool.com_x, camtool.com_y] - sensors = [camtool.com_x_mean, camtool.com_y_mean, camtool.com_x_stdev, camtool.com_y_stdev] + #sensors = [camtool.com_x_mean, camtool.com_y_mean, camtool.com_x_stdev, camtool.com_y_stdev] + sensors = [avx, avy, avx.variance, avy.variance] if plot_image: sensors.append(camtool.image) r = lscan(gun_solenoid, sensors , I1, I2, dI, settling_time, before_read = before_sample, after_read = after_sample) diff --git a/script/camtool.py b/script/camtool.py index 240cf7a..f1bb273 100644 --- a/script/camtool.py +++ b/script/camtool.py @@ -48,7 +48,7 @@ class CamTool(DeviceBase): self.waitForChannel(self.data_prefix + "timestamp",20) else: self.stop() - self.timestamp = Channel(self.data_prefix + "timestamp", alias = name + " timestamp") #[D1, D2, ...] + self.timestamp = Channel(self.data_prefix + "timestamp",type = 'l', alias = name + " timestamp") #[D1, D2, ...] 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") @@ -86,7 +86,7 @@ class CamTool(DeviceBase): set_device_alias(self.com_x_mean, name + " com x mean") set_device_alias(self.com_y_mean, name + " com y mean") set_device_alias(self.com_x_stdev, name + " com x stdev") - set_device_alias(self.com_y_stdev, name + " com y stdev") + set_device_alias(self.com_y_stdev, name + " com y stdev") def waitForChannel(self, channel, timeout): print "Waiting for chanel: " + channel @@ -117,21 +117,23 @@ class CamTool(DeviceBase): def capture(self): timestamp = self.timestamp.read() + print "Current timestamp: ", timestamp if not self.latch: self.cam_run.write(1) start = time.time() while(True): val = self.timestamp.read() if timestamp != val: + print "New timestamp: ", val self.setCache(val) break if self.latch: self.cam_latch.write(1) time.sleep(0.001) if (time.time()-start) > self.grab_timeout: - if not self.latch: - self.cam_run.write(1) - else: + #if not self.latch: + # self.cam_run.write(1) + #else: raise Exception("Grab Timeout") def doUpdate(self): @@ -179,12 +181,12 @@ class CamTool(DeviceBase): if __name__ == "__builtin__": camera_tool = CamTool("camtool", latch = False) add_device(camera_tool, True) - camera_tool.enableBackground(False) + camera_tool.enableBackground(False) """ camera_tool.enableBackground(False) camera_tool.captureBackground(5) """ - for i in range (100): - camera_tool.capture() + for i in range (100): + camera_tool.capture() print camera_tool.take(), camera_tool.com_x.read(), camera_tool.com_y.read() \ No newline at end of file diff --git a/script/test/particle_analysis.py b/script/test/particle_analysis.py index 436d162..84e91e9 100644 --- a/script/test/particle_analysis.py +++ b/script/test/particle_analysis.py @@ -12,7 +12,7 @@ ip2 = load_image("images/img2.png", title="Image2") #Particle Analysis ip = grayscale(ip2, in_place = False) auto_threshold(ip) - +binary_op(ip, "fill_holes") show_panel(ip.getBufferedImage(), "Binarization")