Closedown
This commit is contained in:
@@ -287,7 +287,7 @@
|
|||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="jButton1">
|
<Component class="javax.swing.JButton" name="jButton1">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Set Ref Phase"/>
|
<Property name="text" type="java.lang.String" value="Set"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ public class ShottkyScan extends Panel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
jButton1.setText("Set Ref Phase");
|
jButton1.setText("Set");
|
||||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
jButton1ActionPerformed(evt);
|
jButton1ActionPerformed(evt);
|
||||||
|
|||||||
@@ -9,21 +9,16 @@ if get_exec_pars().source == CommandSource.ui:
|
|||||||
else:
|
else:
|
||||||
start = args[0]
|
start = args[0]
|
||||||
stop = args[1]
|
stop = args[1]
|
||||||
step = args[2]
|
step = args[2]
|
||||||
nb = int(args[3])
|
nb = int(args[3])
|
||||||
lat = args[4]
|
lat = args[4]
|
||||||
|
|
||||||
|
|
||||||
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE-SIM", "SINEG01-RSYS:GET-VSUM-PHASE-SIM")
|
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE-SIM", "SINEG01-RSYS:GET-VSUM-PHASE-SIM")
|
||||||
phase.config.minValue =-45.0
|
phase.config.minValue =-45.0
|
||||||
phase.config.maxValue = 360.0
|
phase.config.maxValue = 360.0
|
||||||
phase.config.resolution = 0.5
|
phase.config.resolution = 0.5
|
||||||
phase.initialize()
|
phase.initialize()
|
||||||
|
|
||||||
V = Channel("SINEG01-RSYS:GET-VSUM-AMPLT-SIM", type = 'd', alias='Amplitude Readback')
|
|
||||||
P = Channel("SINEG01-RSYS:GET-KLY-POWER-SIM", type = 'd', alias='Power Readback')
|
|
||||||
|
|
||||||
|
|
||||||
#camtool = Camtool(url)
|
#camtool = Camtool(url)
|
||||||
#camtool.startPipeline(camera_name)
|
#camtool.startPipeline(camera_name)
|
||||||
#camtool.startReceiver()
|
#camtool.startReceiver()
|
||||||
@@ -39,40 +34,12 @@ try:
|
|||||||
rf_phase = r.getPositions(0)
|
rf_phase = r.getPositions(0)
|
||||||
E = [val.mean/1000.0/disp*energy0 for val in r.getReadable(0)]
|
E = [val.mean/1000.0/disp*energy0 for val in r.getReadable(0)]
|
||||||
dE = [val.mean/1000.0/disp*energy0 for val in r.getReadable(1)]
|
dE = [val.mean/1000.0/disp*energy0 for val in r.getReadable(1)]
|
||||||
caput("SINEG01-RSYS:GET-PHASE-ARRAY", to_array(rf_phase,'d'))
|
|
||||||
caput("SINEG01-RSYS:GET-CHARGE-ARRAY", to_array(charge, 'd'))
|
|
||||||
phase_fit_max = None
|
|
||||||
try:
|
|
||||||
(energy_max, angular_frequency, phase0, in_range, phase_fit_max, fit_x, fit_y) = hfit(energy , xdata = rf_phase)
|
|
||||||
except:
|
|
||||||
raise Exception("Fit failure")
|
|
||||||
caput("SINEG01-RSYS:GET-ONCREST-VSUM-PHASE", phase_fit_max)
|
|
||||||
caput("SINEG01-RSYS:GET-ONCREST-E-GAIN", energy_max)
|
|
||||||
caput("SINEG01-RSYS:GET-FIT-PHASE-ARRAY", fit_x)
|
|
||||||
caput("SINEG01-RSYS:GET-FIT-ENERGY-ARRAY", fit_y)
|
|
||||||
phase_min, phase_max = min(rf_phase), max(rf_phase)
|
|
||||||
if not (phase_min <= phase_fit_max <= phase_max):
|
|
||||||
raise Exception("Fit maximum outside scan range")
|
|
||||||
phase.write(phase_fit_max)
|
|
||||||
time.sleep(lat)
|
|
||||||
Ampl = V.read()
|
|
||||||
Power = P.read()
|
|
||||||
caput("SINEG01-RSYS:GET-ONCREST-VSUM-AMPLT", Ampl)
|
|
||||||
caput("SINEG01-RSYS:GET-ONCREST-KLY-POWER", Power)
|
|
||||||
finally:
|
finally:
|
||||||
phase.close()
|
phase.close()
|
||||||
V.close()
|
V.close()
|
||||||
P.close()
|
P.close()
|
||||||
st.close()
|
st.close()
|
||||||
|
|
||||||
print ("------------------------------------")
|
p = plot([E, dE],"data", rf_phase, title="Phase scan")[0]
|
||||||
print ("Valid fit")
|
p.addSeries(LinePlotSeries("fit"))
|
||||||
|
p.getSeries(1).setData(fit_x, fit_y)
|
||||||
energy_gain = energy_max
|
|
||||||
phase_offset = 90 - phase_fit_max
|
|
||||||
amplitude_scale = energy_gain / Ampl
|
|
||||||
power_scale = Power / math.pow(Ampl,2)
|
|
||||||
|
|
||||||
caput("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE", phase_offset)
|
|
||||||
caput("SINEG01-RSYS:SET-VSUM-AMPLT-SCALE", amplitude_scale)
|
|
||||||
caput("SINEG01-RSYS:SET-VOLT-POWER-SCALE", power_scale)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user