Update scripts and plugins to 2.0

This commit is contained in:
2025-08-04 12:38:24 +02:00
parent b45d3b4202
commit b631d4c589
44 changed files with 347 additions and 350 deletions

View File

@@ -1,67 +1,74 @@
#Thu Jul 31 10:11:47 CEST 2025
#Thu Jul 31 10:58:50 CEST 2025
autoSaveScanData=true
simulation=false
xscanCrlogicChannel=null
dataScanSaveOutput=false
userAuthenticator=
dataScanSaveScript=false
notifiedTasks=EigerAbsSpec|Eiger2Img
parallelInitialization=true
fdaSerialization=true
dataTransferPath=~/Data1
scanStreamingPort=-1
xscanAppendSuffix=true
saveConsoleSessionFiles=false
devicePoolFile={config}/devices.properties
hostName=null
disableEmbeddedAttributes=false
serverPort=8080
versionTrackingEnabled=true
dataPath={data}/{year}_{month}/{date}/{date}_{seq}%04d_{name}
serverEnabled=false
depthDimension=0
logLevel=Fine
dataLayout=table
disableDataFileLogs=false
dataScanSaveTimestamps=false
sessionHandling=On
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=false
notificationLevel=Completion
terminalPort=3579
dataTransferUser=
xscanContinuousUpdate=false
versionTrackingLogin={context}/pshell_user
noBytecodeFiles=false
versionTrackingRemote=https\://gitea.psi.ch/pshell_config/x11ma.git
dataScanLazyTableCreation=false
pythonHome=
xscanMoveTimeout=600
imageSourcesFile={config}/imaging.properties
commandExecutionEvents=true
logDaysToLive=7
xscanCrlogicSimulated=false
logLevelConsole=Off
filePermissionsConfig=Public
scanStreamerPort=-1
dataScanSaveSetpoints=false
versionTrackingManual=true
dataTransferMode=Off
userManagement=true
instanceName=SIM
dataServerPort=-1
hideServerMessages=false
dataScanReleaseRecords=false
dataScanPreserveTypes=false
createSessionFiles=false
dataDepthDimension=0
dataFormat=tiff
dataLayout=table
dataPath={data}/{year}_{month}/{date}/{date}_{seq}%04d_{name}
dataScanAutoSave=true
dataScanFlushRecords=true
logPath={logs}/{date}_{time}
dataScanLazyTableCreation=false
dataScanPreserveTypes=false
dataScanReleaseRecords=false
dataScanSaveLogs=true
dataScanSaveOutput=false
dataScanSaveScript=false
dataScanSaveSetpoints=false
dataScanSaveTimestamps=false
dataScanStreamerPort=-1
dataServerPort=-1
dataTransferMode=Off
dataTransferPath=~/Data1
dataTransferUser=
depthDimension=0
devicePoolFile={config}/devices.properties
deviceUpdateStrategyFile={config}/update.properties
disableDataFileLogs=false
disableEmbeddedAttributes=false
fdaSerialization=true
filePermissionsConfig=Public
filePermissionsData=Default
filePermissionsLogs=Public
filePermissionsScripts=Public
xscanCrlogicPrefix=null
tasksFile={config}/tasks.properties
filePermissionsData=Default
xscanCrlogicAbortable=true
createSessionFiles=false
dataProvider=tiff
xscanCrlogicIoc=null
hideServerMessages=false
hostName=null
imageSourcesFile={config}/imaging.properties
instanceName=SIM
logDaysToLive=7
logLevel=Fine
logLevelConsole=Off
logPath={logs}/{date}_{time}
noBytecodeFiles=false
notificationLevel=Completion
notificationTasks=EigerAbsSpec|Eiger2Img
notifiedTasks=
parallelInitialization=true
pythonHome=
pythonNoBytecodeFiles=false
saveCommandStatistics=false
saveConsoleSessionFiles=false
scanStreamerPort=-1
serverCommandsHidden=false
serverEnabled=false
serverHostName=null
serverPort=8080
sessionHandling=On
simulation=false
tasksFile={config}/tasks.properties
terminalEnabled=false
terminalPort=3579
userAuthenticator=
userManagement=true
versionTrackingEnabled=true
versionTrackingLogin={context}/pshell_user
versionTrackingManual=true
versionTrackingRemote=https\://gitea.psi.ch/pshell_config/x11ma.git
xscanAppendSuffix=true
xscanContinuousUpdate=false
xscanCrlogicAbortable=true
xscanCrlogicChannel=null
xscanCrlogicIoc=null
xscanCrlogicPrefix=null
xscanCrlogicSimulated=false
xscanMoveTimeout=600

View File

@@ -1,29 +1,29 @@
#Thu Jul 31 09:47:37 CEST 2025
RSYNC_USER=
OUTLIERS_THRESHOLD=1000000000
AUTO_SWITCH_VALVE=false
NORM_FILE=/sls/X11MA/data/e20816/Data1/2023_06/20230615/654
DRY_RUN=true
POL_ID_2=Circ_Minus
OFFSET_ID_2=-2.0
ID=PGM_ID2
proposal=proposal
ENERGY=565
proposer=proposer
image_shift_angle=1.0963912950426833
POS_H_DIR=POS
RSYNC_HOST=
sample=sample
RSYNC_PATH=
AUTO_SWITCH_BEAMLINE=false
pgroup=pgroup
POS_V_DIR=POS
AUTO_SWITCH_SHUTTER=true
#Mon Aug 04 12:37:53 CEST 2025
ALPHA_ID_2=0.0
TILT_H_DIR=POS
RSYNC_DEL=true
image_shift_scale=3.296579966879864
AUTO_SWITCH_BEAMLINE=false
AUTO_SWITCH_SHUTTER=true
AUTO_SWITCH_VALVE=false
AVERAGING_DETECTOR=true
DRY_RUN=true
ENERGY=565
FdaBrowser=false
authors=author1|author2
HARMONIC_ID_2=1
ID=PGM_ID2
NORM_FILE=/sls/X11MA/data/e20816/Data1/2023_06/20230615/654
OFFSET_ID_2=-2.0
OUTLIERS_THRESHOLD=1000000000
POL_ID_2=Circ_Minus
POS_H_DIR=POS
POS_V_DIR=POS
RSYNC_DEL=true
RSYNC_HOST=
RSYNC_PATH=
RSYNC_USER=
TILT_H_DIR=POS
authors=author1|author2
image_shift_angle=1.0963912950426833
image_shift_scale=3.296579966879864
pgroup=pgroup
proposal=proposal
proposer=proposer
sample=sample

View File

@@ -9,8 +9,8 @@ import ij.io.SaveDialog;
import java.util.ArrayList;
import java.io.IOException;
import java.io.File;
import jmatio.types.*;
import jmatio.io.*;
import com.jmatio.types.*; //jmatio.types.*;
import com.jmatio.io.*; //jmatio.io.*;
import ij.gui.GenericDialog;
import ij.IJ;
import ij.Prefs;

View File

@@ -42,7 +42,7 @@
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
<Component id="panelBeamline" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" pref="326" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="checkDryMode" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -635,7 +635,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="7" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="jPanel4" max="32767" attributes="0"/>

View File

@@ -1,10 +1,11 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.sequencer.Interpreter;
import ch.psi.pshell.swing.DeviceValuePanel;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.Arr;
import ch.psi.utils.State;
import ch.psi.utils.Str;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.pshell.utils.Arr;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.utils.Str;
import ch.psi.pshell.swing.SwingUtils;
import java.awt.Component;
import java.awt.Font;
import java.io.IOException;
@@ -197,13 +198,13 @@ public class Beamline extends Panel {
args.put("CFF", spinnerCff.getValue());
}
void applyBeamline() throws Context.ContextStateException {
void applyBeamline() throws Interpreter.InterpreterStateException {
HashMap args = new HashMap();
setBeamlineArgs(args);
runAsync("templates/SetupBeamline", args).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
if ((t != null) && (!Context.isAborted())) {
showException((Exception) t);
}
return t;

View File

@@ -1,6 +1,6 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.utils.State;
import javax.swing.JButton;
/**

View File

@@ -2,9 +2,9 @@
import ch.psi.pshell.epics.GenericChannel;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.pshell.swing.RegisterPanel;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.StripChart;
import ch.psi.utils.State;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.stripchart.StripChart;
import ch.psi.pshell.utils.State;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;

View File

@@ -385,7 +385,7 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.imaging.Renderer" name="rendererRoi">
<Component class="ch.psi.pshell.imaging.DeviceRenderer" name="rendererRoi">
<Properties>
<Property name="deviceName" type="java.lang.String" value="image"/>
<Property name="mode" type="ch.psi.pshell.imaging.RendererMode" editor="org.netbeans.modules.form.editors.EnumEditor">

View File

@@ -1,18 +1,21 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.console.App;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays.Rect;
import ch.psi.pshell.imaging.Pen;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.imaging.RendererListener;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.Arr;
import ch.psi.utils.IO;
import ch.psi.utils.Serializer;
import ch.psi.utils.State;
import ch.psi.utils.Str;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.imaging.DeviceRenderer;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.sequencer.Interpreter;
import ch.psi.pshell.utils.Arr;
import ch.psi.pshell.utils.IO;
import ch.psi.pshell.utils.Serializer;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.SwingUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@@ -71,10 +74,10 @@ public class DataAcquisition extends Panel {
static String DEFAULT_PATH = "{data}/{year}_{month}/{date}_{seq}%03d";
final String ABSORTION_SPECTRUM_PATH = Setup.getConfigPath() + "/AbsortionSpectrum";
final String ABSORTION_SPECTRUM_EXT = "abs";
final String ROIS_PATH = Setup.getConfigPath() + "/ROIs";
final String ROIS_EXT = "roi";
final Component[] parameterControls;
@@ -108,7 +111,7 @@ public class DataAcquisition extends Panel {
}
@Override
@Override
public void onDeleted(Renderer renderer, Overlay overlay){
if (rois.contains(overlay)) {
rois.remove(overlay);
updateRoiList();
@@ -367,7 +370,7 @@ public class DataAcquisition extends Panel {
rendererRoi.abortSelection();
}
void run2Images() throws Interpreter.InterpreterStateException {
HashMap args = new HashMap();
args.put("METHOD", comboImgMethod.getSelectedItem());
@@ -384,7 +387,7 @@ public class DataAcquisition extends Panel {
args.put("NUMBER_SCANS", (comboImgMethod.getSelectedItem() == ImgMethod.Take_Image.toString()) ? ((Integer)spinnerScans.getValue()) : 1 );
runAsync("templates/Eiger2Img", args).handle((ret, t) -> {
runAsync("templates/Eiger2Img", args).handle((ret, t) -> {
if ((t != null) && (!Context.isAborted())) {
showException((Exception) t);
}
return t;
@@ -414,7 +417,7 @@ public class DataAcquisition extends Panel {
return ranges;
}
void runAbsSpectrum() throws Interpreter.InterpreterStateException {
HashMap args = new HashMap();
args.put("SAVE_SPECTRUM", checkSpecSaveSpectrum.isSelected());
args.put("SAVE_IMAGES", checkSpecSaveImages.isSelected());
@@ -428,7 +431,7 @@ public class DataAcquisition extends Panel {
args.put("ROI", getRois());
runAsync("templates/EigerAbsSpec", args).handle((ret, t) -> {
runAsync("templates/EigerAbsSpec", args).handle((ret, t) -> {
if ((t != null) && (!Context.isAborted())) {
showException((Exception) t);
}
return t;
@@ -451,12 +454,12 @@ public class DataAcquisition extends Panel {
}
}
void enableNorm(boolean enabled) throws Interpreter.InterpreterStateException {
if (!enabled) {
removeNorm();
} else {
runAsync("devices/norm", null).handle((ret, t) -> {
runAsync("devices/norm", null).handle((ret, t) -> {
if ((t != null) && (!Context.isAborted())) {
showException((Exception) t);
}
JDialog dlg = App.getInstance().getDevicePanelManager().getPanelDialog("norm");
@@ -491,9 +494,9 @@ public class DataAcquisition extends Panel {
args.put("E2", e2);
args.put("TIME", (Double) spinnerTime.getValue());
args.put("DELAY", (Double) spinnerDelay.getValue());
args.put("DELAY", (Double) spinnerDelay.getValue());
String file = Setup.expandPath("ImageOTF");
args.put("FILE", file);
args.put("FILE", file);
String folder = Setup.expandPath("{year}_{month}/{date}");
args.put("FOLDER", folder);
args.put("ROI", getRois());
args.put("EXPOSURE", spinnerImgOTFExp.getValue());
@@ -540,7 +543,7 @@ public class DataAcquisition extends Panel {
radioAvDetector = new javax.swing.JRadioButton();
radioAvPshell = new javax.swing.JRadioButton();
panelRoi = new javax.swing.JPanel();
panelRoi = new javax.swing.JPanel();
rendererRoi = new ch.psi.pshell.imaging.DeviceRenderer();
jLabel26 = new javax.swing.JLabel();
buttonRoiAdd = new javax.swing.JButton();
buttonRoiRemove = new javax.swing.JButton();
@@ -1579,7 +1582,7 @@ public class DataAcquisition extends Panel {
private void buttonImgAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonImgAbortActionPerformed
try {
try {
Context.abort();
} catch (Exception ex) {
showException(ex);
}
@@ -1603,7 +1606,7 @@ public class DataAcquisition extends Panel {
private void buttonSpecAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSpecAbortActionPerformed
try {
try {
Context.abort();
} catch (Exception ex) {
showException(ex);
}
@@ -1630,7 +1633,7 @@ public class DataAcquisition extends Panel {
private void buttonSetNormActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetNormActionPerformed
try {
try {
JFileChooser chooser = new JFileChooser(Setup.expandPath(App.getInstance().getConfig().dataPath));
FileNameExtensionFilter filter = new FileNameExtensionFilter("Image File", "tif", "tiff");
chooser.setFileFilter(filter);
chooser.setFileHidingEnabled(true);
@@ -1664,7 +1667,7 @@ public class DataAcquisition extends Panel {
private void textSelectOutliersMaskActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textSelectOutliersMaskActionPerformed
try {
try {
JFileChooser chooser = new JFileChooser(Setup.expandPath(App.getInstance().getConfig().dataPath));
FileNameExtensionFilter filter = new FileNameExtensionFilter("Image File", "tif", "tiff");
chooser.setFileFilter(filter);
chooser.setFileHidingEnabled(true);
@@ -1910,7 +1913,7 @@ public class DataAcquisition extends Panel {
private javax.swing.JPanel panelSpectrum;
private javax.swing.JRadioButton radioAvDetector;
private javax.swing.JRadioButton radioAvPshell;
private javax.swing.JRadioButton radioAvPshell;
private ch.psi.pshell.imaging.DeviceRenderer rendererRoi;
private javax.swing.JSpinner spinnerDelay;
private javax.swing.JSpinner spinnerE1;
private javax.swing.JSpinner spinnerE2;

View File

@@ -8,19 +8,12 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.DsvEditor;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.nio.file.Files;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.framework.Setup;
/**
*
@@ -55,7 +48,7 @@ public class DelayScan extends Panel {
}
Path getConfigFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
return Paths.get(Setup.getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;

View File

@@ -69,49 +69,53 @@
<Component id="comboRunType" min="-2" pref="58" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="spinnerOffset1" min="-2" pref="76" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="jLabel13" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerOffset2" linkSize="5" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jLabel17" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="spinnerOffset1" min="-2" pref="76" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="jLabel13" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerOffset2" linkSize="5" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSize" min="-2" pref="80" max="-2" attributes="0"/>
<Component id="spinnerEnd" alignment="0" min="-2" pref="80" max="-2" attributes="0"/>
<Component id="spinnerStart" alignment="1" min="-2" pref="80" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSize" min="-2" pref="80" max="-2" attributes="0"/>
<Component id="spinnerEnd" alignment="0" min="-2" pref="80" max="-2" attributes="0"/>
<Component id="spinnerStart" alignment="1" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel4" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel18" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerAcqTime" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerFineDelay" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerDelay" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel4" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel18" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerAcqTime" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerFineDelay" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerDelay" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRounds" linkSize="5" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerRounds" linkSize="5" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>

View File

@@ -8,12 +8,12 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.ui.Panel;
import java.util.logging.Logger;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.framework.Setup;
/**
@@ -49,7 +49,7 @@ public class DelayScanBase extends Panel {
}
Path getConfigFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
return Paths.get(Setup.getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;

View File

@@ -172,7 +172,7 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.imaging.Renderer" name="renderer">
<Component class="ch.psi.pshell.imaging.DeviceRenderer" name="renderer">
<Properties>
<Property name="deviceName" type="java.lang.String" value="image"/>
<Property name="mode" type="ch.psi.pshell.imaging.RendererMode" editor="org.netbeans.modules.form.editors.EnumEditor">

View File

@@ -1,8 +1,8 @@
import ch.psi.pshell.epics.ChannelDouble;
import ch.psi.pshell.epics.ChannelInteger;
import ch.psi.pshell.imaging.ColormapSource;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.utils.State;
import java.io.IOException;
import java.util.logging.Level;
import java.util.concurrent.TimeUnit;
@@ -113,7 +113,7 @@ public class Eiger extends Panel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
renderer = new ch.psi.pshell.imaging.Renderer();
renderer = new ch.psi.pshell.imaging.DeviceRenderer();
jLabel1 = new javax.swing.JLabel();
comboDepth = new javax.swing.JComboBox<>();
jLabel2 = new javax.swing.JLabel();
@@ -612,7 +612,7 @@ public class Eiger extends Panel {
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private ch.psi.pshell.imaging.Renderer renderer;
private ch.psi.pshell.imaging.DeviceRenderer renderer;
private javax.swing.JSpinner spinnerExposure;
private javax.swing.JSpinner spinnerMax;
private javax.swing.JSpinner spinnerMin;

View File

@@ -8,18 +8,18 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.DsvEditor;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.swing.DsvEditor;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.nio.file.Files;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
/**
@@ -61,7 +61,7 @@ public class EnergyScan extends Panel {
}
Path getConfigFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
return Paths.get(Setup.getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;

View File

@@ -8,12 +8,13 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.framework.Setup;
import java.util.logging.Logger;
/**
@@ -54,7 +55,7 @@ public class EnergyScanBase extends Panel {
}
Path getConfigFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
return Paths.get(Setup.getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;

View File

@@ -8,18 +8,18 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.DsvEditor;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.swing.DsvEditor;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.nio.file.Files;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
/**
@@ -61,7 +61,7 @@ public class EnergyScan_TBT extends Panel {
}
Path getConfigFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
return Paths.get(Setup.getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;

View File

@@ -60,7 +60,7 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.imaging.Renderer" name="renderer">
<Component class="ch.psi.pshell.imaging.DeviceRenderer" name="renderer">
<Properties>
<Property name="mode" type="ch.psi.pshell.imaging.RendererMode" editor="org.netbeans.modules.form.editors.EnumEditor">
<Value id="Stretch"/>

View File

@@ -1,10 +1,11 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays.Rect;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.imaging.DeviceRenderer;
import ch.psi.pshell.imaging.RendererListener;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.imaging.Renderer;
import ch.psi.pshell.utils.State;
import java.awt.Rectangle;
import java.util.HashMap;
@@ -135,7 +136,7 @@ public class Imaging extends Panel {
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
renderer = new ch.psi.pshell.imaging.Renderer();
renderer = new ch.psi.pshell.imaging.DeviceRenderer();
jPanel4 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
buttonStartAutoIntensity = new javax.swing.JButton();
@@ -712,7 +713,7 @@ public class Imaging extends Panel {
", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) +
")";
this.evalAsync(cmd).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
if ((t != null) && (!Context.isAborted())) {
showException((Exception) t);
}
return t;
@@ -807,7 +808,7 @@ public class Imaging extends Panel {
", exposure=" + (Double.isNaN(exposure) ? "None" : exposure) +
")";
this.evalAsync(cmd).handle((ret, t) -> {
if ((t != null) && (!getContext().isAborted())) {
if ((t != null) && (!Context.isAborted())) {
showException((Exception) t);
}
return t;
@@ -868,7 +869,7 @@ public class Imaging extends Panel {
private javax.swing.JRadioButton radioObjective;
private javax.swing.JRadioButton radioStigA;
private javax.swing.JRadioButton radioStigB;
private ch.psi.pshell.imaging.Renderer renderer;
private ch.psi.pshell.imaging.DeviceRenderer renderer;
private javax.swing.JSpinner spinnerAverage;
private javax.swing.JSpinner spinnerExposition;
private javax.swing.JSpinner spinnerExpositionIntensity;

View File

@@ -1,5 +1,6 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.framework.Panel;
import javax.swing.JButton;
/*
@@ -65,7 +66,7 @@ public class Initialization extends Panel {
if (ex != null) {
showException((Exception) ex);
} else {
getContext().scriptingLog(String.format("Shell command '%s' return value: %s", shellCommand, String.valueOf(ret)));
Context.getInterpreter().scriptingLog(String.format("Shell command '%s' return value: %s", shellCommand, String.valueOf(ret)));
}
return ret;
});

View File

@@ -8,12 +8,13 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.logging.Level;
import javax.swing.JLabel;
import ch.psi.utils.State;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.Editor.EditorDialog;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.framework.Setup;
import java.util.logging.Logger;
/**
@@ -54,7 +55,7 @@ public class OTFScanBase extends Panel {
}
Path getConfigFile() {
return Paths.get(getContext().getSetup().getConfigPath(), "energy_scan.properties");
return Paths.get(Setup.getConfigPath(), "energy_scan.properties");
}
LinePlotBase scanPlot;

View File

@@ -1,10 +1,13 @@
import ch.psi.pshell.core.Configuration.NotificationLevel;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.utils.swing.SwingUtils.OptionResult;
import ch.psi.utils.swing.SwingUtils.OptionType;
import ch.psi.pshell.console.App;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.notification.NotificationManager.NotificationLevel;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.SwingUtils;
import ch.psi.pshell.swing.SwingUtils.OptionResult;
import ch.psi.pshell.swing.SwingUtils.OptionType;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -30,7 +33,7 @@ public class Settings extends Panel {
SwingUtilities.invokeLater(() -> {
undo();
});
textNamePattern.setText(getContext().getConfig().dataPath);
textNamePattern.setText(App.getInstance().getConfig().dataPath);
}
@Override
@@ -50,12 +53,12 @@ public class Settings extends Panel {
void undo() {
try {
textDataPath.setText(getContext().getSetup().expandPath(getContext().getConfig().dataPath));
textPGroup.setText(getContext().getSetting("pgroup") == null ? "" : getContext().getSetting("pgroup"));
textProposal.setText(getContext().getSetting("proposal") == null ? "" : getContext().getSetting("proposal"));
textProposer.setText(getContext().getSetting("proposer") == null ? "" : getContext().getSetting("proposer"));
textSamples.setText(getContext().getSetting("sample") == null ? "" : getContext().getSetting("sample"));
textAuthors.setText(getContext().getSetting("authors") == null ? "" : getContext().getSetting("authors").replace("|", "\n"));
textDataPath.setText(Setup.expandPath(App.getInstance().getConfig().dataPath));
textPGroup.setText(Context.getSetting("pgroup") == null ? "" : Context.getSetting("pgroup"));
textProposal.setText(Context.getSetting("proposal") == null ? "" : Context.getSetting("proposal"));
textProposer.setText(Context.getSetting("proposer") == null ? "" : Context.getSetting("proposer"));
textSamples.setText(Context.getSetting("sample") == null ? "" : Context.getSetting("sample"));
textAuthors.setText(Context.getSetting("authors") == null ? "" : Context.getSetting("authors").replace("|", "\n"));
} catch (Exception ex) {
getLogger().log(Level.SEVERE, null, ex);
}
@@ -71,11 +74,11 @@ public class Settings extends Panel {
String samples = textSamples.getText().trim();
String authors = textAuthors.getText().trim().replace("\n", "|");
getContext().setSetting("pgroup", pgroup);
getContext().setSetting("proposal", proposal);
getContext().setSetting("proposer", proposer);
getContext().setSetting("sample", samples);
getContext().setSetting("authors", authors);
Context.setSetting("pgroup", pgroup);
Context.setSetting("proposal", proposal);
Context.setSetting("proposer", proposer);
Context.setSetting("sample", samples);
Context.setSetting("authors", authors);
} catch (Exception ex) {
getLogger().log(Level.SEVERE, null, ex);
@@ -134,8 +137,8 @@ public class Settings extends Panel {
void updateNotify() {
try {
updatingControls = true;
comboNotification.setSelectedItem(getContext().getConfig().notificationLevel);
textRecipients.setText(getContext().getNotificationManager().getConfig().to);
comboNotification.setSelectedItem(App.getInstance().getConfig().notificationLevel);
textRecipients.setText(Context.getNotificationManager().getConfig().to);
} finally {
updatingControls = false;
}
@@ -148,14 +151,14 @@ public class Settings extends Panel {
textNamePattern.setEnabled(editable);
spinnerSeq.setEnabled(editable);
buttonDefaultPath.setEnabled(editable && !textNamePattern.getText().equals(DEFAULT_PATH));
buttonSetPath.setEnabled(editable && !textNamePattern.getText().equals(getContext().getConfig().dataPath));
buttonUndoPath.setEnabled(editable && !textNamePattern.getText().equals(getContext().getConfig().dataPath));
buttonSetSeq.setEnabled(editable && !spinnerSeq.getValue().equals(getContext().getFileSequentialNumber()));
buttonUndoSeq.setEnabled(editable && !spinnerSeq.getValue().equals(getContext().getFileSequentialNumber()));
buttonSetPath.setEnabled(editable && !textNamePattern.getText().equals(App.getInstance().getConfig().dataPath));
buttonUndoPath.setEnabled(editable && !textNamePattern.getText().equals(App.getInstance().getConfig().dataPath));
buttonSetSeq.setEnabled(editable && !spinnerSeq.getValue().equals(Context.getFileSequentialNumber()));
buttonUndoSeq.setEnabled(editable && !spinnerSeq.getValue().equals(Context.getFileSequentialNumber()));
buttonApply.setEnabled(editable);
spinnerSeq.setValue(getContext().getFileSequentialNumber());
textDataPath.setText(getContext().getSetup().expandPath(getContext().getConfig().dataPath));
spinnerSeq.setValue(Context.getFileSequentialNumber());
textDataPath.setText(Setup.expandPath(App.getInstance().getConfig().dataPath));
}
@SuppressWarnings("unchecked")
@@ -673,7 +676,7 @@ public class Settings extends Panel {
private void buttonSetSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetSeqActionPerformed
try {
getContext().setFileSequentialNumber(((Number) spinnerSeq.getValue()).intValue());
Context.setFileSequentialNumber(((Number) spinnerSeq.getValue()).intValue());
updateControls();
} catch (Exception ex) {
showException(ex);
@@ -682,7 +685,7 @@ public class Settings extends Panel {
private void buttonUndoSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoSeqActionPerformed
try {
spinnerSeq.setValue(getContext().getFileSequentialNumber());
spinnerSeq.setValue(Context.getFileSequentialNumber());
updateControls();
} catch (Exception ex) {
showException(ex);
@@ -696,8 +699,8 @@ public class Settings extends Panel {
private void buttonSetPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetPathActionPerformed
try {
getContext().getConfig().dataPath = textNamePattern.getText();
getContext().getConfig().save();
App.getInstance().getConfig().dataPath = textNamePattern.getText();
App.getInstance().getConfig().save();
updateControls();
} catch (Exception ex) {
showException(ex);
@@ -706,7 +709,7 @@ public class Settings extends Panel {
private void buttonUndoPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoPathActionPerformed
try {
textNamePattern.setText(getContext().getConfig().dataPath);
textNamePattern.setText(App.getInstance().getConfig().dataPath);
updateControls();
} catch (Exception ex) {
showException(ex);
@@ -830,9 +833,9 @@ public class Settings extends Panel {
throw new Exception("To enable notifications please set the recepient list.");
}
}
getContext().getConfig().notificationLevel =level;
getContext().getNotificationManager().setRecipients(to.split(";"));
getContext().getNotificationManager().initialize(); //Remove this when fix setRecipients
App.getInstance().getConfig().notificationLevel =level;
Context.getNotificationManager().setRecipients(to.split(";"));
Context.getNotificationManager().initialize(); //Remove this when fix setRecipients
} catch (Exception ex) {
showException(ex);
}

View File

@@ -3,8 +3,8 @@ import ij.io.SaveDialog;
import java.util.ArrayList;
import java.io.IOException;
import java.io.File;
import jmatio.types.*;
import jmatio.io.*;
import com.jmatio.types.*; //jmatio.types.*;
import com.jmatio.io.*; //jmatio.io.*;
import ij.gui.GenericDialog;
import ij.IJ;
import ij.Prefs;

View File

@@ -2,15 +2,8 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Context;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.script.ScriptException;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.utils.State;
/**
*

View File

@@ -1,5 +1,5 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.utils.State;
/**
*

View File

@@ -1,9 +1,10 @@
import ch.psi.pshell.core.CommandSource;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.framework.Panel;
import ch.psi.pshell.sequencer.CommandSource;
import ch.psi.pshell.sequencer.Interpreter;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.SwingUtils;
import java.awt.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -266,7 +267,7 @@ public class XPEEM_Settings extends Panel {
private void buttonRunSelectedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunSelectedActionPerformed
try {
getContext().startExecution(CommandSource.plugin, null, null,null, false);
Context.getInterpreter().startExecution(CommandSource.plugin, null, null,null, false);
new Thread(()->{
try{
if (checkSetting1.isSelected()==true){
@@ -286,8 +287,8 @@ public class XPEEM_Settings extends Panel {
getLogger().log(Level.WARNING, null, ex);
} finally{
try {
getContext().endExecution();
} catch (Context.ContextStateException ex) {
Context.getInterpreter().endExecution();
} catch (Interpreter.InterpreterStateException ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}

View File

@@ -28,7 +28,7 @@ if SHOW_COMPOSITE_IMG:
def before_read(pos, scan):
trigger_peemcam()
ProviderTIFF.setMetadata(get_diags())
FormatTIFF.setMetadata(get_diags())
def after_read(rec, scan):
x,y = rec.index%bins_x, rec.index/bins_x

View File

@@ -32,7 +32,7 @@ if SHOW_COMPOSITE_IMG:
def before_read(pos, scan):
trigger_peemcam()
ProviderTIFF.setMetadata(get_diags())
FormatTIFF.setMetadata(get_diags())
def after_read(rec, scan):
x,y = rec.index%bins_x, rec.index/bins_x

View File

@@ -24,6 +24,6 @@
#roi_contrast.read()
#image_contrast.read()
lscan([slit_motion], [image.contrast], [-10500.0], [-6500.0], [100.0], latency=0.0, relative=False, passes=1, zigzag=False, title='slit', keep=False, name='test', layout='table', provider='txt')
lscan([slit_motion], [image.contrast], [-10500.0], [-6500.0], [100.0], latency=0.0, relative=False, passes=1, zigzag=False, title='slit', keep=False, name='test', layout='table', format='txt')
#cscan([slit_motion], ['ca://X11MA-PC-ET7000:SW-K3'], [-9700.0], [-9500.0], [1.0], latency=2.0, time=1.0, relative=False, passes=1, zigzag=False, title='testslit', keep=False, name='Unknown')
#lscan([objective], ['ca://X11MA-ES1-PREP:PRESSURE'], [1475.0], [1485.0], [2.0], latency=10.0, relative=False, passes=1, zigzag=False, title='test', keep=False, name='testt', layout='default', provider='txt')
#lscan([objective], ['ca://X11MA-ES1-PREP:PRESSURE'], [1475.0], [1485.0], [2.0], latency=10.0, relative=False, passes=1, zigzag=False, title='test', keep=False, name='testt', layout='default', format='txt')

View File

@@ -25,7 +25,7 @@ abs_spec(ranges="Fe_L3_fine", roi="test", switch_pol=False, scans=1, exposure=EX
#eiger_threshold.write(7500)
#eiger.start()
#tscan(['ca://X11MA-PC-ET7000:SW-K'], points=10, interval=1.0, title='temperature', keep=False, name='tewsst', layout='table', provider='txt', auto_range=True, domain_axis='Time')
#tscan(['ca://X11MA-PC-ET7000:SW-K'], points=10, interval=1.0, title='temperature', keep=False, name='tewsst', layout='table', format='txt', auto_range=True, domain_axis='Time')
#Direct functions to change energy, pol, offset:
#change_energy(700)

View File

@@ -5,7 +5,7 @@ import ch.psi.pshell.imaging.Pen as Pen
import java.awt.Rectangle as Rectangle
import ch.psi.pshell.imaging.Data as Data
import ch.psi.pshell.device.Camera.DataType as DataType
import ch.psi.utils.Chrono as Chrono
import ch.psi.pshell.utils.Chrono as Chrono
import subprocess
#GRAB_MIN_TIME = 1000
@@ -463,10 +463,9 @@ if False:
add_device(RoiIntensity("Region1", image, 10, 5, 20, 10), True)
add_device(RoiIntensity("Region2", image, 10, 5, 40, 20), True)
import ch.psi.pshell.data.ProviderCSV as ProviderCSV
ProviderCSV.setDefaultItemSeparator(" ")
tscan((Region1, Region2), 10, 0.1, layout="table", provider = "csv")
FormatCSV.setDefaultItemSeparator(" ")
tscan((Region1, Region2), 10, 0.1, layout="table", format = "csv")
ret = grab_frames(image, 10, sleep=0.1)
av = integrate_frames(ret)

View File

@@ -39,9 +39,9 @@ def load_corr_stack(title="Corr", show=False):
return load_stack(title, file_list, show)
def instantiate_dynamic_class(name):
if get_context().getPluginManager().getDynamicClass(name) is None:
get_context().getPluginManager().loadInitializePlugin(name + ".java")
return get_context().getClassByName(name).newInstance()
if get_plugin_manager().getDynamicClass(name) is None:
get_plugin_manager().loadInitializePlugin(name + ".java")
return Context.getClassByName(name).newInstance()
def complex_edge_filtering(imp, complex=True, g_sigma=3.0, g_resolution=1e-4, show=False, java_code=False):

View File

@@ -1,16 +1,5 @@
###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
import ntpath
import traceback
from rsync import *
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
from collections import OrderedDict
ProviderCSV.setDefaultItemSeparator(", ")
get_context().dataManager.createLogs=False
FormatCSV.setDefaultItemSeparator(", ")
get_data_manager().createLogs=False
IMAGING_ROI = None
@@ -226,7 +215,7 @@ def convert_file(input_file_name, output_file_name, pol = None):
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
#os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
#os.rename(input_file_name, Setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
def convert_file_full(input_file_name, output_file_name, pol = None):
print "Converting data file: " + input_file_name + " to " + output_file_name
@@ -258,7 +247,7 @@ def convert_file_full(input_file_name, output_file_name, pol = None):
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + mcurr + s + time + s + fieldx + s + fieldz + s + str(pol) + s + temp + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
#os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
#os.rename(input_file_name, Setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
###################################################################################################
#Scan commands
@@ -268,7 +257,7 @@ def otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None,
"""
if name is None:
name = get_exec_pars().name
#folder = get_context().setup.expandPath("{year}_{month}/{date}");
#folder = Setup.expandPath("{year}_{month}/{date}");
run("templates/EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf2(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None, folder = 'TEST'):
@@ -280,7 +269,7 @@ def otf2(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None
run("templates/EnergyScan_v4", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "TAG":name, "ALPHA":float(alpha) if alpha is not None else None})
def otf_img(start, end, time, delay = 0.0, exposure=0.2, roi=None, name = None, save_images=False):
folder = get_context().setup.expandPath("{year}_{month}/{date}");
folder = Setup.expandPath("{year}_{month}/{date}");
if is_string(roi):
with open(expand_path("{config}/ROIs/" + roi + ".roi"), 'rb') as f:
roi = OrderedDict()
@@ -698,12 +687,12 @@ def on_change_data_path(path):
#Sounds
###################################################################################################
def on_command_started(info):
if not get_context().isLocalMode():
if not get_interpreter().isLocalMode():
if info.script and not info.background:
play_sound("start")
def on_command_finished(info):
if not get_context().isLocalMode():
if not get_interpreter().isLocalMode():
if info.script and not info.background:
if (info.isError()):
if not info.isAborted():
@@ -712,12 +701,12 @@ def on_command_finished(info):
play_sound("success")
import ch.psi.utils.Audio as Audio
import ch.psi.pshell.utils.Audio as Audio
import java.io.File as File
def play_sound(name):
try:
Audio.playFile(File(get_context().setup.expandPath("{home}/sounds/" + name + ".wav")), False)
Audio.playFile(File(Setup.expandPath("{home}/sounds/" + name + ".wav")), False)
except:
#TODO: sound does not work when logged as e-account
if not Sys.getUserName().startswith("e"):

View File

@@ -33,12 +33,12 @@ class DataLayout( ch.psi.pshell.data.LayoutTable):
data_file = time.strftime('%Y%m%d_%H%M') + '_' + get_exec_pars().name + '_' + str(get_exec_pars().count).zfill(4)
print "Opened data file: " + get_exec_pars().path + "/" + data_file
return data_file
get_context().dataManager.setLayout(DataLayout())
get_data_manager.setLayout(DataLayout())
"""
#Reading Energy Scan configuration file
def getPars(element):
f = open(get_context().setup.getConfigPath() + '/energy_scan.properties')
f = open(Setup.getConfigPath() + '/energy_scan.properties')
try:
for line in f:
tokens = line.split("=")
@@ -157,7 +157,7 @@ def convert_file(input_file_name, output_file_name, pol = None):
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + MCurr + s + time + s + MAGX + s + MAGZ + s + str(pol) + s + EXPT + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
os.rename(input_file_name, Setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
def plot_file(file_name, title = None):
"""
@@ -171,7 +171,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom
Add entry to ELOG.
"""
if author is None:
author = "pshell" #get_context().user.name
author = "pshell" #Context.getUserName()
typ = "pshell"
entry = ""
@@ -196,7 +196,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom
raise Exception(err)
print out
def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context().setup.getContextPath()):
def get_plot_snapshots(title = None, file_type = "png", temp_path = Setup.getContextPath()):
"""
Returns list with file names of plots snapshots from a plotting context.
"""
@@ -214,12 +214,12 @@ def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context(
# Controller state listener
###################################################################################################
#class Listener(ControllerListener):
# def onControllerStateChanged(self, state, former):
#class Listener(InterpreterListener):
# def onStateChanged(self, state, former):
# global FILENAME
# if former == State.Busy:
# FILENAME = None
#get_context().addListener(Listener()) #Old listeners are cleande in startup
#get_interpreter().addListener(Listener()) #Old listeners are cleande in startup
###################################################################################################
@@ -444,7 +444,7 @@ def otf(start, end, time, delay=0.0, mode = None, offset = None, alpha = None, n
"""
if name is None:
name = get_exec_pars().name
folder = get_context().setup.expandPath("{year}_{month}/{date}");
folder = Setup.expandPath("{year}_{month}/{date}");
run("EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":alpha})
def hyst_cont(field, init_field, final_field, ramp_speed, energies):

View File

@@ -45,7 +45,7 @@ def get_image_file_name(cycle=-1, frame_index=0, short_name=False, shifted=False
frame_index = 0 if frame_index else 1
root = "" if short_name else (data_path + "/")
abs_index=run_index + frame_index
max_index= max(max_index, frame_index)
max_index= max(max_index, frame_index)
prefix = Setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,)))
if cycle < 0:
@@ -54,7 +54,7 @@ def get_image_file_name(cycle=-1, frame_index=0, short_name=False, shifted=False
ret = root + prefix + ".tif"
else:
prefix = prefix + ("_corr/c" if shifted else "/")
ret= root + prefix + "i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
ret= root + prefix + "i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
return Setup.expandPath(ret)
@@ -126,7 +126,7 @@ def save_image_file(frame, cycle=-1, frame_index=0, processed_shift=False):
threads.append(shift_and_save_as_tiff(frame, filename, ref_image, calc_roi, metadata=metadata))
init_eiger(exposure=EXPOSURE)
run_index = Context.getDaySequentialNumber()
print " ---- Run index : %d" %(run_index,)
max_index=0
@@ -244,7 +244,7 @@ try:
max_index=max_index+1
print " ---- New un index : %d" %(run_index,)
finally:
for i in range(max_index):
for i in range(max_index):
Context.incrementDaySequentialNumber()
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
close_vg10()

View File

@@ -36,12 +36,12 @@ threads = []
#path = "{data}/{year}_{month}/{date}" + "/" + "{seq}%03d_" + METHOD
#set_exec_pars(path= path, format="txt", layout="table", open=True)
#set_exec_pars(path= path, format="txt", layout="table", open=True)
#data_path = Setup.expandPath(path)
data_path = "{data}/{year}_{month}/{date}/{date}_{name}"
set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True)
#data_path = get_exec_pars().path
Context.incrementFileSequentialNumber()
@@ -49,17 +49,17 @@ def get_image_file_name(cycle=-1, frame_index=0, short_name=False):
global max_index
if (METHOD == "Two_Pol") and (SEQUENCE == "A") and (frame_index<2) and ((cycle%2)==0): #Swapped
frame_index = 0 if frame_index else 1
root = "" if short_name else (data_path + "/")
root = "" if short_name else (data_path + "/")
#prefix = Setup.expandPath("i{seq}%03d" + "_" + ("%d" % frame_index))
abs_index=run_index + frame_index
max_index= max(max_index, frame_index)
#prefix = get_context().setup.expandPath("i{date}%02d_{seq}%03d")
max_index= max(max_index, frame_index)
#prefix = Setup.expandPath("i{date}%02d_{seq}%03d")
prefix = Setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,)))
if cycle < 0:
ret = root + prefix + ".tif"
else:
ret= root + prefix + "/i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
ret= root + prefix + "/i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
return Setup.expandPath(ret)
@@ -102,7 +102,7 @@ def save_image_file(frame, cycle=-1, frame_index=0):
# log("SV:"+Format(startvoltage,"0.000")+" OB:"+Format(objective,"0.00")+" ST:"+Format(LEEMtemp,"0.0"))
init_eiger(exposure=EXPOSURE)
run_index = Context.getDaySequentialNumber()
print " ---- Run index : %d" %(run_index,)
max_index=0
@@ -213,7 +213,7 @@ try:
#SWITCH_POL = False
#set_exec_pars(then_success="run('templates/Eiger2Img')")
"""
"""
Context.incrementDaySequentialNumber()
set_exec_pars(open=False)
set_exec_pars(open=True)
@@ -234,7 +234,7 @@ try:
max_index=max_index+1
print " ---- New un index : %d" %(run_index,)
finally:
for i in range(max_index):
for i in range(max_index):
Context.incrementDaySequentialNumber()
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
close_vg10()

View File

@@ -36,12 +36,12 @@ threads = []
#path = "{data}/{year}_{month}/{date}" + "/" + "{seq}%03d_" + METHOD
#set_exec_pars(path= path, format="txt", layout="table", open=True)
#set_exec_pars(path= path, format="txt", layout="table", open=True)
#data_path = Setup.expandPath(path)
data_path = "{data}/{year}_{month}/{date}/{date}_{name}"
set_exec_pars(name=METHOD, path = data_path, format="txt", layout="table", open=True)
#data_path = get_exec_pars().path
#Context.incrementFileSequentialNumber()
@@ -49,17 +49,17 @@ def get_image_file_name(cycle=-1, frame_index=0, short_name=False):
global max_index
if (METHOD == "Two_Pol") and (SEQUENCE == "A") and (frame_index<2) and ((cycle%2)==0): #Swapped
frame_index = 0 if frame_index else 1
root = "" if short_name else (data_path + "/")
root = "" if short_name else (data_path + "/")
#prefix = Setup.expandPath("i{seq}%03d" + "_" + ("%d" % frame_index))
abs_index=run_index + frame_index
max_index= max(max_index, frame_index)
#prefix = get_context().setup.expandPath("i{date}%02d_{seq}%03d")
max_index= max(max_index, frame_index)
#prefix = Setup.expandPath("i{date}%02d_{seq}%03d")
prefix = Setup.expandPath("i{date}%02d_" + ("%03d" % (abs_index,)))
if cycle < 0:
ret = root + prefix + ".tif"
else:
ret= root + prefix + "/i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
ret= root + prefix + "/i{date}%02d"+ ("_%03d#%03d" % (abs_index,cycle)) + ".tif"
return Setup.expandPath(ret)
@@ -101,7 +101,7 @@ def save_image_file(frame, cycle=-1, frame_index=0):
# log("SV:"+Format(startvoltage,"0.000")+" OB:"+Format(objective,"0.00")+" ST:"+Format(LEEMtemp,"0.0"))
init_eiger(exposure=EXPOSURE)
run_index = Context.getDaySequentialNumber()
print " ---- Run index : %d" %(run_index,)
max_index=0
@@ -207,7 +207,7 @@ try:
#SWITCH_POL = False
#set_exec_pars(then_success="run('templates/Eiger2Img')")
"""
"""
Context.incrementDaySequentialNumber()
set_exec_pars(open=False)
set_exec_pars(open=True)
@@ -228,7 +228,7 @@ try:
max_index=max_index+1
print " ---- New un index : %d" %(run_index,)
finally:
for i in range(max_index):
for i in range(max_index):
Context.incrementDaySequentialNumber()
if not get_dry_run() and str(get_setting("AUTO_SWITCH_VALVE")).lower() == "true":
close_vg10()

View File

@@ -69,14 +69,14 @@ def grab_image(position, scan):
#Scan_Nr = (scan.recordIndex-1)/NUMBER_SCANS
#filename = get_exec_pars().path + "/" + ("%02d" % Scan_Nr) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
filename = get_exec_pars().path + "/" + str(scan.currentPass) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
filename = get_context().setup.expandPath(filename)
filename = Setup.expandPath(filename)
print filename
metadata = get_diags() if SAVE_DIAGS else {}
save_as_tiff(av, filename, metadata=metadata)
if DRIFT_CORRECTION and (calc_roi is not None):
global ref_image
filename = get_exec_pars().path + "/" + str(scan.currentPass) + "_corr/cs" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
filename = get_context().setup.expandPath(filename)
filename = Setup.expandPath(filename)
if ref_image is None:
ref_image = av
save_as_tiff(av, filename, metadata=metadata)

View File

@@ -4,7 +4,7 @@ if (get_exec_pars().source == CommandSource.ui) and (get_exec_pars().script == "
E2 = 820
TIME = 1 #min
DELAY = 0.1 #s
FOLDER = get_context().setup.expandPath("{year}_{month}/{date}")
FOLDER = Setup.expandPath("{year}_{month}/{date}")
FILE = 'ImageOTF'
ROI = {"Region1": [286, 86, 79, 70], "Region2": [153, 279, 95, 82]}
SAVE_IMAGES=True

View File

@@ -13,7 +13,7 @@ def grab_image(position, scan):
av = average_frames(frames)
if True:
filename = get_exec_pars().path + "/" + ("%03d.tif" % scan.recordIndex)
filename = get_context().setup.expandPath(filename)
filename = Setup.expandPath(filename)
print filename
save_as_tiff(av, filename, parallel=True)

View File

@@ -38,8 +38,8 @@ threads = []
path = "{data}/{year}_{month}/{date}" + "/" + "{seq}%03d_" + METHOD
set_exec_pars(path= path, format="txt", layout="table", open=True)
data_path = get_context().setup.expandPath(path)
#get_context().incrementFileSequentialNumber()
data_path = Setup.expandPath(path)
#Context.incrementFileSequentialNumber()
def get_image_file_name(cycle=-1, frame_index=0, short_name=False):
root = "" if short_name else (data_path + "/")
@@ -47,7 +47,7 @@ def get_image_file_name(cycle=-1, frame_index=0, short_name=False):
ret = root + "i"+"{seq}%03d" + "_" + ("%d" % frame_index) + ".tif"
else:
ret= root + ("%d/" % frame_index) + "i"+"{seq}%03d" + "_" + str(cycle) + ("_%d" % frame_index) + ".tif"
ret = get_context().setup.expandPath(ret)
ret = Setup.expandPath(ret)
return ret
@@ -59,7 +59,7 @@ def getLEEM():
LEEMtemp=getLEEMtemp()
"""
set_exec_pars(path= path, format="txt", layout="table", open=True)
data_path = get_context().setup.expandPath(path)
data_path = Setup.expandPath(path)

View File

@@ -67,7 +67,7 @@ def grab_image(position, scan):
#Scan_Nr = (scan.recordIndex-1)/NUMBER_SCANS
#filename = get_exec_pars().path + "/" + ("%02d" % Scan_Nr) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
filename = get_exec_pars().path + "/" + str(scan.currentPass) + "/s" + "{seq}%03d" + "_" + ("%03d.tif" % scan.recordIndex)
filename = get_context().setup.expandPath(filename)
filename = Setup.expandPath(filename)
print filename
save_as_tiff(av, filename, metadata=(get_diags() if SAVE_DIAGS else {}))

View File

@@ -28,7 +28,7 @@ if SHOW_COMPOSITE_IMG:
def before_read(pos, scan):
trigger_peemcam()
ProviderTIFF.setMetadata(get_diags())
FormatTIFF.setMetadata(get_diags())
def after_read(rec, scan):
x,y = rec.index%bins_x, rec.index/bins_x

View File

@@ -44,7 +44,7 @@ def convert_file(input_file_name, output_file_name, pol = None):
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + normtey + s + str(pol) + line_sep)
except:
traceback.print_exc()
os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
os.rename(input_file_name, Setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
"""
##################### Plotting function #############################
"""