This commit is contained in:
gac-x09lb
2023-05-30 11:43:51 +02:00
parent daad46a719
commit 0bda404624
4 changed files with 1077 additions and 1 deletions

View File

@@ -1,8 +1,11 @@
#Wed Feb 08 22:42:07 CET 2023
#Tue May 30 11:43:35 CEST 2023
xscanMoveTimeout=600
autoSaveScanData=true
simulation=false
logDaysToLive=7
xscanCrlogicChannel=null
dataScanSaveOutput=false
xscanCrlogicSimulated=false
userAuthenticator=
logLevelConsole=Off
filePermissionsConfig=Public
@@ -14,6 +17,7 @@ parallelInitialization=false
fdaSerialization=false
dataTransferPath=
saveConsoleSessionFiles=false
xscanAppendSuffix=true
versionTrackingManual=false
dataTransferMode=Off
hostName=
@@ -40,11 +44,15 @@ terminalEnabled=false
notificationLevel=Off
filePermissionsScripts=Public
terminalPort=3579
xscanCrlogicPrefix=null
dataTransferUser=
filePermissionsData=Default
xscanCrlogicAbortable=true
xscanContinuousUpdate=false
versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/x09lb.git
dataProvider=h5
xscanCrlogicIoc=null
dataScanLazyTableCreation=false
saveCommandStatistics=false

465
plugins/RegineYZ.form Executable file
View File

@@ -0,0 +1,465 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
<Component class="javax.swing.ButtonGroup" name="buttonGroup2">
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="panelParameters" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
<Component id="jPanel4" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" 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="0" attributes="0">
<Component id="panelParameters" max="32767" attributes="0"/>
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="jPanel4" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<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">
<TitledBorder title="Parameters"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerCenterZ" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel4" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerCenterY" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepsZ" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepsY" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel7" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepSizeZ" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepSizeY" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel9" linkSize="8" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" linkSize="8" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" linkSize="8" min="-2" max="-2" attributes="0"/>
<Component id="jLabel12" linkSize="8" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" linkSize="8" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSettlingTime" max="32767" attributes="0"/>
<Component id="spinnerNoise" max="32767" attributes="0"/>
<Component id="textExposures" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="checkZigZag" min="-2" max="-2" attributes="0"/>
<Component id="checkCompression" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerCenterZ" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerCenterY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepsZ" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepsY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepSizeZ" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepSizeY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerNoise" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSettlingTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textExposures" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="checkZigZag" min="-2" max="-2" attributes="0"/>
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="checkCompression" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="98" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Center Z (um):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerCenterZ">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="100.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerCenterY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="100.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Center Y (um):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Steps Z:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepsZ">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10" maximum="100000" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepsY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10" maximum="100000" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Steps Y:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="StepSize Z (um):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepSizeZ">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10.0" maximum="100000.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepSizeY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10.0" maximum="100000.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Step Size Y (um):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Noise (% of step):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerNoise">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.05" maximum="1.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSettlingTime">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.1" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Settling Time (s):"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Exposures(s):"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textExposures">
</Component>
<Component class="javax.swing.JCheckBox" name="checkZigZag">
<Properties>
<Property name="selected" type="boolean" value="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="ZigZag:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel13">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Compression:"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkCompression">
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<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">
<TitledBorder title="Scan Control"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonStart" max="32767" attributes="0"/>
<Component id="buttonAbort" max="32767" attributes="0"/>
<Component id="buttonAddToQueue" pref="206" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAddToQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAddToQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Add To Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddToQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<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">
<TitledBorder title="Motor Positions"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="motorPanelY" pref="186" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="motorPanelZ" max="32767" attributes="0"/>
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
</Group>
<Component id="plot" alignment="1" pref="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="motorPanelZ" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<Component id="motorPanelY" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="plot" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Sample Z:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Sample Y:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.MotorReadoutPanel" name="motorPanelZ">
<Properties>
<Property name="deviceName" type="java.lang.String" value="sample_x"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.MotorReadoutPanel" name="motorPanelY">
<Properties>
<Property name="deviceName" type="java.lang.String" value="sample_y"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

510
plugins/RegineYZ.java Executable file
View File

@@ -0,0 +1,510 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.Motor;
import ch.psi.pshell.epics.AreaDetector;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.pshell.ui.QueueProcessor;
import ch.psi.utils.Arr;
import ch.psi.utils.Convert;
import ch.psi.utils.State;
import ch.psi.utils.Str;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.swing.SpinnerNumberModel;
/**
*
*/
public class RegineYZ extends ScriptProcessor {
final String SAMPLE_Z = "sample_z";
final String SAMPLE_Y = "sample_y";
final String DETECTOR = "ccd";
final String SCRIPT = "templates/RegineZY";
public RegineYZ() {
initComponents();
motorPanelZ.setDeviceName(SAMPLE_Z);
motorPanelY.setDeviceName(SAMPLE_Y);
setPersistedComponents(new Component[] {
spinnerCenterZ,
spinnerCenterY,
spinnerNoise,
spinnerSettlingTime,
spinnerStepSizeZ,
spinnerStepSizeY,
spinnerStepsZ,
spinnerStepsY,
textExposures,
checkCompression,
checkZigZag
});
}
Motor getSampleZ(){
return (Motor) getDevice(SAMPLE_Z);
}
Motor getSampleY(){
return (Motor) getDevice(SAMPLE_Y);
}
AreaDetector getDetecor(){
return (AreaDetector) getDevice(DETECTOR);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
((SpinnerNumberModel)spinnerCenterY.getModel()).setMinimum(getSampleY().getMinValue());
((SpinnerNumberModel)spinnerCenterY.getModel()).setMaximum(getSampleY().getMaxValue());
((SpinnerNumberModel)spinnerCenterZ.getModel()).setMinimum(getSampleZ().getMinValue());
((SpinnerNumberModel)spinnerCenterZ.getModel()).setMaximum(getSampleZ().getMaxValue());
setGlobalVar("POSITION_PLOT_YZ", plot);
}
@Override
public void onStateChange(State state, State former) {
setEnabled(isEnabled());
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
@Override
public void setEnabled(boolean value) {
super.setEnabled(value);
boolean enableControls = (value && (getState() == State.Ready));
buttonAbort.setEnabled(value && getState().isInitialized());
buttonStart.setEnabled(enableControls);
for (Component c : panelParameters.getComponents()) {
c.setEnabled(enableControls);
}
motorPanelZ.setReadOnly(!enableControls);
motorPanelY.setReadOnly(!enableControls);
}
@Override
public String getScript() {
return SCRIPT;
}
@Override
public Map<String, Object> getArgs(){
HashMap<String, Object> args = new HashMap<>();
args.put("DRY_RUN", false);
args.put("CENTER_Z", (Double) spinnerCenterZ.getValue());
args.put("CENTER_Y", (Double) spinnerCenterY.getValue());
args.put("STEPS_Z", (Integer) spinnerStepsZ.getValue());
args.put("STEPS_Y", (Integer) spinnerStepsY.getValue());
args.put("STEP_SIZE_Z", (Double) spinnerStepSizeZ.getValue());
args.put("STEP_SIZE_Y", (Double) spinnerStepSizeY.getValue());
args.put("NOISE", (Double) spinnerNoise.getValue());
args.put("SETTLING_TIME", (Double) spinnerSettlingTime.getValue());
args.put("ZIGZAG", checkZigZag.isSelected());
args.put("COMPRESSION", checkCompression.isSelected());
if (textExposures.getText().isBlank()){
args.put("EXPOSURES", null);
} else {
String[] tokens = Str.split(textExposures.getText().trim(), new String[]{"|", ";", ",", " "});
tokens = Arr.removeEquals(tokens, "");
args.put("EXPOSURES", Arrays.stream(tokens)
.mapToDouble(Double::parseDouble)
.toArray());
}
return args;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
panelParameters = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
spinnerCenterZ = new javax.swing.JSpinner();
spinnerCenterY = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
spinnerStepsZ = new javax.swing.JSpinner();
spinnerStepsY = new javax.swing.JSpinner();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
spinnerStepSizeZ = new javax.swing.JSpinner();
spinnerStepSizeY = new javax.swing.JSpinner();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
spinnerNoise = new javax.swing.JSpinner();
spinnerSettlingTime = new javax.swing.JSpinner();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
textExposures = new javax.swing.JTextField();
checkZigZag = new javax.swing.JCheckBox();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
checkCompression = new javax.swing.JCheckBox();
jPanel3 = new javax.swing.JPanel();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
buttonAddToQueue = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
motorPanelZ = new ch.psi.pshell.swing.MotorReadoutPanel();
motorPanelY = new ch.psi.pshell.swing.MotorReadoutPanel();
plot = new ch.psi.pshell.plot.LinePlotJFree();
panelParameters.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Center Z (um):");
spinnerCenterZ.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 100.0d, 1.0d));
spinnerCenterY.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 100.0d, 1.0d));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Center Y (um):");
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Steps Z:");
spinnerStepsZ.setModel(new javax.swing.SpinnerNumberModel(10, 0, 100000, 1));
spinnerStepsY.setModel(new javax.swing.SpinnerNumberModel(10, 0, 100000, 1));
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel6.setText("Steps Y:");
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel7.setText("StepSize Z (um):");
spinnerStepSizeZ.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 100000.0d, 1.0d));
spinnerStepSizeY.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 100000.0d, 1.0d));
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Step Size Y (um):");
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel9.setText("Noise (% of step):");
spinnerNoise.setModel(new javax.swing.SpinnerNumberModel(0.05d, 0.0d, 1.0d, 1.0d));
spinnerSettlingTime.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 10.0d, 1.0d));
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel10.setText("Settling Time (s):");
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel11.setText("Exposures(s):");
checkZigZag.setSelected(true);
jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel12.setText("ZigZag:");
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel13.setText("Compression:");
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(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerCenterZ))
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerCenterY))
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepsZ))
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepsY))
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepSizeZ))
.addGroup(panelParametersLayout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepSizeY))
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel9)
.addComponent(jLabel10)
.addComponent(jLabel11)
.addComponent(jLabel12)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerSettlingTime)
.addComponent(spinnerNoise)
.addComponent(textExposures)
.addGroup(panelParametersLayout.createSequentialGroup()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkZigZag)
.addComponent(checkCompression))
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap())
);
panelParametersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel10, jLabel11, jLabel12, jLabel13, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9});
panelParametersLayout.setVerticalGroup(
panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParametersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(spinnerCenterZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(spinnerCenterY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(spinnerStepsZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(spinnerStepsY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(spinnerStepSizeZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(spinnerStepSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(spinnerNoise, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(spinnerSettlingTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(textExposures, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(checkZigZag)
.addComponent(jLabel12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParametersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(checkCompression)
.addComponent(jLabel13))
.addContainerGap(98, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
buttonStart.setText("Start");
buttonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
buttonAddToQueue.setText("Add To Queue");
buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAddToQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAddToQueue, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonStart)
.addGap(18, 18, 18)
.addComponent(buttonAbort)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAddToQueue)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Motor Positions"));
jLabel2.setText("Sample Z:");
jLabel3.setText("Sample Y:");
motorPanelZ.setDeviceName("sample_x");
motorPanelY.setDeviceName("sample_y");
plot.setTitle("");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(motorPanelY, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(motorPanelZ, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(1, 1, 1))
.addComponent(plot, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(motorPanelZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(motorPanelY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(panelParameters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelParameters, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
execute();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try {
abort();
} catch (InterruptedException ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonAddToQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddToQueueActionPerformed
try {
List<QueueProcessor> queues = getView().getQueues();
QueueProcessor tq = (queues.size() == 0) ? getView().openProcessor(QueueProcessor.class, null) : queues.get(0);
getView().getDocumentsTab().setSelectedComponent(tq);
tq.addNewFile(getScript(), getArgs());
} catch (Exception ex) {
showException( ex);
}
}//GEN-LAST:event_buttonAddToQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonAddToQueue;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkCompression;
private javax.swing.JCheckBox checkZigZag;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
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.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private ch.psi.pshell.swing.MotorReadoutPanel motorPanelY;
private ch.psi.pshell.swing.MotorReadoutPanel motorPanelZ;
private javax.swing.JPanel panelParameters;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerCenterY;
private javax.swing.JSpinner spinnerCenterZ;
private javax.swing.JSpinner spinnerNoise;
private javax.swing.JSpinner spinnerSettlingTime;
private javax.swing.JSpinner spinnerStepSizeY;
private javax.swing.JSpinner spinnerStepSizeZ;
private javax.swing.JSpinner spinnerStepsY;
private javax.swing.JSpinner spinnerStepsZ;
private javax.swing.JTextField textExposures;
// End of variables declaration//GEN-END:variables
}

93
script/templates/RegineZY.py Executable file
View File

@@ -0,0 +1,93 @@
"""
Arguments:
DRY_RUN (BOOL)
CENTER_Z, CENTER_Y (FLOAT)
STEPS_Z, STEPS_Y (INT)
STEP_SIZE_Z, STEP_SIZE_Y (FLOAT)
EXPOSURES (list or None)
SETTLING_TIME (double)
ZIGZAG (BOOLEAN)
COMPRESSION (BOOLEAN)
NOISE (FLOAT)
"""
import random
position_plot = None if "POSITION_PLOT_YZ" not in globals() else POSITION_PLOT_YZ
#Debugging
if (get_exec_pars().args is None) and (get_exec_pars().script=="Regine"):
DRY_RUN = False
CENTER_Z = 11458.0
CENTER_Y = 10398.0
EXPOSURES = [1] #unit:s
STEPS_Z = 30
STEPS_Y= 0
STEP_SIZE_Z = 2.5
STEP_SIZE_Y = 5
NOISE=0.0
SETTLING_TIME = 1.0
ZIGZAG = True
COMPRESSION = False
position_plot=None
if not position_plot: position_plot=plot(None, title="Motor Positions")[0]
#Constants
SENSORS = [current, ccd.dataMatrix, interf_0, interf_1]
POSITIONERS = [dummy_z, dummy_y] if DRY_RUN else [sample_z, sample_y]
ENABLED_PLOTS = [ccd.dataMatrix]
CUSTOM_PLOT_TYPES = {ccd.dataMatrix:"ch.psi.pshell.plot.MatrixPlotRenderer"}
RANGE_Z=[CENTER_Z - STEP_SIZE_Z*STEPS_Z, CENTER_Z + STEP_SIZE_Z*STEPS_Z]
RANGE_Y=[CENTER_Y - STEP_SIZE_Y*STEPS_Y, CENTER_Y + STEP_SIZE_Y*STEPS_Y]
print(RANGE_Z[0])
position_plot.clear()
position_plot.addSeries(LinePlotSeries("positions"))
position_plot.getAxis(AxisId.X).label = POSITIONERS[0].name
position_plot.getAxis(AxisId.X).setRange(RANGE_Z[0]-STEP_SIZE_Z, RANGE_Z[1]+STEP_SIZE_Z)
position_plot.getAxis(AxisId.Y).label = POSITIONERS[1].name
position_plot.getAxis(AxisId.Y).setRange(RANGE_Y[0]-STEP_SIZE_Y, RANGE_Y[1]+STEP_SIZE_Y)
def after_read(record, scan):
after_readout(record, scan)
position_plot.getSeries(0).appendData(record[POSITIONERS[0]], record[POSITIONERS[1]])
if EXPOSURES:
POSITIONERS = POSITIONERS + [exposure_index()]
SENSORS = SENSORS + [exposure()]
RANGE_E=[0, len(EXPOSURES)-1]
def gen():
z_index = y_index = e_index = 0
for z_step in range(-STEPS_Z, STEPS_Z+1):
range_y= range(STEPS_Y, -STEPS_Y-1, -1) if (ZIGZAG and(z_index%2 ==1)) else range(-STEPS_Y, STEPS_Y+1)
for y_step in range_y:
zpos = CENTER_Z + z_step*STEP_SIZE_Z + (random.random()-0.5)*NOISE*2*STEP_SIZE_Z
ypos = CENTER_Y + y_step*STEP_SIZE_Y + (random.random()-0.5)*NOISE*2*STEP_SIZE_Y
if EXPOSURES:
range_e= range(len(EXPOSURES)-1,-1, -1) if (ZIGZAG and(y_index%2 ==1)) else range(len(EXPOSURES))
for e in range_e:
yield([zpos,ypos,e])
else:
yield([zpos,ypos])
y_index=y_index+1
z_index=z_index+1
try:
r = vscan(POSITIONERS, SENSORS , gen(), False,\
SETTLING_TIME, relative=False, zigzag = ZIGZAG, initial_move=False, \
before_read=before_readout, after_read = after_read, \
manual_range=RANGE_Z, manual_range_y=RANGE_Y, \
compression = COMPRESSION, enabled_plots=ENABLED_PLOTS, \
keep=False, check_positions=False, plot_types=CUSTOM_PLOT_TYPES)
set_return(r)
finally:
after_scan()