diff --git a/plugins/GunSolenoidAlignment.java b/plugins/GunSolenoidAlignment.java index 7d36a73..ec74ffc 100644 --- a/plugins/GunSolenoidAlignment.java +++ b/plugins/GunSolenoidAlignment.java @@ -33,9 +33,11 @@ public class GunSolenoidAlignment extends Panel { public void onNewRecord(Scan scan, ScanRecord record) { try { if (running) { - double error_x = 0.2; - double error_y = 0.4; - scanSeries.appendData((Double) record.getValues()[0], (Double) record.getValues()[1], error_x, error_y); + double x = (Double) record.getValues()[0]; + double y = (Double) record.getValues()[1]; + double error_x = (Double) record.getValues()[2]; + double error_y = (Double) record.getValues()[3]; + scanSeries.appendData(x, y, error_x, error_y); progressBar.setValue((int) (1000.0 * record.getIndex() / scan.getNumberOfRecords())); } } catch (Exception ex) { diff --git a/script/camtool.py b/script/camtool.py index 3f2c918..fbed0b1 100644 --- a/script/camtool.py +++ b/script/camtool.py @@ -43,10 +43,11 @@ class CamTool(DeviceBase): 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 en") + 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.num_images = 1 + self.grab_timeout = 1.0 self.image = CamToolImage(self) set_device_alias(self.image, name + " image") @@ -72,8 +73,8 @@ 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_var, name + " com x var") - set_device_alias(self.com_y_var, name + " com y var") + set_device_alias(self.com_x_var, name + " com x variance") + set_device_alias(self.com_y_var, name + " com y variance") def doInitialize(self): if self.latch: @@ -90,7 +91,8 @@ class CamTool(DeviceBase): def capture(self): timestamp = self.timestamp.read() if not self.latch: - self.cam_run.write(1) + self.cam_run.write(1) + start = time.time() while(True): val = self.timestamp.read() if timestamp != val: @@ -98,7 +100,12 @@ class CamTool(DeviceBase): break if self.latch: self.cam_latch.write(1) - time.sleep(0.001) + time.sleep(0.001) + if (time.time()-start) > self.grab_timeout: + if not self.latch: + self.cam_run.write(1) + else: + raise Exception("Grab Timeout") def doUpdate(self): self.com_x_samples, self.com_y_samples = [], []