Closedown

This commit is contained in:
X11MA
2016-02-05 16:32:43 +01:00
parent 2437ab5965
commit 064fd73c94
4 changed files with 128 additions and 51 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
MCPArray1=ch.psi.pshell.epics.ChannelIntegerArray|X11MA-ES4:PHC-CTRWF1|Read||true
#MCPArray1=ch.psi.pshell.epics.ChannelIntegerArray|X11MA-ES4:PHC-CTRWF1|Read||true
SamplingTime=ch.psi.pshell.epics.ChannelDouble|X11MA-ES4:SAMPLE-TIME|Read||true
MCPArray2=ch.psi.pshell.epics.ChannelIntegerArray|X11MA-ES4:PHC-CTRWF2|Read||true
NrCounters=ch.psi.pshell.epics.ChannelInteger|X11MA-ES4:NCTR|Read||true
+30 -16
View File
@@ -319,26 +319,32 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jRadioButton3" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jRadioButton1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jRadioButton1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="80" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="80" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Component id="jRadioButton3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="48" max="-2" attributes="0"/>
<Component id="jCheckBox4" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
@@ -407,7 +413,10 @@
<Component id="jCheckBox3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jRadioButton3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jRadioButton3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="13" max="32767" attributes="0"/>
@@ -515,7 +524,12 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel15">
<Properties>
<Property name="text" type="java.lang.String" value="Camshaft pos"/>
<Property name="text" type="java.lang.String" value="Camshaft position"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox4">
<Properties>
<Property name="text" type="java.lang.String" value="Save array data"/>
</Properties>
</Component>
</SubComponents>
+27 -16
View File
@@ -113,6 +113,7 @@ public class EnergyScan extends Panel {
args.put("MCP_2", jCheckBox3.isSelected() ? 1 : 2);
args.put("Cam_start", jSpinner1.getValue());
args.put("Cam_end", jSpinner2.getValue());
args.put("Save_array_data", jCheckBox4.isSelected() ? 1 : 2);
buttonAbort.setEnabled(true);
@@ -218,6 +219,7 @@ public class EnergyScan extends Panel {
jLabel9 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jCheckBox4 = new javax.swing.JCheckBox();
panelSetup = new javax.swing.JPanel();
comboSetup = new javax.swing.JComboBox();
buttonConfigure = new javax.swing.JButton();
@@ -428,7 +430,9 @@ public class EnergyScan extends Panel {
jLabel14.setText("end");
jLabel15.setText("Camshaft pos");
jLabel15.setText("Camshaft position");
jCheckBox4.setText("Save array data");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
@@ -436,21 +440,25 @@ public class EnergyScan extends Panel {
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jRadioButton3)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2))
.addGap(80, 80, 80)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox3)
.addComponent(jCheckBox2)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel7)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2))
.addGap(80, 80, 80)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox3)
.addComponent(jCheckBox2)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel7)))
.addGap(35, 35, 35)
.addComponent(jRadioButton3)
.addGap(48, 48, 48)
.addComponent(jCheckBox4)))
.addGap(31, 31, 31)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -503,7 +511,9 @@ public class EnergyScan extends Panel {
.addComponent(jRadioButton2)
.addComponent(jCheckBox3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jRadioButton3)))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton3)
.addComponent(jCheckBox4))))
.addContainerGap(13, Short.MAX_VALUE))
);
@@ -640,6 +650,7 @@ public class EnergyScan extends Panel {
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JCheckBox jCheckBox3;
private javax.swing.JCheckBox jCheckBox4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
+70 -18
View File
@@ -1,6 +1,6 @@
import os
import traceback
import numpy
############################PGM+ID1+ID2###################################################
if str(SET_OFFSETS) == "1":
print "Setting offsets"
@@ -65,25 +65,71 @@ def _startPlot(type):
s = p.getSeries(0)
cur = 0
time.sleep(3.0)
if (MCP_1 == 1 or MPC_2 == 1):
MCP1 = [[0 for x in range(1)] for x in range(NrCounters.read())]
MCP2 = [[0 for x in range(1)] for x in range(NrCounters.read())]
if (MCP_1 == 1 or MCP_2 == 1):
MCP1 = []
MCP2 = []
a1r = []
a2r = []
output_file_MCP1 = output_path+"MCP1"+file_prefix+"_" + suffix + ".dat"
output_file_MCP2 = output_path+"MCP2"+file_prefix+"_" + suffix + ".dat"
MCP1out = open(output_file_MCP1, "w+")
MCP2out = open(output_file_MCP2, "w+")
MCP1out.write("rbkenergy" + sep + "Sum1" + sep + "Sum2" + sep + "Cam1" + sep + "Cam2" + sep + "Array" + line_sep)
MCP2out.write("rbkenergy" + sep + "Sum1" + sep + "Sum2" + sep + "Cam1" + sep + "Cam2" + sep + "Array" + line_sep)
MCP1out = open(output_file_MCP1, "a+")
MCP2out = open(output_file_MCP2, "a+")
#MCP1out.write("rbkenergy" + sep + "Sum1" + sep + "Sum2" + sep + "Cam1" + sep + "Cam2" + sep + "Array" + line_sep)
#MCP2out.write("rbkenergy" + sep + "Sum1" + sep + "Sum2" + sep + "Cam1" + sep + "Cam2" + sep + "Array" + line_sep)
while running:
try:
if otf_start.read() == 0:
break
e = energy.read()
if (MCP_1 == 1 or MPC_2 == 1):
numpy.vstack([MCP1, MCPArray1.read()])
numpy.vstack([MCP2, MCPArray2.read()])
if MCP_1 == 1:
a1=MCPArray1.read()
for i in a1:
a1r.append(i)
Sum1a1 = 0
Cam1a1 = 0
Sum2a1 = 0
Cam2a1 = 0
#print i
for i in range(0,479):
Sum1a1 = Sum1a1 + a1r[i]
for i in range(Cam_start,Cam_end):
Cam1a1 = Cam1a1 + a1r[i]
#for i in range(480,959):
# Sum2a1 = Sum2a1 + a1r[i]
MCP1.append(line_sep)
MCP1.append(e)
MCP1.append(Sum1a1)
MCP1.append(Cam1a1)
if Save_array_data == 1:
MCP1.append(a1r)
a1r = []
sMCP1 = sep.join(str(x) for x in MCP1) + line_sep # MCP1.write("%s" + sep % i)
MCP1out.write(sep + "rbkenergy" + sep + "Sum1" + sep + "Sum2" + sep + "Cam1" + sep + "Cam2" + sep + "Array" + line_sep + sMCP1)
if MCP_2 == 1:
a2=MCPArray2.read()
for i in a2:
a2r.append(i)
Sum1a2 = 0
Cam1a2 = 0
Sum2a2 = 0
Cam2a2 = 0
#print i
for i in range(0,479):
Sum1a1 = Sum1a2 + a2r[i]
for i in range(Cam_start,Cam_end):
Cam1a2 = Cam1a2 + a2r[i]
#for i in range(480,959):
# Sum2a1 = Sum2a1 + a1r[i]
MCP2.append(line_sep)
MCP2.append(e)
MCP2.append(Sum1a1)
MCP2.append(Cam1a1)
if Save_array_data == 1:
MCP2.append(a2r)
a2r = []
sMCP2 = sep.join(str(x) for x in MCP2) + line_sep # MCP1.write("%s" + sep % i)
MCP2out.write(sep + "rbkenergy" + sep + "Sum1" + sep + "Sum2" + sep + "Cam1" + sep + "Cam2" + sep + "Array" + line_sep + sMCP2)
time.sleep(SamplingTime.read()*0.001)
print MCP_1
if (abs(e-cur)) > 0.1:
v = abs((keithley_2a.read() / ((keithley_1a if (type==1) else keithley_3a).read() )))
s.appendData(e,v)
@@ -92,8 +138,14 @@ def _startPlot(type):
except:
pass
print "Done Plotting"
MCP1out.write(MCP1)
MCP2out.write(MCP2)
if (MCP_1 == 1 or MCP_2 == 1):
#lines=radlines(MCP1)
#for lines in MCP1:
#for line in lines[1:]:
#MCP1out.writelines(MCP1)
#MCP2out.write(MCP2)
MCP1out.close()
MCP2out.close()
def startPlot(type = 1):
global task
task = fork((_startPlot,(type,)),)
@@ -137,13 +189,13 @@ fid = get_next_fid(input_path, "o" + file_prefix)
###############################################################################
#Prepare scan
###############################################################################
if ID1 == 1:
'''if ID1 == 1:
caput ("X11PHS-E:OPT","PGM+ID1")
elif ID2 == 1:
caput ("X11PHS-E:OPT","PGM+ID2")
else:
caput ("X11PHS-E:OPT","PGM+ID1+ID2")
'''
number_of_scans = 1
if RUNTYPE in ["+/-", "+", "-"]:
caput(OTF_MODE1,1) # circ + in ID1
@@ -176,14 +228,14 @@ time.sleep(1.0)
wait_channel(OTF_DONE, 1, type = 'i')
open_vg10()
'''open_vg10()
time.sleep(0.5)
open_vg11()
time.sleep(0.5)
open_vg12()
time.sleep(0.5)
open_vg13()
'''
for scan_no in range(number_of_scans):
suffix = ("%03d" % fid)
input_file = input_path + "o" + file_prefix + "_" + suffix + ".dat"