Initial Commit

This commit is contained in:
gac-alvra
2021-04-28 10:08:19 +02:00
commit 7a44110577
99 changed files with 12612 additions and 0 deletions

45
config/config.properties Executable file
View File

@@ -0,0 +1,45 @@
#Wed Apr 28 10:05:51 CEST 2021
autoSaveScanData=true
simulation=false
commandExecutionEvents=false
logDaysToLive=50
dataScanSaveOutput=false
userAuthenticator=
logLevelConsole=Off
scanStreamerPort=-1
dataScanSaveScript=false
dataScanSaveSetpoints=false
notifiedTasks=null
parallelInitialization=false
dataTransferPath=null
saveConsoleSessionFiles=false
versionTrackingManual=true
dataTransferMode=null
hostName=null
userManagement=false
instanceName=AL
disableEmbeddedAttributes=false
dataServerPort=-1
hideServerMessages=false
serverPort=8080
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
serverEnabled=false
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
logLevel=Info
dataScanFlushRecords=false
logPath={logs}/{date}_{time}
dataLayout=default
disableDataFileLogs=false
sessionHandling=null
terminalEnabled=false
notificationLevel=Off
terminalPort=3579
dataTransferUser=null
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
versionTrackingRemote=git@git.psi.ch\:pshell_config/saresa.git
dataProvider=h5
saveCommandStatistics=false

4
config/devices.properties Executable file
View File

@@ -0,0 +1,4 @@
dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf|||
cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889|||
motor_x1=ch.psi.pshell.epics.Motor|SARES11-XSAM125:MOTOR_X1|||true
$dummy_motor=ch.psi.pshell.device.DummyMotor||||true

11
config/jcae.properties Executable file
View File

@@ -0,0 +1,11 @@
#Fri Mar 02 11:02:47 CET 2018
ch.psi.jcae.ContextFactory.addressList=
ch.psi.jcae.ContextFactory.serverPort=
ch.psi.jcae.ContextFactory.maxArrayBytes=50000000
ch.psi.jcae.ChannelFactory.retries=1
ch.psi.jcae.ChannelFactory.timeout=1250
ch.psi.jcae.impl.DefaultChannelService.retries=4
ch.psi.jcae.impl.DefaultChannelService.timeout=1000
ch.psi.jcae.ContextFactory.autoAddressList=true
ch.psi.jcae.ContextFactory.useShellVariables=true
ch.psi.jcae.ContextFactory.addLocalBroadcastInterfaces=false

9
config/mail.properties Executable file
View File

@@ -0,0 +1,9 @@
#Tue Nov 28 11:09:28 CET 2017
auth=None
from=
host=
port=0
pwd=
smsSuffix=@sms.switch.ch
to=
usr=

23
config/setup.properties Executable file
View File

@@ -0,0 +1,23 @@
#Fri Apr 09 17:22:14 CEST 2021
sessionsPath={outp}/sessions
scriptPath={home}/script
pluginsPath={home}/plugins
configFileDevices={config}/devices.properties
consoleSessionsPath={sessions}/console
libraryPath={script}; {script}/Lib
configFilePlugins={config}/plugins.properties
contextPath={outp}/context
extensionsPath={home}/extensions
configPath={home}/config
configFileSessions={config}/sessions.properties
userSessionsPath={sessions}/user
dataPath={outp}/data
devicesPath={home}/devices
configFileVariables={config}/variables.properties
configFileSettings={config}/settings.properties
logPath={outp}/log
wwwPath={home}/www
imagesPath={outp}/images
configFile={config}/config.properties
scriptType=py
configFileTasks={config}/tasks.properties

View File

@@ -0,0 +1,2 @@
#Tue Mar 23 17:21:24 CET 2021
FileSequentialNumber=594

View File

@@ -0,0 +1,25 @@
#Tue Apr 30 18:06:44 CEST 2019
colormap=Grayscale
colormapAutomatic=false
colormapLogarithmic=false
colormapMax=NaN
colormapMin=NaN
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

View File

@@ -0,0 +1,25 @@
#Thu Jun 27 11:30:54 CEST 2019
colormap=Grayscale
colormapAutomatic=false
colormapLogarithmic=false
colormapMax=NaN
colormapMin=NaN
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

View File

@@ -0,0 +1,30 @@
#Mon Apr 26 15:10:08 CEST 2021
spatialCalOffsetY=0.0
spatialCalOffsetX=0.0
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=1.0
spatialCalScaleY=1.0
serverURL=null
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
imageWidth=1280
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
imageHeight=1024
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=false
roiY=0
roiX=0
transpose=false
regionStartX=0
regionStartY=0

View File

@@ -0,0 +1,25 @@
#Fri Nov 22 16:19:16 CET 2019
spatialCalOffsetY=-283.44850009947083
spatialCalOffsetX=-508.6113107388105
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=-11.968979744848074
spatialCalScaleY=-10.638298119304675
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=false
roiY=0
roiX=0
transpose=false

View File

@@ -0,0 +1,25 @@
#Thu Mar 05 15:00:49 CET 2020
spatialCalOffsetY=0.0
spatialCalOffsetX=0.0
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=1.0
spatialCalScaleY=1.0
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=false
roiY=0
roiX=0
transpose=false

10
devices/Time.properties Normal file
View File

@@ -0,0 +1,10 @@
#Mon Feb 03 15:08:35 CET 2020
minValue=NaN
unit=null
offset=0.0
maxValue=NaN
precision=-1
rotation=false
sign_bit=0
scale=1.0
resolution=NaN

25
devices/cam_server.properties Executable file
View File

@@ -0,0 +1,25 @@
#Mon Feb 18 16:24:13 CET 2019
colormap=Grayscale
colormapAutomatic=false
colormapLogarithmic=false
colormapMax=NaN
colormapMin=NaN
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

13
devices/dispatcher.properties Executable file
View File

@@ -0,0 +1,13 @@
#Mon Nov 25 14:52:47 CET 2019
sendStrategy=complete_all
dropIncomplete=false
keepListeningOnStop=false
disableCompression=false
parallelHandlerProcessing=true
sendBuildChannelConfig=at_startup
sendAwaitFirstMessage=false
socketType=DEFAULT
validationInconsistency=keep_as_is
byteBufferAllocator=false
mappingIncomplete=fill_null
sendSyncTimeout=0

11
devices/dp1.properties Normal file
View File

@@ -0,0 +1,11 @@
#Tue Sep 08 14:12:54 CEST 2020
motor7=null
motor8=null
motor5=null
motor6=null
precision=-1
positions=Park|Ready|Out|Clear
motor3=null
motor4=null
motor1=0.0|4.0|8.0|0.0
motor2=0.0|5.0|3.0|NaN

View File

@@ -0,0 +1,16 @@
#Tue Jun 16 19:34:40 CEST 2020
offset=0.0
maxValue=10.0
rotation=false
precision=2
scale=1.0
estbilizationDelay=0
maxSpeed=10.0
resolution=NaN
startRetries=1
minValue=-10.0
unit=mm
defaultSpeed=1.0
sign_bit=0
monitorByPosition=false
minSpeed=0.1

25
devices/image.properties Normal file
View File

@@ -0,0 +1,25 @@
#Fri Nov 22 15:03:58 CET 2019
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=false
roiY=0
roiX=0
transpose=false

16
devices/m1.properties Normal file
View File

@@ -0,0 +1,16 @@
#Tue Sep 08 14:12:54 CEST 2020
offset=0.0
maxValue=10.0
rotation=false
precision=2
scale=1.0
estbilizationDelay=0
maxSpeed=10.0
resolution=NaN
startRetries=1
minValue=-10.0
unit=mm
defaultSpeed=1.0
sign_bit=0
monitorByPosition=false
minSpeed=0.1

16
devices/m2.properties Normal file
View File

@@ -0,0 +1,16 @@
#Tue Sep 08 14:12:54 CEST 2020
offset=0.0
maxValue=10.0
rotation=false
precision=2
scale=1.0
estbilizationDelay=0
maxSpeed=10.0
resolution=NaN
startRetries=1
minValue=-10.0
unit=mm
defaultSpeed=1.0
sign_bit=0
monitorByPosition=false
minSpeed=0.1

View File

@@ -0,0 +1,18 @@
#Wed Sep 18 18:04:41 CEST 2019
offset=0.0
maxValue=25.0
precision=4
rotation=false
scale=1.0
estbilizationDelay=0
maxSpeed=3.0
resolution=0.001
homingType=None
startRetries=1
minValue=-25.0
unit=mm
defaultSpeed=2.0
hasEnable=false
sign_bit=0
monitorByPosition=false
minSpeed=1.0E-5

10
devices/p1.properties Normal file
View File

@@ -0,0 +1,10 @@
#Tue Sep 08 14:12:54 CEST 2020
minValue=0.0
unit=mm
offset=0.0
maxValue=1000.0
rotation=false
precision=-1
sign_bit=0
scale=1.0
resolution=NaN

25
devices/src1.properties Normal file
View File

@@ -0,0 +1,25 @@
#Tue Sep 08 15:59:19 CEST 2020
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Temperature
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false

25
devices/src2.properties Normal file
View File

@@ -0,0 +1,25 @@
#Tue Sep 08 15:59:19 CEST 2020
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false

View File

@@ -0,0 +1,726 @@
import ch.psi.utils.swing.StandardDialog;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.pshell.bs.CameraServer;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays;
import ch.psi.pshell.imaging.Pen;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.imaging.RendererListener;
import ch.psi.pshell.imaging.RendererMode;
import ch.psi.pshell.ui.App;
import ch.psi.utils.Convert;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JDialog;
/*
*/
/**
*
*/
public class CameraCalibrationDialog extends StandardDialog {
CameraServer server;
Renderer renderer;
String cameraName;
Overlay[] calibrationOverlays;
Pen pen = new Pen(new Color(128, 0, 128), 1, Pen.LineStyle.solid);
Overlays.Crosshairs ovTop = new Overlays.Crosshairs(pen, new Dimension(-1, 1));
Overlays.Crosshairs ovBottom = new Overlays.Crosshairs(pen, new Dimension(-1, 1));
Overlays.Crosshairs ovLeft = new Overlays.Crosshairs(pen, new Dimension(1, -1));
Overlays.Crosshairs ovRight = new Overlays.Crosshairs(pen, new Dimension(1, -1));
/**
*
* {
* name=SINEG01-DSCR350,
* prefix=SINEG01-DSCR350,
* mirror_x=true,
* mirror_y=true,
* rotate=0,
* calibration={
* horizontal_camera_angle=0,
* vertical_camera_angle=0
* reference_marker_width=16000.0,
* reference_marker_height=16000.0,
* reference_marker=[120, 245, 1251, 1504],
* },
* }
*/
public CameraCalibrationDialog(Frame parent, String cameraName, Renderer renderer) throws IOException {
super(parent, cameraName, false);
initComponents();
if (App.hasArgument("cam_srv_url")) {
this.server = new CameraServer("Camera Server", App.getArgumentValue("cam_srv_url"));
} else {
this.server = new CameraServer("Camera Server");
}
this.cameraName = cameraName;
this.renderer = renderer;
Map<String, Object> config = server.getConfig(cameraName);
Map<String, Object> calibration = (Map<String, Object>) config.get("camera_calibration");
List<Integer> refMarker = null;
System.out.println("Current config: " + config);
checkMirrorX.setSelected((config.get("mirror_x") ==null) ? Boolean.FALSE: (Boolean)config.get("mirror_x"));
checkMirrorY.setSelected((config.get("mirror_y") ==null) ? Boolean.FALSE: (Boolean)config.get("mirror_y"));
comboRotation.setSelectedIndex((config.get("rotate") == null) ? 0 :(Integer) (config.get("rotate")));
ckCalibrationEnabled.setSelected(calibration!=null);
if (calibration!=null){
spinnerRefWidth.setValue(((Number)calibration.get("reference_marker_width")).doubleValue());
spinnerRefHeight.setValue(((Number)calibration.get("reference_marker_height")).doubleValue());
spinnerAngleHor.setValue(((Number)calibration.get("angle_horizontal")).doubleValue());
spinnerAngleVer.setValue(((Number)calibration.get("angle_vertical")).doubleValue());
refMarker = ((List)calibration.get("reference_marker"));
if (refMarker.size()==4){
spinnerLeft.setValue(refMarker.get(0));
spinnerTop.setValue(refMarker.get(1));
spinnerRight.setValue(refMarker.get(2));
spinnerBottom.setValue(refMarker.get(3));
}
}
updateResults();
renderer.setMode(RendererMode.Fit);
calibrationOverlays = new Overlay[]{ovTop, ovBottom, ovLeft, ovRight};
for (Overlay ov : calibrationOverlays){
ov.setMovable(true);
}
renderer.addOverlays(calibrationOverlays);
try{
Rectangle r = new Rectangle();
ovLeft.update(new Point(Math.max(refMarker.get(0), 0), 0));
ovTop.update(new Point(0, Math.max(refMarker.get(1), 0)));
ovRight.update(new Point(Math.max(refMarker.get(2), 0), 0));
ovBottom.update(new Point(0, Math.max(refMarker.get(3),0)));
} catch (Exception ex){
SwingUtils.invokeDelayed(() -> {
Dimension size = renderer.getImageSize();
ovTop.update(new Point(0, size.height/8));
ovBottom.update(new Point(0, 7*size.height/8));
ovLeft.update(new Point(size.width/8, 0));
ovRight.update(new Point(7*size.width/8, 0));
}, 500);
}
renderer.addListener(new RendererListener(){
@Override
public void onMoveFinished(Renderer renderer, Overlay overlay) {
if (overlay==ovTop){
spinnerTop.setValue(ovTop.getPosition().y);
} else if (overlay==ovBottom){
spinnerBottom.setValue(ovBottom.getPosition().y);
} else if (overlay==ovLeft){
spinnerLeft.setValue(ovLeft.getPosition().x);
} else if (overlay==ovRight){
spinnerRight.setValue(ovRight.getPosition().x);
}
}
});
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
pack();
}
@Override
protected void onClosed() {
renderer.removeOverlays(calibrationOverlays);
calibrationOverlays = null;
server.close();
}
void updateResults(){
try{
int left = (Integer)spinnerLeft.getValue();
int right = (Integer)spinnerRight.getValue();
int top = (Integer)spinnerTop.getValue();
int bottom = (Integer)spinnerBottom.getValue();
double width = (Double)spinnerRefWidth.getValue();
double height = (Double)spinnerRefHeight.getValue();
double angleHor = (Double)spinnerAngleHor.getValue();
double angleVer = (Double)spinnerAngleVer.getValue();
double pixelHor = width * Math.cos(Math.toRadians(angleHor)) /Math.abs(right-left);
double pixelVer = height * Math.cos(Math.toRadians(angleVer)) /Math.abs(bottom-top);
textOriginX.setText(String.valueOf((left+right)/2));
textOriginY.setText(String.valueOf((top+bottom)/2));
textPixelSizeX.setText(String.valueOf(Convert.roundDouble(pixelHor, 2)));
textPixelSizeY.setText(String.valueOf(Convert.roundDouble(pixelVer, 2)));
ovLeft.update(new Point(Math.max(left, 0), 0));
ovTop.update(new Point(0, Math.max(top, 0)));
ovRight.update(new Point(Math.max(right, 0), 0));
ovBottom.update(new Point(0, Math.max(bottom,0)));
renderer.refresh();
} catch (Exception ex){
SwingUtils.showException(this, ex);
}
}
public static void main(String args[]) throws Exception {
//String cameraName = "SINEG01-DSCR190";
String cameraName = "SATSY02-DSCR220" ;
//java.awt.EventQueue.invokeLater(() -> {
Renderer renderer = new Renderer();
JDialog dlgRenderer = SwingUtils.showDialog(null, cameraName, new Dimension(600,400), renderer);
CameraCalibrationDialog dialog = new CameraCalibrationDialog(null, cameraName, renderer);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
dlgRenderer.setVisible(false);
System.exit(0);
}
});
SwingUtils.centerComponent(null, dialog);
dialog.setVisible(true);
// });
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
spinnerAngleHor = new javax.swing.JSpinner();
spinnerAngleVer = new javax.swing.JSpinner();
spinnerRefWidth = new javax.swing.JSpinner();
spinnerRefHeight = new javax.swing.JSpinner();
spinnerTop = new javax.swing.JSpinner();
spinnerBottom = new javax.swing.JSpinner();
spinnerLeft = new javax.swing.JSpinner();
spinnerRight = new javax.swing.JSpinner();
buttonFetch = new javax.swing.JButton();
ckCalibrationEnabled = new javax.swing.JCheckBox();
jPanel2 = new javax.swing.JPanel();
checkMirrorX = new javax.swing.JCheckBox();
checkMirrorY = new javax.swing.JCheckBox();
comboRotation = new javax.swing.JComboBox();
jLabel7 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
textOriginX = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
textOriginY = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
textPixelSizeX = new javax.swing.JTextField();
textPixelSizeY = new javax.swing.JTextField();
buttonOk = new javax.swing.JButton();
buttonCancel = new javax.swing.JButton();
buttonApply = new javax.swing.JButton();
jLabel1.setText("Calibrate the camera moving the line overlays to the reference marks.");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Calibration"));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Reference marker height (um):");
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Horizontal camera angle (deg):");
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel6.setText("Vertical camera angle (deg):");
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Reference marker width (um):");
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Top (px):");
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Botton (px):");
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel9.setText("Left (px):");
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel10.setText("Right (px):");
spinnerAngleHor.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
spinnerAngleHor.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerAngleVer.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
spinnerAngleVer.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerRefWidth.setModel(new javax.swing.SpinnerNumberModel(30000.0d, 1.0d, 500000.0d, 1.0d));
spinnerRefWidth.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerRefHeight.setModel(new javax.swing.SpinnerNumberModel(30000.0d, 1.0d, 500000.0d, 1.0d));
spinnerRefHeight.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerTop.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
spinnerTop.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerBottom.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
spinnerBottom.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerLeft.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
spinnerLeft.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
spinnerRight.setModel(new javax.swing.SpinnerNumberModel(0, -10000, 10000, 1));
spinnerRight.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
calibrationSpinnerChanged(evt);
}
});
buttonFetch.setText("Fetch from Inventory");
buttonFetch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonFetchActionPerformed(evt);
}
});
ckCalibrationEnabled.setText("Enabled");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerTop, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRefWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerBottom, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRefHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRight, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerAngleVer, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerAngleHor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(ckCalibrationEnabled)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonFetch)))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel2, jLabel8, jLabel9});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(spinnerRefWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerTop, 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)
.addComponent(jLabel4)
.addComponent(jLabel8)
.addComponent(spinnerRefHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerBottom, 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)
.addComponent(jLabel5)
.addComponent(jLabel9)
.addComponent(spinnerAngleHor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerLeft, 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)
.addComponent(jLabel6)
.addComponent(jLabel10)
.addComponent(spinnerAngleVer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerRight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonFetch)
.addComponent(ckCalibrationEnabled))
.addContainerGap())
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Transformations"));
checkMirrorX.setText("Mirror X");
checkMirrorY.setText("Mirror Y");
comboRotation.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "270", "180", "90" }));
jLabel7.setText("Rotation: ");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(checkMirrorX)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(comboRotation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(checkMirrorY)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboRotation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addComponent(checkMirrorX))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(checkMirrorY)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Results"));
jLabel11.setText("Origin X (px):");
textOriginX.setEditable(false);
textOriginX.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel12.setText("Origin Y (px):");
textOriginY.setEditable(false);
textOriginY.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel13.setText("Y pixel size (um/px):");
jLabel14.setText("X pixel size (um/px):");
textPixelSizeX.setEditable(false);
textPixelSizeX.setHorizontalAlignment(javax.swing.JTextField.CENTER);
textPixelSizeY.setEditable(false);
textPixelSizeY.setHorizontalAlignment(javax.swing.JTextField.CENTER);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textOriginY, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textOriginX, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textPixelSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textPixelSizeX, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel11, jLabel12});
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel13, jLabel14});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(textPixelSizeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(textPixelSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(textOriginX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(textOriginY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
buttonOk.setText("Ok");
buttonOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonOkActionPerformed(evt);
}
});
buttonCancel.setText("Cancel");
buttonCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonCancelActionPerformed(evt);
}
});
buttonApply.setText("Apply");
buttonApply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonApplyActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, 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)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonCancel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonApply)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonOk)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, buttonCancel, buttonOk});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonOk)
.addComponent(buttonCancel)
.addComponent(buttonApply))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOkActionPerformed
buttonApplyActionPerformed(evt);
accept();
}//GEN-LAST:event_buttonOkActionPerformed
private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
cancel();
}//GEN-LAST:event_buttonCancelActionPerformed
private void buttonFetchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFetchActionPerformed
try{
//List<Double> calib = Inventory.getCalibFromInventory(null, cameraName);
List<Double> calib = (List<Double>) Class.forName("Inventory").
getMethod("getCalibFromInventory",
new Class[]{String.class,String.class}).
invoke(null, new Object[]{(String)null, cameraName});
spinnerRefWidth.setValue(calib.get(0)*1000.0);
spinnerRefHeight.setValue(calib.get(1)*1000.0);
spinnerAngleHor.setValue(calib.get(2).doubleValue());
spinnerAngleVer.setValue(calib.get(3).doubleValue());
} catch (Exception ex){
if (ex instanceof InvocationTargetException){
ex = (Exception) ((InvocationTargetException)ex).getCause();
}
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonFetchActionPerformed
private void calibrationSpinnerChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_calibrationSpinnerChanged
updateResults();
}//GEN-LAST:event_calibrationSpinnerChanged
private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
try {
int left = (Integer)spinnerLeft.getValue(); //left.getPosition().x
int right = (Integer)spinnerRight.getValue(); //right.getPosition().x
int top = (Integer)spinnerTop.getValue(); //top.getPosition().y
int bottom = (Integer)spinnerBottom.getValue(); //bottom.getPosition().y
double width = (Double)spinnerRefWidth.getValue();
double height = (Double)spinnerRefHeight.getValue();
double angleHor = (Double)spinnerAngleHor.getValue();
double angleVer = (Double)spinnerAngleVer.getValue();
int x1 = Math.min(left, right);
int x2 = Math.max(left, right);
int y1 = Math.min(top, bottom);
int y2 = Math.max(top, bottom);
System.out.println("Updating " + cameraName + " configuration");
HashMap calibration = null;
if (ckCalibrationEnabled.isSelected()){
calibration = new HashMap();
calibration.put("reference_marker", Arrays.asList(new Integer[]{x1, y1, x2, y2}));
calibration.put("reference_marker_width", width);
calibration.put("reference_marker_height", height);
calibration.put("angle_horizontal", angleHor);
calibration.put("angle_vertical", angleVer);
}
Map<String, Object> config = server.getConfig(cameraName);
config.put("camera_calibration", calibration);
config.put("mirror_x", checkMirrorX.isSelected());
config.put("mirror_y", checkMirrorY.isSelected());
config.put("rotate", comboRotation.getSelectedIndex());
server.setConfig(cameraName, config);
System.out.println("New config: " + config);
boolean reticle = renderer.getShowReticle();
if (reticle){
renderer.setShowReticle(false);
}
SwingUtils.showMessage(this, "Success", "Updated " + cameraName + " configuration");
if (reticle){
renderer.setShowReticle(true);
}
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonApplyActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonApply;
private javax.swing.JButton buttonCancel;
private javax.swing.JButton buttonFetch;
private javax.swing.JButton buttonOk;
private javax.swing.JCheckBox checkMirrorX;
private javax.swing.JCheckBox checkMirrorY;
private javax.swing.JCheckBox ckCalibrationEnabled;
private javax.swing.JComboBox comboRotation;
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 jLabel14;
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 jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JSpinner spinnerAngleHor;
private javax.swing.JSpinner spinnerAngleVer;
private javax.swing.JSpinner spinnerBottom;
private javax.swing.JSpinner spinnerLeft;
private javax.swing.JSpinner spinnerRefHeight;
private javax.swing.JSpinner spinnerRefWidth;
private javax.swing.JSpinner spinnerRight;
private javax.swing.JSpinner spinnerTop;
private javax.swing.JTextField textOriginX;
private javax.swing.JTextField textOriginY;
private javax.swing.JTextField textPixelSizeX;
private javax.swing.JTextField textPixelSizeY;
// End of variables declaration//GEN-END:variables
}

393
plugins/Correlation.java Normal file
View File

@@ -0,0 +1,393 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.awt.Component;
import java.util.HashMap;
import java.util.List;
/**
*
*/
public class Correlation extends Panel {
public Correlation() {
initComponents();
this.setPersistedComponents(new Component[]{textDevX, textDevY, spinnerInterval, spinnerWindow, comboTypeX, comboTypeY});
plot.getAxis(Plot.AxisId.X).setLabel(null);
plot.getAxis(Plot.AxisId.Y).setLabel(null);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
super.onInitialize(runCount);
this.startTimer(100, 10);
if (App.hasArgument("dx")) {
textDevX.setText(App.getArgumentValue("dx"));
}
if (App.hasArgument("dy")) {
textDevY.setText(App.getArgumentValue("dy"));
}
try{
if (App.hasArgument("dxtype")) {
comboTypeX.setSelectedIndex(Integer.valueOf(App.getArgumentValue("dxtype")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("dytype")) {
comboTypeY.setSelectedIndex(Integer.valueOf(App.getArgumentValue("dytype")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("interval")) {
spinnerInterval.setValue(Double.valueOf(App.getArgumentValue("interval")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("window")) {
spinnerWindow.setValue(Integer.valueOf(App.getArgumentValue("window")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
}
@Override
protected void onTimer(){
if (isRunning()){
updateResults();
}
}
//DecimalFormat formatter = new DecimalFormat("0.##E0");
void updateResults(){
try{
textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)getContext().getInterpreterVariable("corr"))));
} catch (Exception ex){
textCorrelation.setText("");
}
if (checkLinear.isSelected()){
try{
List pars = (List)getContext().getInterpreterVariable("pars_lin");
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
} catch (Exception ex){
textLinear.setText("");
}
}
if (checkQuadratic.isSelected()){
try{
List pars = (List)getContext().getInterpreterVariable("pars_quad");
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
} catch (Exception ex){
textQuadratic.setText("");
}
}
}
@Override
public void onStateChange(State state, State former) {
buttonStart.setEnabled((state==State.Ready) || (state==State.Busy));
if (isRunning()){
if (state==State.Ready){
buttonStart.setText("Start");
}
} else {
if (state==State.Busy){
buttonStart.setText("Stop");
}
}
textDevX.setEnabled(state==State.Ready);
textDevY.setEnabled(state==State.Ready);
spinnerInterval.setEnabled(state==State.Ready);
spinnerWindow.setEnabled(state==State.Ready);
comboTypeX.setEnabled(state==State.Ready);
comboTypeY.setEnabled(state==State.Ready);
checkLinear.setEnabled(state==State.Ready);
checkQuadratic.setEnabled(state==State.Ready);
if ((former==State.Initializing) && (state == State.Ready)){
if (App.hasArgument("start")) {
buttonStartActionPerformed(null);
}
}
}
boolean isRunning(){
return buttonStart.getText().equals("Stop");
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
plot = new ch.psi.pshell.plot.LinePlotJFree();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
textDevX = new javax.swing.JTextField();
textDevY = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
spinnerInterval = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
spinnerWindow = new javax.swing.JSpinner();
buttonStart = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
textCorrelation = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
textLinear = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
textQuadratic = new javax.swing.JTextField();
checkLinear = new javax.swing.JCheckBox();
checkQuadratic = new javax.swing.JCheckBox();
comboTypeX = new javax.swing.JComboBox();
comboTypeY = new javax.swing.JComboBox();
plot.setTitle("");
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("X device:");
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Y device:");
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Interval (s):");
spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(Double.valueOf(0.1d), Double.valueOf(0.001d), null, Double.valueOf(1.0d)));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Window size:");
spinnerWindow.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(50), Integer.valueOf(3), null, Integer.valueOf(1)));
buttonStart.setText("Start");
buttonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartActionPerformed(evt);
}
});
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel5.setText("Correlation:");
textCorrelation.setEditable(false);
textCorrelation.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel6.setText("Liner fit:");
textLinear.setEditable(false);
textLinear.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel7.setText("Quadratric fit:");
textQuadratic.setEditable(false);
textQuadratic.setHorizontalAlignment(javax.swing.JTextField.CENTER);
checkLinear.setSelected(true);
checkLinear.setText("Linear fit");
checkQuadratic.setText("Quadratic fit");
comboTypeX.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
comboTypeY.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textLinear, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(textQuadratic, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(checkLinear)
.addComponent(checkQuadratic))
.addContainerGap())
.addComponent(textDevX)
.addComponent(textDevY)))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerInterval, spinnerWindow});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel5, jLabel6, jLabel7});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textCorrelation, textLinear, textQuadratic});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textDevX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(textDevY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3)
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerInterval, 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)
.addComponent(jLabel4)
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(checkLinear)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkQuadratic)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(textCorrelation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel6)
.addComponent(textLinear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel7)
.addComponent(textQuadratic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
.addComponent(buttonStart)
.addGap(45, 45, 45))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(plot, 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 {
if (isRunning()){
abort();
updateResults();
//buttonStart.setText("Start");
} else {
textCorrelation.setText("");
textLinear.setText("");
textQuadratic.setText("");
HashMap args = new HashMap();
args.put("dx", textDevX.getText());
args.put("dy", textDevY.getText());
args.put("interval", spinnerInterval.getValue());
args.put("window", spinnerWindow.getValue());
args.put("dxtype", comboTypeX.getSelectedIndex());
args.put("dytype", comboTypeY.getSelectedIndex());
args.put("linear_fit", checkLinear.isSelected());
args.put("quadratic_fit", checkQuadratic.isSelected());
args.put("p", plot);
runAsync("Correlation/Correlation2", args).handle((ok, ex) -> {
if (ex != null) {
ex.printStackTrace();
}
return ok;
});
///buttonStart.setText("Stop");
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkLinear;
private javax.swing.JCheckBox checkQuadratic;
private javax.swing.JComboBox comboTypeX;
private javax.swing.JComboBox comboTypeY;
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.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerInterval;
private javax.swing.JSpinner spinnerWindow;
private javax.swing.JTextField textCorrelation;
private javax.swing.JTextField textDevX;
private javax.swing.JTextField textDevY;
private javax.swing.JTextField textLinear;
private javax.swing.JTextField textQuadratic;
// End of variables declaration//GEN-END:variables
}

148
plugins/Inventory.java Normal file
View File

@@ -0,0 +1,148 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.JsonSerializer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.jackson.JacksonFeature;
/**
*
*/
public class Inventory {
public static <T> T inventoryRequest(String url, Map attributes, Class<T> type) throws IOException {
String json = JsonSerializer.encode(attributes);
Client client = ClientBuilder.newClient(new ClientConfig().register(JacksonFeature.class));
try {
WebTarget resource = client.target(url);
Response r = resource.request().accept(MediaType.TEXT_HTML).post(Entity.json(json));
json = r.readEntity(String.class);
if (r.getStatus() != Response.Status.OK.getStatusCode()) {
throw new IOException("Inventory returned error: " + json);
}
Map ret = (Map) JsonSerializer.decode(json, Map.class);
return (T) ret.get("d");
} finally {
client.close();
}
}
public static String findPartidByHoly(String holy_name, String type) throws IOException {
if (type == null) {
type = "DSCR";
}
Map query = new HashMap();
Map qn = new HashMap();
Map qt = new HashMap();
qn.put("Field", "Holy List Name");
qn.put("Operator", "Is");
qn.put("Value", holy_name);
qt.put("Field", "Type");
qt.put("Operator", "Is");
qt.put("Value", type);
query.put("query", Arrays.asList(new Map[]{qn, qt}));
query.put("columns", Arrays.asList(new String[]{"Label"}));
Map attr = new HashMap();
attr.put("search", query);
Map ret = (Map) inventoryRequest("https://inventory.psi.ch/DataAccess.asmx/FindObjects", attr, Map.class);
try {
return (String) ((List) (((List) ret.get("Rows")).get(0))).get(0);
} catch (Exception ex) {
return null;
}
}
public static List findAllByType(String type, String column) throws IOException {
if (type == null) {
type = "DSCR";
}
if (column == null) {
column = "Holy List Name";
}
Map query = new HashMap();
Map q = new HashMap();
q.put("Field", "Type");
q.put("Operator", "Is");
q.put("Value", type);
query.put("query", Arrays.asList(new Map[]{q}));
query.put("columns", Arrays.asList(new String[]{"Label"}));
Map attr = new HashMap();
attr.put("search", query);
Map r = (Map) inventoryRequest("https://inventory.psi.ch/DataAccess.asmx/FindObjects", attr, Map.class);
List rows = (List) (r.get("Rows"));
List ret = new ArrayList();
for (Object list : rows) {
ret.add(((List) list).get(0));
}
return ret;
}
public static List<Map> getPartAttributesFromInventory(String part_label, String holy_name) throws IOException {
if ((holy_name != null) && !holy_name.isEmpty()) {
part_label = findPartidByHoly(holy_name, "DSCR");
if ((part_label == null) || part_label.isEmpty()) {
throw new IOException("Could not find inventory part for: " + holy_name);
}
}
Map map = new HashMap();
map.put("psiLabel", part_label);
return (List) inventoryRequest("https://inventory.psi.ch/DataAccess.asmx/GetPartAttributes", map, List.class);
}
public static List<Double> getCalibFromInventory(String part_label, String holy_name) throws IOException {
double horizontal_dist = 0.0;
double vertical_dist = 0.0;
double horizontal_tilt = 0.0;
double vertical_tilt = 0.0;
List<Map> attributes = getPartAttributesFromInventory(part_label, holy_name);
for (Map a : attributes) {
String name = (String) a.get("Name");
Double val = 0.0;
try {
val = Double.valueOf(a.get("Value").toString());
} catch (Exception ex) {
}
switch (name) {
case "Crystal angle in x (e-beam system) [deg]":
horizontal_tilt = val;
break;
case "Crystal angle in y (e-beam system) [deg]":
vertical_tilt = val;
break;
case "Mark distance in x (e-beam system) [mm]":
horizontal_dist = val;
break;
case "Mark distance in y (e-beam system) [mm]":
vertical_dist = val;
break;
}
}
return Arrays.asList(new Double[]{horizontal_dist, vertical_dist, horizontal_tilt, vertical_tilt});
}
public static void main(String[] args) throws IOException {
System.out.println(getCalibFromInventory("SINEG01-DSCR190", "SINEG01-DSCR190"));
System.out.println(findAllByType(null, null));
}
}

4415
plugins/ScreenPanel5.java Normal file

File diff suppressed because it is too large Load Diff

1359
plugins/ScreenPanel6.form Normal file

File diff suppressed because it is too large Load Diff

4554
plugins/ScreenPanel6.java Normal file

File diff suppressed because it is too large Load Diff

1
plugins/resources Symbolic link
View File

@@ -0,0 +1 @@
/afs/psi.ch/intranet/SF/Applications/config/pshell_op/plugins/resources

1
script/1D_EOscan.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M422:MOT.VAL", 1.0, 49.0, 0.015 ] ], [ [ "Stream", "PID", 1, 0.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH1:VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "test_EO", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M423:MOT.VAL", 75.6, 75.85, 0.01 ] ], [ [ "Channel", " SAROP11-PALMK118:CH1_BUFFER", 1, 0.02, "Enabled" ], [ "Channel", " SAROP11-PALMK118:CH2_BUFFER", 1, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "/sf/alvra/data/p16585/res/scan_data/palm_data/scan_362", "", " ", " ", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_X1.VAL", 90.0, 170.0, 1.0 ] ], [ [ "CamServer", "SARES12-CAMS128-M1 y_profile", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_scan004", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_X1.VAL", 11.49, 11.69, 0.02 ] ], [ [ "Stream", "SARES11-GES1:CH1_VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SARES11-LSCP10-FNS:CH0:VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_scan004", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_Y1.VAL", 12.375, 12.42, 0.002 ] ], [ [ "Stream", "SARES11-GES1:CH1_VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_scan004", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M451:MOTOR_1.VAL", 151.9, 153.5, 0.01 ] ], [ [ "Stream", "PID", 1, 0.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH1:VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", " SLAAR11-LSCP1-FNS:CH4:VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH3:VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pumppropbescan003", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Multidimensional", [ [ "Channel", "SARES11-XSAM125:MOTOR_X1.VAL", 12.25, 12.5, 0.02 ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.VAL", -11.65, -11.35, 0.02 ] ], [ [ "Stream", "SARES11-GES1:CH1_VAL_GET", 20, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 20, -1.0, "Enabled" ], [ "Stream", "SARES11-LSCP10-FNS:CH0:VAL_GET", 20, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_scan004", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", " SAROP21-ARAMIS:ENERGY_SP", 12215.0, 12270.0, 2.0 ] ], [ [ "Channel", "SAROP21-PSCP-DRS1FNS:CH1:BOXCAR.VALG", 50, 0.1, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

1
script/CD.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES12-XMOT128:SA_MOT12:DRIVE", 45.0, 47.0, 0.2 ], [ "Channel", "SARES12-XMOT128:PB_MOT2.VAL", 0.0, 0.0, 1 ] ], [ [ "Stream", "SARES11-LSCP10-FNS:CH0:VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.5, false, false, true, true, "monoscan_general", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1,239 @@
import math
import sys, traceback
from mathutils import fit_polynomial, PolynomialFunction
from plotutils import plot_line, plot_function
from ch.psi.pshell.swing.Shell import STDOUT_COLOR
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation as PearsonsCorrelation
import ch.psi.pshell.bs.PipelineServer as PipelineServer
TYPE_CHANNEL = 0
TYPE_STREAM = 1
TYPE_CAMERA= 2
INVOKE_PLOT_UPDATES = True
if get_exec_pars().source == CommandSource.ui:
dx = "SINDI01-RLLE-STA:SLAVE1-CPUTIMER"
#dx = "SLG-LCAM-C042 x_rms"
dxtype = TYPE_STREAM
dxtype = TYPE_CHANNEL
#dxtype = TYPE_CAMERA
#dy = "SINDI01-RLLE-STA:SLAVE1-DLTIMER"
dy = "SLG-LCAM-C042 y_rms"
dytype = TYPE_STREAM
dytype = TYPE_CHANNEL
dytype = TYPE_CAMERA
interval = 0.10
window = 40
p = plot(None)[0]
linear_fit = True
quadratic_fit = True
print dx, dxtype
print dy, dytype
corr = None
pars_lin = None
pars_quad = None
pos_peak = None
neg_peak = None
stop_exec = None
bs = TYPE_STREAM in [dxtype, dytype]
for s in p.getAllSeries():
p.removeSeries(s)
_stream = None
_camname = None
instances = []
def _get_device(d, type):
global _stream, _camname
egu = None
if isinstance(d, basestring):
name = d.strip()
d = None
try:
d = get_device(name)
if d is None:
d = eval(name)
#print name
if d is not None:
if not isinstance(r, Device):
d = None
else:
try:
egu = d.unit
except:
pass
except:
pass
if d is None:
offset = 0
if type==TYPE_STREAM:
if " " in name:
tokens = name.split(" ")
name = tokens[0]
offset = int(tokens[1])
if _stream == None:
_stream = Stream("corr_stream", dispatcher)
instances.append(_stream)
d = _stream.addScalar(name, name, int(interval*100), offset)
elif type==TYPE_CHANNEL:
d = Channel(name)
d.set_monitored(True)
elif type==TYPE_CAMERA:
tokens = name.split(" ")
_camname = tokens[0]
field = tokens[1]
return field, ""
else:
raise Exception("Invalid type: " + str(type))
if not isinstance(d, basestring):
instances.append(d)
try:
egu = caget(name+".EGU",'s')
except:
pass
else:
try:
egu = d.unit
except:
pass
return d, egu
dx, egux = _get_device(dx, dxtype)
dy, eguy = _get_device(dy, dytype)
p.getAxis(p.AxisId.X).setLabel(egux)
p.getAxis(p.AxisId.Y).setLabel(eguy)
try:
if _stream != None:
_stream.initialize()
_stream.start(True)
if _camname != None:
shared = _camname.endswith("_sp1")
print "Camera: " , _camname, " shared: ", shared
cam_server.start(_camname, shared )
cam_server.stream.waitCacheChange(10000);
if dxtype==TYPE_CAMERA:
dx=cam_server.stream.getChild(dx)
if dytype==TYPE_CAMERA:
dy=cam_server.stream.getChild(dy)
p.addSeries(LinePlotSeries("Data"))
sd=p.getSeries(0)
sd.setLinesVisible(False)
sd.setPointSize(4)
if get_exec_pars().source == CommandSource.ui:
if globals().has_key("marker"):
p.removeMarker(marker)
if globals().has_key("peak_marker"):
p.removeMarker(peak_marker)
marker=None
peak_marker=None
while(True):
#Sample and plot data
if bs == True:
_stream.waitValueNot(_stream.take(), 10000)
bsdata = list(_stream.take().values)
if dxtype==TYPE_CHANNEL:
x=dx.read()
elif dxtype==TYPE_STREAM:
x=bsdata.pop(0)
elif dxtype==TYPE_CAMERA:
x=dx.read()
if dytype==TYPE_CHANNEL:
y=dy.read()
elif dytype==TYPE_STREAM:
y=bsdata.pop(0)
elif dytype==TYPE_CAMERA:
y=dy.read()
def update():
global marker, peak_marker, corr, pars_lin, pars_quad, pos_peak, neg_peak, stop_exec
sd.appendData(x, y)
if len(sd.x) > window:
#Remove First Element
sd.token.remove(0)
ax = sd.x
ay = sd.y
if len(ax)>2:
x1, x2 = min(ax), max(ax)
res = (x2-x1)/100
if x1!=x2:
#Display correlation
corr= PearsonsCorrelation().correlation(to_array(ax,'d'), to_array(ay,'d'))
s = "Correlation=" + str(round(corr,4))
#print s
if get_exec_pars().source == CommandSource.ui:
if marker is not None:
p.removeMarker(marker)
marker = p.addMarker(x2+res, p.AxisId.X, s, p.getBackground())
marker.setLabelPaint(STDOUT_COLOR)
if linear_fit:
#Calculate, print and plot linear fit
pars_lin = (a0,a1) = fit_polynomial(ay, ax, 1)
#print "Fit lin a1:" , a1, " a0:",a0
y1 = poly(x1, pars_lin)
y2 = poly(x2, pars_lin)
plot_line(p, x1, y1, x2, y2, width = 2, color = Color.BLUE, name = "Fit Linear")
if quadratic_fit:
#Calculate, print and plot quadratic fit
pars_quad = (a0,a1,a2) = fit_polynomial(ay, ax, 2)
#print "Fit quad a2:" , a2, "a1:" , a1, " a0:",a0
fitted_quad_function = PolynomialFunction(pars_quad)
ax = frange(x1, x2, res, True)
plot_function(p, fitted_quad_function, "Fit Quadratic", ax, color=Color.GREEN)
peak = None
peaks = calculate_peaks(fitted_quad_function, x1, x2, positive=True)
if len(peaks)>0:
peak = peaks[0]
pos_peak = str(round(peak,4))
peak_str = "Positive peak: " + pos_peak
else:
peaks = calculate_peaks(fitted_quad_function, x1, x2, positive=False)
if len(peaks)>0:
peak = peaks[0]
neg_peak = str(round(peak,4))
peak_str = "Negative peak: " + neg_peak
else:
pos_peak = neg_peak = None
if get_exec_pars().source == CommandSource.ui:
if peak_marker is not None:
p.removeMarker(peak_marker)
if peak is not None:
peak_marker = p.addMarker(peak, p.AxisId.X, peak_str, Color(0,128,0))
if INVOKE_PLOT_UPDATES:
invoke(update, False)
else:
update()
if stop_exec == True:
stop_exec = False
break
if bs != True:
time.sleep(interval)
except KeyboardInterrupt:
pass
finally:
for dev in instances:
try:
dev.close()
except:
pass

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_X1.VAL", -11.0, -10.5, 0.005 ] ], [ [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 20, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "knife_edge_laser", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_Y1.VAL", -11.65, -11.35, 0.01 ] ], [ [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 40, -1.0, "Enabled" ], [ "Stream", "SARES11-GES1:CH1_VAL_GET", 40, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_Y_scan", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_X1.VAL", -4.2, -4.0, 0.005 ] ], [ [ "Stream", "PID", 1, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 40, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 40, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch10-DATA-SUM", 40, -1.0, "Enabled" ], [ "Stream", "SARES11-GPADC1:CH1_VAL_GET", 40, -1.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_X1.RBV", 1, 0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.RBV", 1, 0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Z1.RBV", 1, 0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "jet_scan_1", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_X1.VAL", -12.0, -11.7, 0.005 ] ], [ [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.RBV", 1, 0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "knifedge_scan_X", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Continuous", [ [ "Device", "motor_x1", -13.5, -13.4, 0.001 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Channel", "SARES11-XSAM125:MOTOR_X1.RBV?monitored=true", 1, 0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.RBV?monitored=true", 1, 0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Z1.RBV?monitored=true", 1, 0, "Enabled" ] ], false, [ ], "", 1, 10.0, 0.0, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Continuous", [ [ "Device", "motor_x1", -13.5, -13.4, 0.001 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Channel", "SARES11-XSAM125:MOTOR_X1.RBV?monitored=true", 1, 0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.RBV?monitored=true", 1, 0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Z1.RBV?monitored=true", 1, 0, "Enabled" ] ], false, [ ], "", 1, 60.0, 0.0, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1,47 @@
#Parameters:
SCAN_RANGE = [-13.5, -13.4]
SCAN_TIME = 10.0
STREAM_SCALARS = ['SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM']
STREAM_WAVEFORMS = ['SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED', 'SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED']
EPICS_CHANELS = ['SARES11-XSAM125:MOTOR_X1.RBV', 'SARES11-XSAM125:MOTOR_Y1.RBV', 'SARES11-XSAM125:MOTOR_Z1.RBV']
MOTOR = motor_x1
#Create the beam synchronous Stream
stream = Stream("PID", dispatcher)
modulo, offset = 10,0
for name in STREAM_SCALARS:
stream.addScalar(name, name, modulo, offset )
plot_types = {}
for name in STREAM_WAVEFORMS:
stream.addWaveform(name, name, modulo, offset )
plot_types[name]=1
stream.initialize()
stream.start()
#Creare channels
channels = []
for name in EPICS_CHANELS:
channel = Channel(name, 'd')
channel.monitored= True
channels.append(channel)
#Setup motor
velocity = abs(float(SCAN_RANGE[1]-SCAN_RANGE[0])) / SCAN_TIME
MOTOR.setSpeed(MOTOR.defaultSpeed)
MOTOR.move(float(SCAN_RANGE[0]))
MOTOR.setSpeed(float(velocity) )
#Wait stream to be active
stream.waitCacheChange(10000)
#Trigger motor move an start sampling
MOTOR.moveAsync(float(SCAN_RANGE[1]))
try:
mscan(stream, stream.getReadables() + channels, -1, SCAN_TIME, plot_types=plot_types)
finally:
stream.close()
MOTOR.setSpeed(MOTOR.defaultSpeed)

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_Y1", 18.1, 18.4, 0.005 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 20, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-SUM", 20, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-SUM", 20, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-SUM", 20, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 20, 0.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_X1.RBV", 20, 0.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.RBV", 20, 0.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Z1.RBV", 20, 0.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Continuous", [ [ "Device", "motor_x1", -13.5, -13.4, 0.005 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-SUM", 1, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-SUM", 1, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-SUM", 1, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 1, 0.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_X1.RBV", 1, 0.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Y1.RBV", 1, 0.0, "Enabled" ], [ "Channel", "SARES11-XSAM125:MOTOR_Z1.RBV", 1, 0.0, "Enabled" ] ], false, [ ], "", 1, 60.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

1
script/IZERO_scan.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XOTA125:Y.VAL", -3.0, 6.0, 0.2 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Change event series", [ ], [ [ "Stream", "PID", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch14-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch14-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch14-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch12-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch12-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch12-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch13-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch13-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch13-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ] ], false, [ ], "", 1000, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Time", false ]

1
script/Io_target.scan Normal file
View File

@@ -0,0 +1 @@
[ "Change event series", [ ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 100, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Time", false ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XIZO125:TRY.VAL", 1.0, 10.0, 0.2 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED-SUM", 5, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-DATA-CALIBRATED-SUM", 5, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-DATA-CALIBRATED?waveform=true", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 5, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch15-BG-DATA-CALIBRATED?waveform=true", 5, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_Y1.VAL", 16.0, 16.7, 0.002 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH3:VAL_GET", 30, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH1:VAL_GET", 30, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH4:VAL_GET", 30, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH5:VAL_GET", 30, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH6:VAL_GET", 30, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH7:VAL_GET", 30, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.1, false, false, true, true, "KnifeEdge_Y", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Time series", [ ], [ [ "Channel", "SLAAR11-LSPC-SPEC1:SPECTRUM", 10, 1.0, "Enabled" ], [ "Channel", "SLAAR11-LSPC-SPEC1:WAVELENGTHS", 10, 1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "spectrum2", "", "Default", "txt", 0, null, null, "Time", false, true ]

View File

@@ -0,0 +1 @@
[ "Multidimensional", [ [ "Channel", "SARES11-XICM125:ROX1:DRIVE", -1.29171, -1.27821, 5.0E-4 ], [ "Channel", " SARES11-XICM125:ROY1:DRIVE", 1.41719, 1.42975, 5.0E-4 ] ], [ [ "Stream", "PID", 1, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SARES11-GPADC1:CH1_VAL_GET", 10, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "Pimhole_laser_scan", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M453:MOTOR_1.VAL", 160.0, 180.0, 1.0 ] ], [ [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 2, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "Pimhole_laser_scan", "", "Default", "txt", 0, null, null, "Positioner", false, true ]

1
script/MonoScan.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-ARAMIS:ENERGY_SP", 8000.0, 8300.0, 10.0 ] ], [ [ "CamServer", "http://sf-daqsync-01:8889/SAROP11-PPRM110_sp1 intensity", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", " SAROP11-ARAMIS:ENERGY_SP_USER", 4975.0, 5005.0, 1.0 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH3:VAL_GET", 25, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH1:VAL_GET", 25, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH4:VAL_GET", 25, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH5:VAL_GET", 25, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH6:VAL_GET", 25, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH7:VAL_GET", 25, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.1, false, false, true, true, "MonoScan006", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", " SAROP11-ARAMIS:ENERGY_SP_USER", 7030.0, 7060.0, 2.0 ] ], [ [ "Stream", "SARES11-LSCP10-FNS:CH0:VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SARES11-LSCP10-FNS:CH1:VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SARES11-GES1:CH1_VAL_GET", 50, -1.0, "Enabled" ], [ "Stream", "SARES11-GES1:CH2_VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.5, false, false, true, true, "monoscan_general", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", " SAROP11-ARAMIS:ENERGY_SP_USER", 5850.0, 6150.0, 5.0 ] ], [ [ "Stream", "SARES11-GES1:CH1_VAL_GET", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.5, false, false, true, true, "monoscan_LBM_fine2", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", " SAROP11-ARAMIS:ENERGY_SP_USER", 6980.0, 7050.0, 5.0 ] ], [ [ "CamServer", "tcp://sf-daqsync-04.psi.ch:11126 intensity", 100, -1.0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-ODCM105:RX12.VAL", 45.0, 46.0, 1.0 ] ], [ [ "Stream", "PID", 1, 0.0, "Enabled" ], [ "Channel", "SAROP11-ODCM105:RX12_FE", 1, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.2, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

1
script/PALM_drift.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:HVDT1-SP.VAL", 0.85, 0.95, 0.01 ], [ "Channel", "SAROP11-PALM118:HVDT2-SP.VAL", 0.85, 0.95, 0.01 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

1
script/PALM_lens.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:HVDT1-SP.VAL", 4.0, 8.0, 0.1 ], [ "Channel", "SAROP11-PALM118:HVDT2-SP.VAL", 4.0, 8.0, 0.1 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:MOT_GN1X.VAL", -1.6, -0.5, 0.1 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", " ", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:MOT_GN1Z.VAL", -1.0, 5.0, 0.2 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", " ", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:MOT_GN1Z.VAL", -1.0, 5.0, 0.2 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", " ", "", 0, null, null, "Positioner", false, true ]

1
script/PALM_steak_x.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:MOT_GN2X.VAL", -4.4, -3.0, 0.2 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

1
script/PALM_steak_y.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:MOT_GN2Y.VAL", -1.4, 0.0, 0.2 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

1
script/PALM_steak_z.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:MOT_GN1Y.VAL", -1.0, 5.0, 0.2 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Change event series", [ ], [ [ "Stream", "PID", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 600, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Index", false ]

View File

@@ -0,0 +1 @@
[ "Change event series", [ ], [ [ "Stream", "PID", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch10-DATA-SUM", 1, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch10-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch10-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 600, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Index", false ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PSEN119:MOTOR_Y1.VAL", -50.5, -49.0, 0.025 ] ], [ [ "Channel", "SLAAR11-LSCP1-FNS:CH4:VAL_GET", 20, 0.05, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Time series", [ ], [ [ "Stream", "SARES11-SPEC125-M2.roi_signal_x_profile", 1, 0.0, "Enabled" ], [ "Stream", "SARES11-SPEC125-M2.roi_background_x_profile", 1, 0.0, "Enabled" ] ], true, [ ], "", 100, 0.5, 0.25, false, false, false, true, "/sf/alvra/data/p17807/res/scan_data/palm_data/scan_palm_056.h5", "", "", "", 1, null, null, "Index", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-PALM118:HVDT1-SP.VAL", 1.0, 8.0, 0.2 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 50, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", " ", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M423:MOT.VAL", 100.0, 110.0, 0.03 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 5, 0.02, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 5, 0.02, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "", "", "", "", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Change event series", [ ], [ [ "Stream", "SARES11-SPEC125-M2.roi_signal_x_profile", 1, 0.0, "Enabled" ], [ "Stream", "SARES11-SPEC125-M2.roi_background_x_profile", 1, 0.0, "Enabled" ] ], false, [ ], "", 0, 0.0, 0.0, false, false, false, true, "", "", " ", "", 1, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XSAM125:MOTOR_Y1.VAL", 17.0, 19.8, 0.1 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-BG-DATA-CALIBRATED?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", true ]

1
script/Test1.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-ODCM105:ENERGY_SP", 2350.0, 2400.0, 2.0 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 5, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 1, 0.0, 0.2, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

1
script/Test2.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 5, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA?waveform=true", 1, -1.0, "Line" ] ], false, [ ], "", 1, 0.0, 0.2, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

1
script/TestMonoScan.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SAROP11-ODCM105:ENERGY_SP", 2150.0, 2175.0, 1.0 ] ], [ [ "Stream", "PID", 1, 0.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch11-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch10-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch4-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch5-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch6-DATA-SUM", 10, -1.0, "Enabled" ], [ "Stream", "SAROP11-CVME-PBPS1:Lnk9Ch7-DATA-SUM", 10, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.2, false, false, true, true, "", "", "Default", "h5", 0, null, null, "Positioner", false ]

1
script/Thzscan.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", " SLAAR11-LMOT-M423:MOT.VAL", 211.2, 212.0, 0.05 ] ], [ [ "Channel", "SAROP11-PALMK118:CH1_BUFFER", 40, 0.04, "Enabled" ], [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 40, 0.04, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "/sf/alvra/data/p17807/res/scan_data/palm_data/scan_palm_056.h5", "", "", "", 0, null, null, "Positioner", false, true ]

1
script/TimeScan.scan Normal file
View File

@@ -0,0 +1 @@
[ "Time series", [ ], [ [ "Channel", "SLAAR11-L-LAMCALC2:MOTOR_POS_SMAR_SC", 1, -1.0, "Enabled" ], [ "Channel", "SLAAR11-L-LAMCALC2:ADC1", 1, -1.0, "Enabled" ] ], false, [ ], "", 14000, 1.0, 10.0, false, false, true, true, "LAM_stability", "", "Default", "h5", 0, null, null, "Positioner", false ]

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XICM125:ROX1:DRIVE", -1.08, -1.208, 0.002 ], [ "Channel", "SARES11-XICM125:ROY1:DRIVE", 0.458, 0.658, 0.002 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH3:VAL_GET", 10, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH1:VAL_GET", 10, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_scan", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

3
script/local.groovy Executable file
View File

@@ -0,0 +1,3 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Deployment specific global definitions - executed after startup.groovy
///////////////////////////////////////////////////////////////////////////////////////////////////

4
script/local.js Executable file
View File

@@ -0,0 +1,4 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Deployment specific global definitions - executed after startup.js
///////////////////////////////////////////////////////////////////////////////////////////////////

189
script/local.py Executable file
View File

@@ -0,0 +1,189 @@
###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list, Gaussian
from mathutils import fit_polynomial,fit_gaussian, fit_harmonic, calculate_peaks
from mathutils import PolynomialFunction, Gaussian, HarmonicOscillator
import java.awt.Color as Color
###################################################################################################
# Machine utilities
###################################################################################################
def is_laser_on():
return (caget ("SIN-TIMAST-TMA:Beam-Las-Delay-Sel",'d') == 0 )
def is_timing_ok():
return caget("SIN-TIMAST-TMA:SOS-COUNT-CHECK") == 0
def get_repetition_rate():
return caget("SIN-TIMAST-TMA:Evt-15-Freq-I")
###################################################################################################
# Shortcut to maths utilities
###################################################################################################
def gfit(ydata, xdata = None):
"""
Gaussian fit
"""
if xdata is None:
xdata = frange(0, len(ydata), 1)
#ydata = to_list(ydata)
#xdata = to_list(xdata)
max_y= max(ydata)
index_max = ydata.index(max_y)
max_x= xdata[index_max]
print "Max index:" + str(index_max),
print " x:" + str(max_x),
print " y:" + str(max_y)
gaussians = fit_gaussians(ydata, xdata, [index_max,])
(norm, mean, sigma) = gaussians[0]
p = plot([ydata],["data"],[xdata], title="Fit" )[0]
fitted_gaussian_function = Gaussian(norm, mean, sigma)
scale_x = [float(min(xdata)), float(max(xdata)) ]
points = max((len(xdata)+1), 100)
resolution = (scale_x[1]-scale_x[0]) / points
fit_y = []
fit_x = frange(scale_x[0],scale_x[1],resolution, True)
for x in fit_x:
fit_y.append(fitted_gaussian_function.value(x))
p.addSeries(LinePlotSeries("fit"))
p.getSeries(1).setData(fit_x, fit_y)
if abs(mean - xdata[index_max]) < ((scale_x[0] + scale_x[1])/2):
print "Mean -> " + str(mean)
p.addMarker(mean, None, "Mean="+str(round(norm,2)), Color.MAGENTA.darker())
return (norm, mean, sigma)
else:
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY)
print "Invalid gaussian fit: " + str(mean)
return (None, None, None)
def hfit(ydata, xdata = None):
"""
Harmonic fit
"""
if xdata is None:
xdata = frange(0, len(ydata), 1)
max_y= max(ydata)
index_max = ydata.index(max_y)
max_x= xdata[index_max]
start,end = min(xdata), max(xdata)
(amplitude, angular_frequency, phase) = fit_harmonic(ydata, xdata)
fitted_harmonic_function = HarmonicOscillator(amplitude, angular_frequency, phase)
print "amplitude = ", amplitude
print "angular frequency = ", angular_frequency
print "phase = ", phase
f = angular_frequency/ (2* math.pi)
print "frequency = ", f
resolution = 4.00 # 1.00
fit_y = []
for x in frange(start,end,resolution, True):
fit_y.append(fitted_harmonic_function.value(x))
fit_x = frange(start, end+resolution, resolution)
p = plot(ydata,"data", xdata, title="HFit")[0]
p.addSeries(LinePlotSeries("fit"))
p.getSeries(1).setData(fit_x, fit_y)
#m = (phase + math.pi)/ angular_frequency
m = -phase / angular_frequency
if (m<start):
m+=(1.0/f)
if start <=m <=end:
print "fit = ", m
p.addMarker(m, None, "Fit="+str(round(m ,2)), Color.MAGENTA.darker())
return (amplitude, angular_frequency, phase, True, m, fit_x, fit_y)
else:
print "max = ",max_x
p.addMarker(max_x, None, "Max="+str(round(max_x ,2)), Color.MAGENTA.darker())
return (amplitude, angular_frequency, phase, False, max_x, fit_x, fit_y)
###################################################################################################
# Tools
###################################################################################################
def elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "Bernina", encoding=1):
"""
Add entry to ELOG.
"""
if author is None:
author = "pshell" #get_context().user.name
typ = "pshell"
entry = ""
cmd = 'G_CS_ELOG_add -l "' + logbook + '" '
cmd = cmd + '-a "Author=' + author + '" '
cmd = cmd + '-a "Type=' + typ + '" '
cmd = cmd + '-a "Entry=' + entry + '" '
cmd = cmd + '-a "Title=' + title + '" '
cmd = cmd + '-a "Category=' + category + '" '
cmd = cmd + '-a "Domain=' + domain + '" '
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-n ' + str(encoding)
cmd = cmd + ' "' + message + '"'
#print cmd
#os.system (cmd)
#print os.popen(cmd).read()
import subprocess
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
if (err is not None) and err!="":
raise Exception(err)
print out
try:
return int(out[out.find("ID=") +3 : ])
except:
print out
###################################################################################################
# Pseudo-devices
###################################################################################################
###################################################################################################
# Camera server
###################################################################################################
def wait_cam_server_message(number_messages = 1, timeout = 10000):
for i in range (number_messages):
if not cam_server.stream.waitCacheChange(timeout):
raise Exception("Timeout receiving from camera server")
def get_cam_server_stats(number_images=1, async = True, interval=-1, good_region = False):
ret = []
wait_cam_server_message()
prefix = "gr_" if good_region else ""
for ident in [prefix+"x_center_of_mass", prefix+"y_center_of_mass", prefix+"x_rms", prefix+"y_rms"]:
child = cam_server.stream.getChild(ident)
av = create_averager(child, number_images, interval)
av.monitored = async
ret.append(av)
return ret
def wait_cam_server_background(background, timeout = 10000):
start = time.time()
while True:
processing_parameters = cam_server.getProcessingParameters()
if (processing_parameters is not None) and (str(background) == processing_parameters["image_background"]):
return
if (time.time()-start) > timeout/1000:
raise Exception("Timeout waiting for camera server background: " + str(background))
time.sleep(0.01)

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XMOT125:SA_MOT3:DRIVE", -90.0, -10.0, 1.0 ] ], [ [ "CamServer", "http://sf-daqsync-01:8889/SARES12-CAMS128-M1_sp1 y_profile", 50, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.5, false, false, true, true, "rotation_scan_002", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

0
script/t0 scan Normal file
View File

10
script/test/Loading.py Normal file
View File

@@ -0,0 +1,10 @@
s=get_context().setup
s.expandPath("{plugins}/ScreenPanel4.class")
name=s.expandPath("{plugins}/ScreenPanel4.class")
import java.io.File as File
f=File(name)
f.exists()
f.getPath()
import ch.psi.utils.Loader as Loader
c=Loader.loadClass(f.getPath())
print c

View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Device", "dummy_motor", 0.0, 4.0, 1 ] ], [ [ "CamServer", "http://sf-daqsync-01:8889/SLG-LCAM-C041_sp1 y_profile", 1, 0, "Enabled" ] ], false, [ ], "", 1, 1.0, 0.5, false, false, true, true, "", "", " ", "", 0, null, null, "Positioner", false, true ]

1
script/testEdwinChris Normal file
View File

@@ -0,0 +1 @@
[ "Change event series", [ ], [ [ "Stream", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 1, 0 ], [ "Channel", "SLAAR11-LSCP1-FNS:CH0:VAL_GET", 1, 0 ] ], [ [ "domain_axis", "'SLAAR11-LSCP1-FNS:CH0:VAL_GET'" ] ], [ ], "", 30000, 300.0, 0.0, false, false, true, true ]

1
script/tgfrog.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMTS-FROG1:DRIVE", -0.03, 0.0, 100.0 ] ], [ [ "Channel", "SLAAR11-LSPC-SPEC1:SPECTRUM", 200, 0.001, "Enabled" ], [ "Channel", "SLAAR11-LMTS-FROG1:MOTRBV", 1, 0.001, "Domain" ] ], false, [ ], "", 1, 1.0, 0.0, false, false, true, true, "/sf/alvra/data/p17589/res/frog/scan_frog_nopa_117.h5", "", "", "", 0, null, null, "Positioner", true, true ]

1
script/time zero.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M451:MOTOR_1.VAL", 146.53, 146.7, 0.002 ] ], [ [ "Channel", " SLAAR11-LSCP1-FNS:CH0:VAL_GET", 100, 0.02, "Enabled" ], [ "Channel", "SLAAR11-LSCP1-FNS:CH2:VAL_GET", 100, 0.02, "Enabled" ], [ "Channel", "SAROP11-CVME-PBPS2:Lnk9Ch12-DATA-SUM", 100, 0.02, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "2605time_zero_003", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

1
script/timing yag.scan Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SARES11-XICM125:ROX1:DRIVE", -1.08, -1.208, 0.002 ], [ "Channel", "SARES11-XICM125:ROY1:DRIVE", 0.458, 0.658, 0.002 ] ], [ [ "Stream", "PID", 1, 0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH3:VAL_GET", 10, -1.0, "Enabled" ], [ "Stream", "SLAAR11-LSCP1-FNS:CH1:VAL_GET", 10, -1.0, "Enabled" ] ], false, [ ], "", 1, 0.0, 0.1, false, false, true, true, "pinhole_scan", "", "Default", "h5", 0, null, null, "Positioner", false, true ]

View File

@@ -0,0 +1,30 @@
Eph1 = 2.147 # actual photon energy
Eph2 = 2.152 # desired photon energy
do_elog = True
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09","SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
K1, K2 = {}, {}
for und in undlist:
K = caget(und + "-UIND030:K_SET")
K1[und] = K
K2[und] = ((Eph1 / Eph2 * (K**2 + 2) - 2))**0.5
# set laser on-delay
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel",1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
if Eph2 < Eph1 :
for und in undlist: caput(und + "-UIND030:K_SET", 0.07)
time.sleep(40.0)
for und in undlist: caput(und + "-UIND030:K_SET", K2[und])
time.sleep(20.0)
# set laser on-beam
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel",0)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
#Elog entry
if do_elog:
title = "Wavelength change"
log_msg = "Old photon energy: %0.2f" % Eph1 + " kev\n"
log_msg = log_msg + "New photon energy: %0.2f" % Eph2 + " keV\n"
elog(title, log_msg)

0
script/unknown_PALM Normal file
View File

1
script/unknown_PALM_2 Normal file
View File

@@ -0,0 +1 @@
[ "Linear", [ [ "Channel", "SLAAR11-LMOT-M423:MOT.VAL", 70.0, 71.5, 0.02 ] ], [ [ "Channel", "SAROP11-PALMK118:CH2_BUFFER", 20, 0.04, "Enabled" ] ], false, [ ], "", 1, 1.0, 1.0, false, false, true, true, "", "", " ", " ", 0, null, null, "Positioner", false, true ]