diff --git a/plugins/Kollimators.java b/plugins/Kollimators.java index b683e7d..7e309dd 100644 --- a/plugins/Kollimators.java +++ b/plugins/Kollimators.java @@ -13,7 +13,7 @@ public class Kollimators extends javax.swing.JPanel { /** * Creates new form Kollimators */ - public Kollimators() { + public Kollimators(String params) { initComponents(); } diff --git a/plugins/TestingList.form b/plugins/TestingList.form index 86189a6..3a91eea 100644 --- a/plugins/TestingList.form +++ b/plugins/TestingList.form @@ -220,7 +220,7 @@ - + @@ -234,208 +234,224 @@ - + - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - + - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 6d3a4e7..9b39708 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -318,7 +318,8 @@ public class TestingList extends Panel { try { //create a class to visualise the details panel Class testingListDetailsClass = getController().getClassByName("Kollimators"); - JPanel detailsPanel = (JPanel) testingListDetailsClass.getConstructor(null).newInstance(new Object[]{null}); + JPanel detailsPanel = (JPanel) testingListDetailsClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{""}); + this.jPanelCustom.add(detailsPanel); } catch (ClassNotFoundException ex) { Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchMethodException ex) { @@ -413,12 +414,13 @@ public class TestingList extends Panel { jScrollPane2 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); - jButtonRun = new javax.swing.JButton(); + jPanelTopCommands = new javax.swing.JPanel(); jPanelButtons = new javax.swing.JPanel(); jButtonOptions = new javax.swing.JButton(); jButtonSave = new javax.swing.JButton(); jButtonOpen = new javax.swing.JButton(); - jPanel2 = new javax.swing.JPanel(); + jButtonRun = new javax.swing.JButton(); + jPanelSelection = new javax.swing.JPanel(); jCheckBoxEnableDisable = new javax.swing.JCheckBox(); jButtonMoveDown = new javax.swing.JButton(); jButtonMoveUp = new javax.swing.JButton(); @@ -595,21 +597,12 @@ public class TestingList extends Panel { add(jScrollPane2, java.awt.BorderLayout.CENTER); - jPanel1.setMinimumSize(new java.awt.Dimension(100, 100)); + jPanel1.setMinimumSize(new java.awt.Dimension(100, 200)); jPanel1.setPreferredSize(new java.awt.Dimension(110, 110)); jPanel1.setLayout(new java.awt.BorderLayout()); - jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/play-circled-64-000000.png"))); // NOI18N - jButtonRun.setToolTipText("Run enabled tests"); - jButtonRun.setMaximumSize(new java.awt.Dimension(330000, 39)); - jButtonRun.setMinimumSize(new java.awt.Dimension(90, 90)); - jButtonRun.setPreferredSize(new java.awt.Dimension(90, 39)); - jButtonRun.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonRunActionPerformed(evt); - } - }); - jPanel1.add(jButtonRun, java.awt.BorderLayout.CENTER); + jPanelTopCommands.setMinimumSize(new java.awt.Dimension(115, 100)); + jPanelTopCommands.setLayout(new java.awt.BorderLayout()); jPanelButtons.setMinimumSize(new java.awt.Dimension(0, 80)); jPanelButtons.setPreferredSize(new java.awt.Dimension(100, 80)); @@ -650,9 +643,21 @@ public class TestingList extends Panel { }); jPanelButtons.add(jButtonOpen, java.awt.BorderLayout.PAGE_END); - jPanel1.add(jPanelButtons, java.awt.BorderLayout.EAST); + jPanelTopCommands.add(jPanelButtons, java.awt.BorderLayout.EAST); - jPanel2.setLayout(new java.awt.BorderLayout()); + jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/play-circled-64-000000.png"))); // NOI18N + jButtonRun.setToolTipText("Run enabled tests"); + jButtonRun.setMaximumSize(new java.awt.Dimension(330000, 39)); + jButtonRun.setMinimumSize(new java.awt.Dimension(90, 90)); + jButtonRun.setPreferredSize(new java.awt.Dimension(90, 39)); + jButtonRun.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButtonRunActionPerformed(evt); + } + }); + jPanelTopCommands.add(jButtonRun, java.awt.BorderLayout.CENTER); + + jPanelSelection.setLayout(new java.awt.BorderLayout()); jCheckBoxEnableDisable.setToolTipText("Enable/Disable the selected tests"); jCheckBoxEnableDisable.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); @@ -662,7 +667,7 @@ public class TestingList extends Panel { jCheckBoxEnableDisableActionPerformed(evt); } }); - jPanel2.add(jCheckBoxEnableDisable, java.awt.BorderLayout.WEST); + jPanelSelection.add(jCheckBoxEnableDisable, java.awt.BorderLayout.WEST); jButtonMoveDown.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/chevron-down-16-000000.png"))); // NOI18N jButtonMoveDown.setToolTipText("Move the selected tests down"); @@ -674,7 +679,7 @@ public class TestingList extends Panel { jButtonMoveDownActionPerformed(evt); } }); - jPanel2.add(jButtonMoveDown, java.awt.BorderLayout.SOUTH); + jPanelSelection.add(jButtonMoveDown, java.awt.BorderLayout.SOUTH); jButtonMoveUp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/chevron-up-16-000000.png"))); // NOI18N jButtonMoveUp.setToolTipText("Move the selected tests up"); @@ -686,12 +691,14 @@ public class TestingList extends Panel { jButtonMoveUpActionPerformed(evt); } }); - jPanel2.add(jButtonMoveUp, java.awt.BorderLayout.PAGE_START); + jPanelSelection.add(jButtonMoveUp, java.awt.BorderLayout.PAGE_START); - jPanel1.add(jPanel2, java.awt.BorderLayout.LINE_START); - jPanel1.add(jPanelCustom, java.awt.BorderLayout.PAGE_END); + jPanelTopCommands.add(jPanelSelection, java.awt.BorderLayout.LINE_START); + + jPanel1.add(jPanelTopCommands, java.awt.BorderLayout.CENTER); add(jPanel1, java.awt.BorderLayout.NORTH); + add(jPanelCustom, java.awt.BorderLayout.PAGE_END); }// //GEN-END:initComponents private void jButtonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRunActionPerformed @@ -985,9 +992,10 @@ public class TestingList extends Panel { private javax.swing.JMenuItem jMenuItemShowDetails; private javax.swing.JMenu jMenuSelect; private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanelButtons; private javax.swing.JPanel jPanelCustom; + private javax.swing.JPanel jPanelSelection; + private javax.swing.JPanel jPanelTopCommands; private javax.swing.JPopupMenu jPopupMenuConfigs; private javax.swing.JPopupMenu jPopupMenuOptions; private javax.swing.JPopupMenu jPopupMenuTable; diff --git a/script/Motor Test 3 100ms.py b/script/Motor Test 3 100ms.py deleted file mode 100644 index 791be9c..0000000 --- a/script/Motor Test 3 100ms.py +++ /dev/null @@ -1,161 +0,0 @@ -#Script Motor Test 3 -#Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times -time.sleep(5) -import traceback - -#by default, failed -ret = 'Test failed' -status = False -DEVICE="PO2DV-NCS-LS" -params = parameters -print "100ms params: " -print params - -#TODO: Set the diplay names of positioners and detectors -#scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20]) -scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) -scan.setPlotName("Bla") -scan.start() - -#Creating channels: dimension 1 -try: - #RegionPositioner idInkr - #idInkr = Channel(DEVICE+':INKR:2', type = 'd') - idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') - #ScalarDetector idMotorStatus - #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') - idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') - #ScalarDetector idLogicalPosition - #idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') - idLogicalPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') - #ScalarDetector idDiameter - #idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') - idDiameter = Channel(DEVICE+':ENCODERoff', type = 'd') - #ScalarDetector idMotorPosition - #idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') - idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') - #ScalarDetector idPotiRaw - #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') - idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') - #ScalarDetector idPotiProc - #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') - idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') - #ScalarDetector idBtvsRaw - #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') - idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') - #ScalarDetector idBtvsProc - #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') - idBtvsProc = Channel(DEVICE+':MOTOR.HLS', type = 'd') - #ScalarDetector idEndSwitchL - #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') - idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') - #ScalarDetector idEndSwitchH - #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') - idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') - #high position limit - idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') - #low position limit - idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') -except: - print "Unexpected error:", sys.exc_info()[0] - ret = 'Unable to create channel - ' + traceback.format_exc() - success = False - raise - sys.exit() - -#remove limits -idLimitH.put(999999.9, timeout=None) -idLimitL.put(-999999.9, timeout=None) - - -#Dimension 1 -direction = 1.0; -startDefault = -100.0 -endDefault = 1000.0 -end = endDefault -#find position at Low end switch: it will be the starting point of the test -idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout -start = idInkr.get()+direction -countSteps = 0 -count = 0 -for setpoint1 in range(0, 0): - count = count + 1 - sleep( 5 ) # Settling time - #RegionPositioner idInkr - for setpoint2 in frange(start, end, direction): - readback1 = setpoint1 - idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout - sleep( 0.1 ) # Settling time - readback2 = idInkr.get() - #if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy - # ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' - # success = False - # raise Exception(ret) - #Detector idMotorStatus - detector1 = idMotorStatus.get() - #Detector idLogicalPosition - detector2 = idLogicalPosition.get() - #Detector idDiameter - detector3 = idDiameter.get() - #Detector idMotorPosition - detector4 = idMotorPosition.get() - #Detector idPotiRaw - detector5 = idPotiRaw.get() - #Detector idPotiProc - detector6 = idPotiProc.get() - #Detector idBtvsRaw - detector7 = idBtvsRaw.get() - #Detector idBtvsProc - detector8 = idBtvsProc.get() - #end switches - endH = idEndSwitchH.get() - endL = idEndSwitchL.get() - #Manipulation idDiff02 - #Variable Mappings - a = detector4 - b = detector8 - idDiff02 = a-b - #Manipulation idDiff01 - #Variable Mappings - a = detector4 - b = detector6 - idDiff01 = a-b - countSteps = countSteps + 1 - scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) - if endH>0.0 : - #invert direction and swap start with end of translation - end = startDefault - start = readback2 - direction - direction = -1.0 - print 'End H switch, changing direction to ' + str(direction) - break - if endL>0.0 : - #invert direction and swap start with end of translation - end = endDefault - start = readback2 - direction - direction = 1.0 - print 'End L switch, changing direction to ' + str(direction) - break - - - -#set limits back -idLimitH.put(145.0, timeout=None) -idLimitL.put(0.0, timeout=None) - -#Closing channels -idInkr.close() -idMotorStatus.close() -idLogicalPosition.close() -idDiameter.close() -idMotorPosition.close() -idPotiRaw.close() -idPotiProc.close() -idBtvsRaw.close() -idBtvsProc.close() - -scan.end() -ret = 'Slide moved back and forth (' + str(count) + ' runs)' -status = True - -set_return("OK") \ No newline at end of file diff --git a/script/Motor Test 3 200ms.py b/script/Motor Test 3 200ms.py deleted file mode 100644 index 00184f6..0000000 --- a/script/Motor Test 3 200ms.py +++ /dev/null @@ -1,157 +0,0 @@ -#Script Motor Test 3 -#Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times -time.sleep(2) -import traceback - -#by default, failed -ret = 'Test failed' -status = False -DEVICE="PO2DV-NCS-LS" - -#TODO: Set the diplay names of positioners and detectors -#scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20]) -scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) -scan.setPlotName("Bla") -scan.start() - -#Creating channels: dimension 1 -try: - #RegionPositioner idInkr - #idInkr = Channel(DEVICE+':INKR:2', type = 'd') - idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') - #ScalarDetector idMotorStatus - #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') - idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') - #ScalarDetector idLogicalPosition - #idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') - idLogicalPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') - #ScalarDetector idDiameter - #idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') - idDiameter = Channel(DEVICE+':ENCODERoff', type = 'd') - #ScalarDetector idMotorPosition - #idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') - idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') - #ScalarDetector idPotiRaw - #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') - idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') - #ScalarDetector idPotiProc - #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') - idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') - #ScalarDetector idBtvsRaw - #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') - idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') - #ScalarDetector idBtvsProc - #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') - idBtvsProc = Channel(DEVICE+':MOTOR.HLS', type = 'd') - #ScalarDetector idEndSwitchL - #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') - idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') - #ScalarDetector idEndSwitchH - #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') - idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') - #high position limit - idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') - #low position limit - idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') -except: - print "Unexpected error:", sys.exc_info()[0] - ret = 'Unable to create channel - ' + traceback.format_exc() - success = False - raise - sys.exit() - -#remove limits -idLimitH.put(999999.9, timeout=None) -idLimitL.put(-999999.9, timeout=None) - -#Dimension 1 -direction = 1.0; -startDefault = -100.0 -endDefault = 10.0 -end = endDefault -#find position at Low end switch: it will be the starting point of the test -idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout -start = idInkr.get()+direction -countSteps = 0 -count = 0 -for setpoint1 in range(0, 0): - count = count + 1 - sleep( 5 ) # Settling time - #RegionPositioner idInkr - for setpoint2 in frange(start, end, direction): - readback1 = setpoint1 - idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout - sleep( 0.2 ) # Settling time - readback2 = idInkr.get() - #if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy - # ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' - # success = False - # raise Exception(ret) - #Detector idMotorStatus - detector1 = idMotorStatus.get() - #Detector idLogicalPosition - detector2 = idLogicalPosition.get() - #Detector idDiameter - detector3 = idDiameter.get() - #Detector idMotorPosition - detector4 = idMotorPosition.get() - #Detector idPotiRaw - detector5 = idPotiRaw.get() - #Detector idPotiProc - detector6 = idPotiProc.get() - #Detector idBtvsRaw - detector7 = idBtvsRaw.get() - #Detector idBtvsProc - detector8 = idBtvsProc.get() - #end switches - endH = idEndSwitchH.get() - endL = idEndSwitchL.get() - #Manipulation idDiff02 - #Variable Mappings - a = detector4 - b = detector8 - idDiff02 = a-b - #Manipulation idDiff01 - #Variable Mappings - a = detector4 - b = detector6 - idDiff01 = a-b - countSteps = countSteps + 1 - scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) - if endH>0.0 : - #invert direction and swap start with end of translation - end = startDefault - start = readback2 - direction - direction = -1.0 - print 'End H switch, changing direction to ' + str(direction) - break - if endL>0.0 : - #invert direction and swap start with end of translation - end = endDefault - start = readback2 - direction - direction = 1.0 - print 'End L switch, changing direction to ' + str(direction) - break - - - -#set limits back -idLimitH.put(145.0, timeout=None) -idLimitL.put(0.0, timeout=None) - -#Closing channels -idInkr.close() -idMotorStatus.close() -idLogicalPosition.close() -idDiameter.close() -idMotorPosition.close() -idPotiRaw.close() -idPotiProc.close() -idBtvsRaw.close() -idBtvsProc.close() - -scan.end() -ret = 'Slide moved back and forth (' + str(count) + ' runs)' -status = True - -set_return("OK2") \ No newline at end of file diff --git a/script/Motor Test 3 500ms.py b/script/Motor Test 3 500ms.py deleted file mode 100644 index fc7a467..0000000 --- a/script/Motor Test 3 500ms.py +++ /dev/null @@ -1,153 +0,0 @@ -#Script Motor Test 3 -#Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times - -import traceback - -#by default, failed -ret = 'Test failed' -status = False - -#TODO: Set the diplay names of positioners and detectors -#scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20]) -scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20]) -scan.start() - -#Creating channels: dimension 1 -try: - #RegionPositioner idInkr - #idInkr = Channel(DEVICE+':INKR:2', type = 'd') - idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') - #ScalarDetector idMotorStatus - #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') - idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') - #ScalarDetector idLogicalPosition - #idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') - idLogicalPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') - #ScalarDetector idDiameter - #idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') - idDiameter = Channel(DEVICE+':ENCODERoff', type = 'd') - #ScalarDetector idMotorPosition - #idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') - idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd') - #ScalarDetector idPotiRaw - #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') - idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') - #ScalarDetector idPotiProc - #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') - idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') - #ScalarDetector idBtvsRaw - #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') - idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') - #ScalarDetector idBtvsProc - #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') - idBtvsProc = Channel(DEVICE+':MOTOR.HLS', type = 'd') - #ScalarDetector idEndSwitchL - #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') - idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd') - #ScalarDetector idEndSwitchH - #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') - idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd') - #high position limit - idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd') - #low position limit - idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd') -except: - print "Unexpected error:", sys.exc_info()[0] - ret = 'Unable to create channel - ' + traceback.format_exc() - success = False - raise - sys.exit() - -#remove limits -idLimitH.put(999999.9, timeout=None) -idLimitL.put(-999999.9, timeout=None) - -#Dimension 1 -direction = 1.0; -startDefault = -100.0 -endDefault = 1000.0 -end = endDefault -#find position at Low end switch: it will be the starting point of the test -idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout -start = idInkr.get()+direction -countSteps = 0 -count = 0 -for setpoint1 in range(0, 10): - count = count + 1 - sleep( 5 ) # Settling time - #RegionPositioner idInkr - for setpoint2 in frange(start, end, direction): - readback1 = setpoint1 - idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout - sleep( 0.5 ) # Settling time - readback2 = idInkr.get() - #if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy - # ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' - # success = False - # raise Exception(ret) - #Detector idMotorStatus - detector1 = idMotorStatus.get() - #Detector idLogicalPosition - detector2 = idLogicalPosition.get() - #Detector idDiameter - detector3 = idDiameter.get() - #Detector idMotorPosition - detector4 = idMotorPosition.get() - #Detector idPotiRaw - detector5 = idPotiRaw.get() - #Detector idPotiProc - detector6 = idPotiProc.get() - #Detector idBtvsRaw - detector7 = idBtvsRaw.get() - #Detector idBtvsProc - detector8 = idBtvsProc.get() - #end switches - endH = idEndSwitchH.get() - endL = idEndSwitchL.get() - #Manipulation idDiff02 - #Variable Mappings - a = detector4 - b = detector8 - idDiff02 = a-b - #Manipulation idDiff01 - #Variable Mappings - a = detector4 - b = detector6 - idDiff01 = a-b - countSteps = countSteps + 1 - scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) - if endH>0.0 : - #invert direction and swap start with end of translation - end = startDefault - start = readback2 - direction - direction = -1.0 - print 'End H switch, changing direction to ' + str(direction) - break - if endL>0.0 : - #invert direction and swap start with end of translation - end = endDefault - start = readback2 - direction - direction = 1.0 - print 'End L switch, changing direction to ' + str(direction) - break - - - -#set limits back -idLimitH.put(145.0, timeout=None) -idLimitL.put(0.0, timeout=None) - -#Closing channels -idInkr.close() -idMotorStatus.close() -idLogicalPosition.close() -idDiameter.close() -idMotorPosition.close() -idPotiRaw.close() -idPotiProc.close() -idBtvsRaw.close() -idBtvsProc.close() - -scan.end() -ret = 'Slide moved back and forth (' + str(count) + ' runs)' -status = True diff --git a/script/Motor Test 3 original.py b/script/Motor Test 3 original.py deleted file mode 100644 index 68623d9..0000000 --- a/script/Motor Test 3 original.py +++ /dev/null @@ -1,81 +0,0 @@ -#Script imported from: Motor Test 3 - with original pv.xml - -#TODO: Set the diplay names of positioners and detectors -scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [0.0, 0.0], [3000.0, 10.0], [3000, 20]) -scan.start() - -#Creating channels: dimension 1 -#PseudoPositioner idX -#RegionPositioner idInkr -idInkr = Channel('{DEVICE}:INKR:2', type = 'd') -#ScalarDetector idMotorStatus -idMotorStatus = Channel('{DEVICE}:STA:1', type = 'd') -#ScalarDetector idLogicalPosition -idLogicalPosition = Channel('{DEVICE}:IST:2', type = 'd') -#ScalarDetector idDiameter -idDiameter = Channel('{DEVICE}:DIAM:2', type = 'd') -#ScalarDetector idMotorPosition -idMotorPosition = Channel('{DEVICE}:IST1:2', type = 'd') -#ScalarDetector idPotiRaw -idPotiRaw = Channel('{DEVICE}:POSA:1', type = 'd') -#ScalarDetector idPotiProc -idPotiProc = Channel('{DEVICE}:POSA:2', type = 'd') -#ScalarDetector idBtvsRaw -idBtvsRaw = Channel('{DEVICE}:IST3:1', type = 'd') -#ScalarDetector idBtvsProc -idBtvsProc = Channel('{DEVICE}:IST3:2', type = 'd') - -#Dimension 1 -#PseudoPositioner idX -for setpoint1 in range(0, 3000): - readback1 = setpoint1 - sleep( 0.1 ) # Settling time - #RegionPositioner idInkr - for setpoint2 in frange(0.0, 10.0, 1.0, True) + frange(11.0, 0.0, -1.0, True): - idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout - readback2 = idInkr.get() - if abs(readback2 - setpoint2) > -0.5 : # TODO: Check accuracy - raise Exception('Actor idInkr could not be set to the value ' + str(setpoint2)) - sleep( 5.0 ) # Settling time - #Detector idMotorStatus - detector1 = idMotorStatus.get() - #Detector idLogicalPosition - detector2 = idLogicalPosition.get() - #Detector idDiameter - detector3 = idDiameter.get() - #Detector idMotorPosition - detector4 = idMotorPosition.get() - #Detector idPotiRaw - detector5 = idPotiRaw.get() - #Detector idPotiProc - detector6 = idPotiProc.get() - #Detector idBtvsRaw - detector7 = idBtvsRaw.get() - #Detector idBtvsProc - detector8 = idBtvsProc.get() - #Manipulation idDiff02 - #Variable Mappings - a = detector4 - b = detector8 - count = setpoint1 - idDiff02 = a-b - #Manipulation idDiff01 - #Variable Mappings - a = detector4 - b = detector6 - count = setpoint1 - idDiff01 = a-b - scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) - -#Closing channels -idInkr.close() -idMotorStatus.close() -idLogicalPosition.close() -idDiameter.close() -idMotorPosition.close() -idPotiRaw.close() -idPotiProc.close() -idBtvsRaw.close() -idBtvsProc.close() - -scan.end() diff --git a/script/dummy.py b/script/dummy.py deleted file mode 100644 index ebeb96f..0000000 --- a/script/dummy.py +++ /dev/null @@ -1 +0,0 @@ -set_return("OK dammy") \ No newline at end of file diff --git a/script/pshellTestGeneral.py b/script/pshellTestGeneral.py deleted file mode 100644 index ca1371d..0000000 --- a/script/pshellTestGeneral.py +++ /dev/null @@ -1,22 +0,0 @@ -global print_log, sendFeedback, inspect -import sys, inspect, os, traceback, time - -def print_log(testName, DEVICE, text): - time.ctime() - now = time.strftime('%Y.%m.%d %H:%M:%S') - textToLog = now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) - print textToLog - - -#prepare and send feedback to calling tool -def buildFeedback(testPath, testName, DEVICE, returnString, testPassed): - print_log(testName, DEVICE, 'End of test. Result:') - print_log(testName, DEVICE, 'Device: ' + DEVICE) - print_log(testName, DEVICE, 'Test name: ' + testName) - print_log(testName, DEVICE, 'Test path: ' + testPath) - print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) - print_log(testName, DEVICE, 'Return string: ' + returnString) - ret = [testPath, DEVICE, returnString, testPassed] - return ret - - \ No newline at end of file diff --git a/script/testLocalVar1.py b/script/testLocalVar1.py deleted file mode 100644 index 9bb7ed9..0000000 --- a/script/testLocalVar1.py +++ /dev/null @@ -1,15 +0,0 @@ -global aa -global bb -def bb(): - print "bb" -def aa(): - print "aa" - bb() - -print 'testLocalVar1- a: ' + str(a) -print 'testLocalVar1- b: ' + str(b) -time.ctime() -print time.strftime('%Y.%m.%d %H:%M:%S') -bb() -aa() -set_return("OK 1") \ No newline at end of file diff --git a/script/testLocalVar2.py b/script/testLocalVar2.py deleted file mode 100644 index 7930333..0000000 --- a/script/testLocalVar2.py +++ /dev/null @@ -1,7 +0,0 @@ -print 'testLocalVar2- a: ' + str(a) -print 'testLocalVar2- b: ' + str(b) -time.ctime() -print time.strftime('%Y.%m.%d %H:%M:%S') - - -set_return("OK 2") \ No newline at end of file diff --git a/script/testcommons - Copy.py b/script/testcommons - Copy.py deleted file mode 100644 index 4a8d741..0000000 --- a/script/testcommons - Copy.py +++ /dev/null @@ -1,24 +0,0 @@ -global print_log, sendFeedback, sys, inspect, os, traceback -import sys, inspect, os, traceback - -def print_log(testName, DEVICE, text): - import time - time.ctime() - now = time.strftime('%Y.%m.%d %H:%M:%S') - print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text) - -#prepare and send feedback to calling tool -def sendFeedback(testPath, testName, DEVICE, returnString, testPassed): - print_log(testName, DEVICE, 'End of test. Result:') - print_log(testName, DEVICE, 'Device: ' + DEVICE) - print_log(testName, DEVICE, 'Test name: ' + testName) - print_log(testName, DEVICE, 'Test path: ' + testPath) - print_log(testName, DEVICE, 'Test passed: ' + str(testPassed)) - print_log(testName, DEVICE, 'Return string: ' + returnString) - ret = [testPath, DEVICE, returnString, testPassed] - return ret - -pippo = 'pippo' - -def print_pio(): - print 'piopio' \ No newline at end of file diff --git a/script/testcommons.py b/script/testcommons.py deleted file mode 100644 index a0f1339..0000000 --- a/script/testcommons.py +++ /dev/null @@ -1,36 +0,0 @@ -global print_log, sendFeedback, sys, inspect, os, traceback -import sys, inspect, os, traceback - -class TestingTool: - - pippo = 'pippo' - deviceName = '' - testName = '' - testPath = '' - - def __init__(self, testName, testPath, deviceName): - self.deviceName = deviceName - self.testName = testName - self.testPath = testPath - - def print_log(self, text): - import time - time.ctime() - now = time.strftime('%Y.%m.%d %H:%M:%S') - print now + ' ' + self.deviceName + ' - ' + self.testName + ': ' + str(text) - - #prepare and send feedback to calling tool - def sendFeedback(self, returnString, testPassed): - self.print_log('End of test. Result:') - self.print_log('Device: ' + self.deviceName) - self.print_log('Test name: ' + self.testName) - self.print_log('Test path: ' + self.testPath) - self.print_log('Test passed: ' + str(testPassed)) - self.print_log('Return string: ' + returnString) - ret = [self.testPath, self.deviceName, returnString, testPassed] - set_return( ret) - - - - def print_pio(self): - print 'piopio' \ No newline at end of file