From a48a55454318d56faf34e5892afacffbf7eef720 Mon Sep 17 00:00:00 2001 From: gac-x05la Date: Mon, 9 Sep 2024 11:16:00 +0200 Subject: [PATCH] Before giving up on defective Aerotech --- .../devices/aerotech/test/autoHilTest.py | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tomcat_bec/devices/aerotech/test/autoHilTest.py b/tomcat_bec/devices/aerotech/test/autoHilTest.py index 9bf3c87..cf68bd8 100644 --- a/tomcat_bec/devices/aerotech/test/autoHilTest.py +++ b/tomcat_bec/devices/aerotech/test/autoHilTest.py @@ -298,7 +298,7 @@ class AerotechAutomation1Test(unittest.TestCase): dev.configure(cfg) dev.stage() num = dev.nsamples_rbv.get() - self.assertEqual(num, 0, f"Stage should reset the number of DDC points but got: {num}") + self.assertEqual(num, 0, f"Stage should reset the number of DDC points but got: {num}") # Fire 20 triggers and stop the acquisition early for ii in range(20): @@ -320,11 +320,11 @@ class AerotechAutomation1Test(unittest.TestCase): dev.configure(cfg) dev.stage() num = dev.nsamples_rbv.get() - self.assertEqual(num, 0, f"Stage should reset the number of DDC points but got: {num}") + self.assertEqual(num, 0, f"Stage should reset the number of DDC points but got: {num}") # Fire 36 triggers for ii in range(36): event.set(1, settle_time=0.05).wait() - dev.unstage() + dev.unstage() # Wait for polling to catch up sleep(1) @@ -345,7 +345,7 @@ class AerotechAutomation1Test(unittest.TestCase): This module tests basic PSO distance functionality, like events and waveform generation. The goal is to ensure the basic operation of the PSO module and the polled feedback. - """ + """ # Throws if IOC is not available or PVs are incorrect dev = aa1AxisPsoDistance(AA1_IOC_NAME+ ":" + AA1_AXIS_NAME + ":PSO:", name="pso1") ddc = aa1AxisDriveDataCollection(AA1_IOC_NAME+ ":" + AA1_AXIS_NAME + ":DDC:", name="ddc") @@ -355,7 +355,7 @@ class AerotechAutomation1Test(unittest.TestCase): ddc.wait_for_connection() print("\nAX:PSO: Checking axis PSO in distance mode (basic)") if dev.output.value: - dev.toggle() + dev.toggle() sleep(1) print("AX:PSO: Directly checking basic 'toggled' event generation (1/3)") @@ -369,13 +369,13 @@ class AerotechAutomation1Test(unittest.TestCase): mot.move(mot.position + 5) sleep(1) self.assertTrue(dev.output.value != last_pso, f"Expected to toggle the PSO output at step {ii}, got {dev.output.value}") - dev.unstage() + dev.unstage() ddc.unstage() print("AX:PSO: Checking basic 'toggled' event generation with DDC (2/3)") # Configure steps and move to middle of range dev.configure({'distance': 2, 'wmode': "toggle"}) - dev.stage() + dev.stage() # Configure DDC npoints = 720 / 2.0 @@ -383,7 +383,7 @@ class AerotechAutomation1Test(unittest.TestCase): ddc.configure(cfg) ddc.stage() npoints_rbv = ddc.nsamples_rbv.value - self.assertEqual(npoints_rbv, 0, f"DDC.stage should reset the number of DDC points but got: {npoints_rbv}") + self.assertEqual(npoints_rbv, 0, f"DDC.stage should reset the number of DDC points but got: {npoints_rbv}") self.assertTrue(dev.output.value==0, "Expected to start from LOW state") # Start moving and wait for polling @@ -415,11 +415,11 @@ class AerotechAutomation1Test(unittest.TestCase): mot.move(mot.position + 720) sleep(0.5) - # Evaluate results + # Evaluate results npoints_rbv = ddc.nsamples_rbv.value self.assertTrue(np.abs(npoints_rbv-3*720/1.8)<=1, f"Expected to record {3*720/1.8} points but got {npoints_rbv}") print("AX:PSO: Done testing basic PSO distance functionality!") - dev.unstage() + dev.unstage() ddc.unstage() def test_10_PsoIntegration01(self): @@ -443,36 +443,36 @@ class AerotechAutomation1Test(unittest.TestCase): dev.configure({'distance': vec_dist, 'wmode': "toggle"}) if dev.output.value: dev.toggle() - dev.stage() - + dev.stage() + # Configure DDC npoints_exp = len(vec_dist)/2 cfg = {'npoints': npoints_exp+100, 'trigger': DriveDataCaptureTrigger.PsoOutput} ddc.configure(cfg) ddc.stage() npoints_rbv = ddc.nsamples_rbv.value - self.assertEqual(npoints_rbv, 0, f"DDC.stage should reset the number of DDC points but got: {npoints_rbv}") + self.assertEqual(npoints_rbv, 0, f"DDC.stage should reset the number of DDC points but got: {npoints_rbv}") self.assertTrue(dev.output.value==0, "Expected to start from LOW state") # Start moving and wait for polling mot.move(mot.position + np.sum(vec_dist) + 10) sleep(0.9) - # Evaluate results + # Evaluate results npoints_rbv = ddc.nsamples_rbv.value self.assertTrue(np.abs(npoints_rbv-npoints_exp)<1, f"Expected to record {npoints_exp} points but got {npoints_rbv}") self.assertTrue(dev.output.value==0, "Expected to finish in LOW state") self.assertTrue(dev.dstArrayDepleted.value, "Expected to cover all pints in the distance array") - dev.unstage() - ddc.unstage() + dev.unstage() + ddc.unstage() print("AX:PSO: Checking 'individual' style trigger signal with DDC (2/5)") - # This is practically golden ratio tomography! + # This is practically golden ratio tomography! acc_dist = 0.5 * mot.velocity.value * mot.acceleration.value vec_dist = [acc_dist] vec_dist.extend([1.618]* 100) dev.configure({'distance': vec_dist, 'wmode': "pulsed"}) - dev.stage() + dev.stage() # Configure DDC npoints_exp = len(vec_dist) @@ -487,13 +487,13 @@ class AerotechAutomation1Test(unittest.TestCase): mot.move(mot.position - np.sum(vec_dist) - acc_dist) sleep(0.9) - # Evaluate results + # Evaluate results npoints_rbv = ddc.nsamples_rbv.value self.assertTrue(np.abs(npoints_rbv-npoints_exp)<1, f"Expected to record {npoints_exp} points but got {npoints_rbv}") self.assertTrue(dev.output.value==0, "Expected to finish in LOW state") - self.assertTrue(dev.dstArrayDepleted.value, "Expected to cover all pints in the distance array") + self.assertTrue(dev.dstArrayDepleted.value, "Expected to cover all pints in the distance array") print("AX:PSO: Done testing PSO module in distance mode!") - dev.unstage() + dev.unstage() ddc.unstage()