Closedown

This commit is contained in:
gobbo_a
2017-04-13 15:18:53 +02:00
parent 31f29baa65
commit 8ddf2e0f9d
4 changed files with 37 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
#Thu Apr 13 10:44:59 CEST 2017
#Thu Apr 13 11:10:35 CEST 2017
colormap=Flame
colormapAutomatic=false
colormapMax=3000.0
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-1057.4895329398094
spatialCalOffsetY=-1420.5549062527236
spatialCalScaleX=-8.510638153514359
spatialCalScaleY=-8.235817137431614
spatialCalOffsetX=-267.40150232236596
spatialCalOffsetY=-378.4941094279979
spatialCalScaleX=-8.69928006050282
spatialCalScaleY=-8.747949537888072
spatialCalUnits=mm
transpose=false

View File

@@ -13,6 +13,7 @@ import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
@@ -22,15 +23,18 @@ import javax.swing.DefaultComboBoxModel;
*/
public class WireScan extends Panel {
final String[] seriesNames = new String[]{"bpm1_x", "bpm1_y", "bpm1_q", "bpm2_x", "bpm2_y", "bpm2_q"};
final int[] seriesYAxis = new int[]{1, 1, 2, 1, 1, 2};
LinePlotSeries[] series = new LinePlotSeries[seriesNames.length];
public WireScan() {
initComponents();
for (int i=0; i< seriesNames.length; i++){
plot.addSeries(new LinePlotSeries(seriesNames[i]));
series[i] = new LinePlotSeries(seriesNames[i], null, seriesYAxis[i]);
plot.addSeries(series[i]);
}
plot.getAxis(Plot.AxisId.X).setLabel("");
plot.getAxis(Plot.AxisId.Y).setLabel("Position");
plot.getAxis(Plot.AxisId.X).setLabel("Position");
plot.getAxis(Plot.AxisId.Y).setLabel("mm");
plot.getAxis(Plot.AxisId.Y2).setLabel("pc");
plot.setLegendVisible(true);
}
@@ -102,20 +106,23 @@ public class WireScan extends Panel {
@Override
public void onNewRecord(Scan scan, ScanRecord record) {
System.out.println( (Double) record.getValues()[1]);
if ("WireScan".equals(getContext().getExecutionPars().getName())) {
double position = (Double) record.getValues()[1];
for (int i=0; i< series.length; i++){
plot.addSeries(new LinePlotSeries(seriesNames[i]));
series[i].appendData(position,(Double) record.getValues()[4 + i]);
try{
if ("WireScan".equals(getContext().getExecutionPars().getName())) {
double position = (Double) record.getValues()[1];
for (int i=0; i< series.length; i++){
if (record.getValues()[4 + i] != null){
series[i].appendData(position,(Double) record.getValues()[4 + i]);
}
}
}
} catch(Exception ex){
ex.printStackTrace();
}
}
@Override
public void onScanEnded(Scan scan, Exception ex) {
getContext().removeScanListener(this);
getContext().removeScanListener(this);
}
};
@@ -376,7 +383,9 @@ public class WireScan extends Panel {
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
} else {
showException((Exception) ex);
} else {
SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
}
return ret;
});

View File

@@ -7,8 +7,8 @@ if get_exec_pars().source == CommandSource.ui:
step = 2.0
nb = 5
lat = 0.5
disp = caget("SINBD01-DSCR010:DISPERSION-SIM")
energy0 = caget("SINBD01-DSCR010:ENERGY-SIM")
disp = caget("SINBD01-DSCR010:DISPERSION")
energy0 = caget("SINBD01-DSCR010:ENERGY")
else:
start = args[0]
stop = args[1]
@@ -18,11 +18,13 @@ else:
disp = args[5]
energy0 = args[6]
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
#phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
phase.config.minValue =-180.0
phase.config.maxValue = 180.0
phase.config.resolution = 0.25
phase.config.precision = 3
phase.config.resolution = 1.0
phase.config.save()
phase.initialize()
#kill_camtool()
@@ -30,7 +32,7 @@ check_camtool()
camtool.start("SINBD01-DSCR010")
wait_camtool_message()
x = camtool.stream.getChild("gr_x_fit_mean")
x = camtool.stream.getChild("gr_x_fit_mean")
dx = camtool.stream.getChild("gr_x_fit_standard_deviation")
try:
@@ -40,7 +42,7 @@ try:
r = lscan(phase, [xb, dxb], start, stop, step , latency=lat)
rf_phase = r.getPositions(0)
E = [energy0 * (1 + val.mean / 1e6 / disp) for val in r.getReadable(0)]
dE = [energy0 * (val.mean / 1e6 / disp) for val in r.getReadable(1)]
dE = [energy0 * ( val.mean / 1e6 / disp) for val in r.getReadable(1)]
finally:
phase.close()
camtool.stop() # stops camtool but does not close it camtool is a global object

View File

@@ -13,11 +13,11 @@ else:
nb = int(args[3])
lat = args[4]
#phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:GET-VSUM-PHASE")
phase = ControlledVariable("Phase", "SINEG01-RSYS:SET-VSUM-PHASE", "SINEG01-RSYS:SET-VSUM-PHASE")
phase.config.minValue =-180.0
phase.config.maxValue = 180.0
phase.config.precision = 3
phase.config.precision = 3
phase.config.resolution = 1.0
phase.config.save()
phase.initialize()