Closedown
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
@@ -64,7 +64,7 @@
|
||||
<Component id="progressBar" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="panelParameters" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -88,7 +88,7 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Container class="javax.swing.JPanel" name="panelParameters">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
@@ -145,7 +145,6 @@
|
||||
</Group>
|
||||
<Component id="checkSaveImages" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkElog" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkZeroSolenoids" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@@ -193,13 +192,11 @@
|
||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerNumBackgrounds" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="57" max="-2" attributes="0"/>
|
||||
<Component id="checkSaveImages" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<Component id="checkElog" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkZeroSolenoids" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="34" max="32767" attributes="0"/>
|
||||
<Component id="checkSaveImages" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="69" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -311,20 +308,16 @@
|
||||
<Component class="javax.swing.JSpinner" name="spinnerNumImages">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="0" maximum="10" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
<SpinnerModel initial="1" maximum="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkElog">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="ELOG"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkZeroSolenoids">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Zero solenoids"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="centroidPlot">
|
||||
|
||||
@@ -13,10 +13,12 @@ import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.pshell.ui.Plugin;
|
||||
import ch.psi.utils.Convert;
|
||||
import ch.psi.utils.State;
|
||||
import java.awt.Component;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -35,9 +37,9 @@ public class GunSolenoidAlignment extends Panel {
|
||||
if (running) {
|
||||
double x = (Double) record.getValues()[0];
|
||||
double y = (Double) record.getValues()[1];
|
||||
double error_x = (Double) record.getValues()[2];
|
||||
double error_y = (Double) record.getValues()[3];
|
||||
scanSeries.appendData(x, y, error_x, error_y);
|
||||
double stdev_x = (Double) record.getValues()[2];
|
||||
double stdev_y = (Double) record.getValues()[3];
|
||||
scanSeries.appendData(x, y, stdev_x, stdev_y);
|
||||
progressBar.setValue((int) (1000.0 * record.getIndex() / scan.getNumberOfRecords()));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -62,6 +64,15 @@ public class GunSolenoidAlignment extends Panel {
|
||||
if (state != State.Busy) {
|
||||
running = false;
|
||||
}
|
||||
|
||||
for (Component c : panelParameters.getComponents()) {
|
||||
if (!(c instanceof JPanel)){
|
||||
c.setEnabled(state == State.Ready);
|
||||
}
|
||||
}
|
||||
if (state == State.Ready){
|
||||
checkBackgroundActionPerformed(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,13 +90,30 @@ public class GunSolenoidAlignment extends Panel {
|
||||
|
||||
void onEndScan(ScanResult sr, List hx, List hy) {
|
||||
progressBar.setValue(1000);
|
||||
//double[] x =(double[]) Convert.toDouble(sr.getReadable(0));
|
||||
//double[] y =(double[]) Convert.toDouble(sr.getReadable(1));
|
||||
double[] x = (double[]) Convert.toDouble(hx);
|
||||
double[] y = (double[]) Convert.toDouble(hy);
|
||||
LinePlotErrorSeries hull = new LinePlotErrorSeries(scanSeries.getName() + "H", scanSeries.getColor());
|
||||
centroidPlot.addSeries(hull);
|
||||
hull.setData((double[]) Convert.toDouble(x), (double[]) Convert.toDouble(y));
|
||||
hull.setData((double[]) Convert.toDouble(x), (double[]) Convert.toDouble(y));
|
||||
|
||||
//Add ELOG entry
|
||||
if (checkElog.isSelected()) {
|
||||
String file = Paths.get(getController().getSetup().getContextPath(), "CentroidPlot.jpg").toString();
|
||||
try {
|
||||
Thread.sleep(250); //Some time to plot update
|
||||
centroidPlot.saveSnapshot(file , "jpg");
|
||||
evalAsync("elog('Gun solenoid current scan', gsa_log_msg, ['"+ file +"',])").handle((ret, ex) -> {
|
||||
if (ex != null){
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
} else {
|
||||
getLogger().info("Success generating ELOG entry");
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -95,7 +123,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
buttonGroupBack = new javax.swing.ButtonGroup();
|
||||
buttonRun = new javax.swing.JButton();
|
||||
buttonAbort = new javax.swing.JButton();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
panelParameters = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
spinnerI1 = new javax.swing.JSpinner();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
@@ -113,7 +141,6 @@ public class GunSolenoidAlignment extends Panel {
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
spinnerNumImages = new javax.swing.JSpinner();
|
||||
checkElog = new javax.swing.JCheckBox();
|
||||
checkZeroSolenoids = new javax.swing.JCheckBox();
|
||||
centroidPlot = new ch.psi.pshell.plot.LinePlotJFree();
|
||||
buttonClear = new javax.swing.JButton();
|
||||
progressBar = new javax.swing.JProgressBar();
|
||||
@@ -132,7 +159,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
|
||||
panelParameters.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
|
||||
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
jLabel1.setText("I1:");
|
||||
@@ -180,83 +207,81 @@ public class GunSolenoidAlignment extends Panel {
|
||||
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
jLabel6.setText("Number of images:");
|
||||
|
||||
spinnerNumImages.setModel(new javax.swing.SpinnerNumberModel(0, 0, 10, 1));
|
||||
spinnerNumImages.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
|
||||
|
||||
checkElog.setSelected(true);
|
||||
checkElog.setText("ELOG");
|
||||
|
||||
checkZeroSolenoids.setText("Zero solenoids");
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
javax.swing.GroupLayout panelParametersLayout = new javax.swing.GroupLayout(panelParameters);
|
||||
panelParameters.setLayout(panelParametersLayout);
|
||||
panelParametersLayout.setHorizontalGroup(
|
||||
panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerI1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerI2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerSettlingTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelParametersLayout.createSequentialGroup()
|
||||
.addComponent(jLabel5)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spinnerNumBackgrounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerNumImages, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(radioBackSimple)
|
||||
.addComponent(checkBackground))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addGap(36, 36, 36)
|
||||
.addComponent(radioBackMultiple))
|
||||
.addComponent(checkSaveImages)
|
||||
.addComponent(checkElog)
|
||||
.addComponent(checkZeroSolenoids))
|
||||
.addComponent(checkElog))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerI1, spinnerI2, spinnerNumBackgrounds, spinnerNumImages, spinnerSettlingTime, spinnerStep});
|
||||
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerI1, spinnerI2, spinnerNumBackgrounds, spinnerNumImages, spinnerSettlingTime, spinnerStep});
|
||||
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6});
|
||||
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6});
|
||||
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
panelParametersLayout.setVerticalGroup(
|
||||
panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelParametersLayout.createSequentialGroup()
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(spinnerI1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(spinnerI2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel3)
|
||||
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(spinnerSettlingTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4, 4, 4)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(spinnerNumImages, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
@@ -266,16 +291,14 @@ public class GunSolenoidAlignment extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(radioBackMultiple)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel5)
|
||||
.addComponent(spinnerNumBackgrounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(57, 57, 57)
|
||||
.addComponent(checkSaveImages)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGap(50, 50, 50)
|
||||
.addComponent(checkElog)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkZeroSolenoids)
|
||||
.addContainerGap(34, Short.MAX_VALUE))
|
||||
.addComponent(checkSaveImages)
|
||||
.addContainerGap(69, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
centroidPlot.setLegendVisible(true);
|
||||
@@ -296,7 +319,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@@ -329,7 +352,7 @@ public class GunSolenoidAlignment extends Panel {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(buttonClear)
|
||||
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
@@ -363,28 +386,13 @@ public class GunSolenoidAlignment extends Panel {
|
||||
args.put("number_backgrounds", spinnerNumBackgrounds.getValue());
|
||||
args.put("use_background", checkBackground.isSelected());
|
||||
args.put("multiple_background", radioBackMultiple.isSelected());
|
||||
args.put("zero_solenoids", checkZeroSolenoids.isSelected());
|
||||
args.put("do_elog", checkElog.isSelected());
|
||||
args.put("do_elog", Boolean.FALSE); // checkElog.isSelected()
|
||||
|
||||
|
||||
|
||||
((Plugin) this).runAsync("Alignment/Gun_solenoid_alignment", args).thenAccept((Object ret) -> {
|
||||
/*((Plugin) this).runAsync("Alignment/Gun_solenoid_alignment", args).handle((ret, ex) -> {
|
||||
if (ex != null){
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
runAsync("Alignment/Gun_solenoid_alignment", args).thenAccept((Object ret) -> {
|
||||
List l = (List) ret;
|
||||
System.out.print("Sucesss");
|
||||
getLogger().log(Level.INFO, "Succes");
|
||||
getLogger().log(Level.INFO, String.valueOf(l));
|
||||
System.out.print(l);
|
||||
onEndScan((ScanResult) l.get(0), (List) l.get(1), (List) l.get(2));
|
||||
//return null;
|
||||
onEndScan((ScanResult) l.get(0), (List) l.get(1), (List) l.get(2));
|
||||
});
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
running = false;
|
||||
showException(ex);
|
||||
@@ -415,14 +423,13 @@ public class GunSolenoidAlignment extends Panel {
|
||||
private javax.swing.JCheckBox checkBackground;
|
||||
private javax.swing.JCheckBox checkElog;
|
||||
private javax.swing.JCheckBox checkSaveImages;
|
||||
private javax.swing.JCheckBox checkZeroSolenoids;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel panelParameters;
|
||||
private javax.swing.JProgressBar progressBar;
|
||||
private javax.swing.JRadioButton radioBackMultiple;
|
||||
private javax.swing.JRadioButton radioBackSimple;
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
# change the current of the gun soleoid
|
||||
# look at the centroid position (BPM or screen) downstream of the gun.
|
||||
|
||||
|
||||
import datetime
|
||||
from camtool import CamTool
|
||||
#run("camtool")
|
||||
|
||||
if get_context().source == CommandSource.ui:
|
||||
I1 = 95.0
|
||||
@@ -23,7 +21,6 @@ if get_context().source == CommandSource.ui:
|
||||
use_background = True
|
||||
multiple_background = False
|
||||
number_backgrounds = 5
|
||||
zero_solenoids=False
|
||||
do_elog = False
|
||||
centroid_excursion_plot = True
|
||||
else:
|
||||
@@ -53,12 +50,11 @@ mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
|
||||
"SINEG01-MCRX220","SINEG01-MCRY220",
|
||||
"SINEG01-MQUA310",
|
||||
"SINEG01-MQUA320" ]
|
||||
if zero_solenoids:
|
||||
switchOffMagnets(mag)
|
||||
|
||||
switchOffMagnets(mag)
|
||||
|
||||
# add here gun phase setting see wiki page
|
||||
|
||||
|
||||
def before_sample():
|
||||
if multiple_background:
|
||||
camtool.captureBackground(number_backgrounds)
|
||||
@@ -67,8 +63,7 @@ def before_sample():
|
||||
|
||||
def after_sample():
|
||||
if multiple_background:
|
||||
laser_off()
|
||||
|
||||
laser_off()
|
||||
|
||||
r = None
|
||||
if not multiple_background:
|
||||
@@ -91,8 +86,9 @@ else:
|
||||
|
||||
# save the entry in the logbook
|
||||
gsa_log_msg = "Data file: " + get_context().path
|
||||
gsa_log_msg = gsa_log_msg + "\nImages: " + str(number_images)
|
||||
gsa_log_msg = gsa_log_msg + "\nBackground: enabled=" + str(use_background) + " multiple=" + str(multiple_background) + " number=" + str(number_backgrounds)
|
||||
gsa_log_msg = gsa_log_msg + "\n\n" + r.print()
|
||||
|
||||
if do_elog:
|
||||
elog("Gun solenoid current scan", gsa_log_msg , get_plot_snapshots())
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ print "Parameters: ", phi1, phi2, dphi, settling_time, plot_image, number_images
|
||||
|
||||
plot_name = datetime.datetime.fromtimestamp(time.time()).strftime('%H%M%S')
|
||||
|
||||
multiple_background = multiple_background and use_background
|
||||
|
||||
# Switch off magnets
|
||||
mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
|
||||
|
||||
@@ -54,12 +54,10 @@ class CamTool(DeviceBase):
|
||||
self.com_x_samples, self.com_y_samples = [], []
|
||||
class CamToolComX(Readable):
|
||||
def read(self):
|
||||
print self.camtool.take(), "X", self.camtool.com_x_samples, mean(self.camtool.com_x_samples)
|
||||
return mean(self.camtool.com_x_samples)
|
||||
self.com_x_mean = CamToolComX(); self.com_x_mean.camtool = self
|
||||
class CamToolComY(Readable):
|
||||
def read(self):
|
||||
print self.camtool.take(), "Y", self.camtool.com_y_samples, mean(self.camtool.com_y_samples)
|
||||
return mean(self.camtool.com_y_samples)
|
||||
self.com_y_mean = CamToolComY(); self.com_y_mean.camtool = self
|
||||
class CamToolComXVar(Readable):
|
||||
|
||||
Reference in New Issue
Block a user