Add energy, grating and ROI control

This commit is contained in:
2022-03-21 11:38:41 +01:00
parent 54383de1c3
commit ed0b082c7c
3 changed files with 348 additions and 24 deletions

View File

@@ -52,12 +52,17 @@
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Component id="jLabel18" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="spinnerAverage" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerAverage" min="-2" max="-2" attributes="0"/>
<Component id="spinnerEnergy" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="history" alignment="0" pref="461" max="32767" attributes="0"/>
<Component id="history" alignment="0" pref="466" max="32767" attributes="0"/>
<Component id="plot" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
@@ -79,6 +84,8 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerAverage" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerEnergy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel18" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -111,7 +118,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Average:"/>
<Property name="text" type="java.lang.String" value="Energy:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerAverage">
@@ -134,6 +141,21 @@
<Property name="deviceName" type="java.lang.String" value="histo_fwhm"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerEnergy">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="2000.0" maximum="13000.0" minimum="2000.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerEnergyStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel18">
<Properties>
<Property name="text" type="java.lang.String" value="Average:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
@@ -148,17 +170,18 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="851" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Component id="renderer" alignment="0" pref="851" max="32767" attributes="0"/>
</Group>
<Component id="jPanel7" max="32767" attributes="0"/>
<Component id="renderer" pref="856" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="432" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Component id="renderer" alignment="0" pref="432" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="renderer" pref="359" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jPanel7" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -166,6 +189,62 @@
<SubComponents>
<Component class="ch.psi.pshell.imaging.Renderer" name="renderer">
</Component>
<Container class="javax.swing.JPanel" name="jPanel7">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel16" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="registerPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="registerPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel16" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="registerPanel2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel17" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="registerPanel3" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.RegisterPanel" name="registerPanel3">
<Properties>
<Property name="deviceName" type="java.lang.String" value="psss_roi_max"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel17">
<Properties>
<Property name="text" type="java.lang.String" value="ROI bottom:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.RegisterPanel" name="registerPanel2">
<Properties>
<Property name="deviceName" type="java.lang.String" value="psss_roi_min"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel16">
<Properties>
<Property name="text" type="java.lang.String" value="ROI top:"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
@@ -190,7 +269,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" max="32767" attributes="0"/>
<Component id="plotScan" pref="432" max="32767" attributes="0"/>
<Component id="plotScan" pref="450" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@@ -716,6 +795,81 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Control">
<Property name="tabTitle" type="java.lang.String" value="Control"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="66" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel15" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="discretePositionerSelector1" linkSize="12" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="registerPanel1" linkSize="12" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="553" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="52" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="registerPanel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="discretePositionerSelector1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="306" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.RegisterPanel" name="registerPanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="psss_energy_set"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DiscretePositionerSelector" name="discretePositionerSelector1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="psss_grating"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel14">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Energy:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel15">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Grating:"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>

View File

@@ -1,5 +1,9 @@
import ch.psi.pshell.bs.PipelineServer;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.device.Register;
import ch.psi.pshell.epics.ChannelDouble;
import ch.psi.pshell.imaging.RendererMode;
import ch.psi.pshell.plot.Plot;
@@ -27,6 +31,7 @@ public class PSSS extends Panel {
PipelineServer pipelineServer;
volatile boolean updatingPlot;
volatile boolean updatingImage;
volatile boolean updatingDevices;
final Color PLOT_BACKGROUND =Color.WHITE;
final Font TICK_LABEL_FONT = new Font("Arial", 0, 14);
@@ -74,6 +79,19 @@ public class PSSS extends Panel {
getLogger().warning("Error reading energy_machine");
}
this.getDevice("psss_energy").addListener(new DeviceAdapter() {
@Override
public void onCacheChanged(Device device, Object value, Object former, long timestamp, boolean valueChange) {
updatingDevices=true;
try{
spinnerEnergy.setValue((Double) value);
} catch (Exception ex){
getLogger().log(Level.WARNING, null, ex);
} finally{
updatingDevices=false;
}
}
});
} catch (Exception ex) {
getLogger().log(Level.WARNING, null, ex);
@@ -169,8 +187,15 @@ public class PSSS extends Panel {
spinnerAverage = new javax.swing.JSpinner();
histogramGeneratorPanelCenter = new ch.psi.pshell.swing.HistogramGeneratorPanel();
histogramGeneratorFwhm = new ch.psi.pshell.swing.HistogramGeneratorPanel();
spinnerEnergy = new javax.swing.JSpinner();
jLabel18 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
renderer = new ch.psi.pshell.imaging.Renderer();
jPanel7 = new javax.swing.JPanel();
registerPanel3 = new ch.psi.pshell.swing.RegisterPanel();
jLabel17 = new javax.swing.JLabel();
registerPanel2 = new ch.psi.pshell.swing.RegisterPanel();
jLabel16 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
btAbort = new javax.swing.JButton();
@@ -210,6 +235,11 @@ public class PSSS extends Panel {
spShotsCr = new javax.swing.JSpinner();
btStartCr = new javax.swing.JButton();
plotScan = new ch.psi.pshell.plot.LinePlotJFree();
jPanel6 = new javax.swing.JPanel();
registerPanel1 = new ch.psi.pshell.swing.RegisterPanel();
discretePositionerSelector1 = new ch.psi.pshell.swing.DiscretePositionerSelector();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
tab.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
@@ -223,7 +253,7 @@ public class PSSS extends Panel {
history.setDurationMillis(1800000);
history.setFocusable(false);
jLabel1.setText("Average:");
jLabel1.setText("Energy:");
spinnerAverage.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
spinnerAverage.addChangeListener(new javax.swing.event.ChangeListener() {
@@ -236,6 +266,15 @@ public class PSSS extends Panel {
histogramGeneratorFwhm.setDeviceName("histo_fwhm");
spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(2000.0d, 2000.0d, 13000.0d, 1.0d));
spinnerEnergy.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerEnergyStateChanged(evt);
}
});
jLabel18.setText("Average:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -243,11 +282,16 @@ public class PSSS extends Panel {
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGap(21, 21, 21)
.addComponent(jLabel18)
.addGap(3, 3, 3)
.addComponent(spinnerAverage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerAverage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(history, javax.swing.GroupLayout.DEFAULT_SIZE, 461, Short.MAX_VALUE)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(history, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -263,7 +307,9 @@ public class PSSS extends Panel {
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(spinnerAverage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(spinnerAverage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel18))
.addGap(6, 6, 6)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(histogramGeneratorPanelCenter, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
@@ -276,19 +322,56 @@ public class PSSS extends Panel {
tab.addTab("Spectrum", jPanel1);
registerPanel3.setDeviceName("psss_roi_max");
jLabel17.setText("ROI bottom:");
registerPanel2.setDeviceName("psss_roi_min");
jLabel16.setText("ROI top:");
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(registerPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(registerPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel16)
.addComponent(registerPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel17)
.addComponent(registerPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 851, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 851, Short.MAX_VALUE))
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 856, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 432, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
tab.addTab("Camera", jPanel4);
@@ -644,11 +727,58 @@ public class PSSS extends Panel {
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(plotScan, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE)
.addComponent(plotScan, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
);
tab.addTab("Alignment", jPanel3);
registerPanel1.setDeviceName("psss_energy_set");
discretePositionerSelector1.setDeviceName("psss_grating");
jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel14.setText("Energy:");
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel15.setText("Grating:");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(66, 66, 66)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(discretePositionerSelector1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(registerPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(553, Short.MAX_VALUE))
);
jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {discretePositionerSelector1, registerPanel1});
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(52, 52, 52)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(registerPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(discretePositionerSelector1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jLabel15)))
.addContainerGap(306, Short.MAX_VALUE))
);
tab.addTab("Control", jPanel6);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -721,12 +851,26 @@ public class PSSS extends Panel {
}
}//GEN-LAST:event_spinnerAverageStateChanged
private void spinnerEnergyStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerEnergyStateChanged
try {
if (!updatingDevices){
Register dev = (Register) getDevice("psss_energy_set");
dev.writeAsync((Double)spinnerEnergy.getValue());
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_spinnerEnergyStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btAbort;
private javax.swing.JButton btStartCam;
private javax.swing.JButton btStartCr;
private javax.swing.JButton btStartEn;
private javax.swing.ButtonGroup buttonGroup1;
private ch.psi.pshell.swing.DiscretePositionerSelector discretePositionerSelector1;
private ch.psi.pshell.swing.HistogramGeneratorPanel histogramGeneratorFwhm;
private ch.psi.pshell.swing.HistogramGeneratorPanel histogramGeneratorPanelCenter;
private ch.psi.pshell.plot.TimePlotJFree history;
@@ -735,6 +879,11 @@ public class PSSS extends Panel {
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
@@ -748,6 +897,8 @@ public class PSSS extends Panel {
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel panelCameraScan;
private javax.swing.JPanel panelCrystalScan;
private javax.swing.JPanel panelEnergyScan;
@@ -757,6 +908,9 @@ public class PSSS extends Panel {
private javax.swing.JRadioButton radioCameraScan;
private javax.swing.JRadioButton radioCrystalScan;
private javax.swing.JRadioButton radioEnergyScan;
private ch.psi.pshell.swing.RegisterPanel registerPanel1;
private ch.psi.pshell.swing.RegisterPanel registerPanel2;
private ch.psi.pshell.swing.RegisterPanel registerPanel3;
private ch.psi.pshell.imaging.Renderer renderer;
private javax.swing.JSpinner spFromCam;
private javax.swing.JSpinner spFromCr;
@@ -771,6 +925,7 @@ public class PSSS extends Panel {
private javax.swing.JSpinner spToCr;
private javax.swing.JSpinner spToEn;
private javax.swing.JSpinner spinnerAverage;
private javax.swing.JSpinner spinnerEnergy;
private javax.swing.JTabbedPane tab;
// End of variables declaration//GEN-END:variables
}

View File

@@ -163,8 +163,23 @@ class PSSSEnergySet(RegisterBase):
add_device(PSSSEnergySet("psss_energy_set"), True)
psss_energy_set.alias = "energy"
psss_energy_set.polling=1000
class PSSSGratingSet(DiscretePositioner):
def doWrite(self, val):
if not is_dry_run():
super(PSSSGratingSet, self).doWrite(val)
#caput(psss_grating.getSetpoint().getChannelName(), val)
#self.setCache(val)
exec_cpython("/ioc/modules/qt/PSSS_motion.py", args = ["-m3", "SARFE10-PSSS059"])
# python / ioc / modules / qt / PSSS_motion.py - m1 SARFE10 - PSSS059
time.sleep(1)
add_device(PSSSGratingSet("psss_grating", "SARFE10-PSSS055:GRATING_SP"), True)
psss_grating.alias = "grating"
psss_grating.monitored=True
###################################################################################################
# Tools
###################################################################################################