ScrenPanel6

This commit is contained in:
root
2020-02-07 11:43:37 +01:00
parent 7f88d445af
commit f957ab5cb8
63 changed files with 12762 additions and 382 deletions
+34 -33
View File
@@ -1,39 +1,40 @@
#Mon Mar 18 10:44:11 CET 2019
autoSaveScanData=true
commandExecutionEvents=false
createSessionFiles=false
dataLayout=sf
dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name}
dataProvider=default
dataScanFlushRecords=false
dataScanPreserveTypes=false
dataScanReleaseRecords=false
dataScanStrategy=default
dataServerPort=-1
depthDimension=0
devicePoolFile={config}/devices.properties
deviceUpdateStrategyFile={config}/update.properties
hideServerMessages=false
#Thu Nov 07 14:59:30 CET 2019
hostName=
instanceName=OP
logDaysToLive=30
logLevel=Fine
logLevelConsole=Off
logPath={logs}/{date}_{time}
notificationLevel=null
saveCommandStatistics=false
scanDataRelease=false
scanStreamerPort=-1
scanStreamingPort=-1
serverEnabled=true
serverPort=8090
simulation=false
tasksFile={config}/tasks.properties
terminalEnabled=false
terminalPort=3579
userAuthenticator=
userManagement=false
instanceName=OP
autoSaveScanData=true
simulation=false
dataServerPort=-1
hideServerMessages=false
serverPort=8090
versionTrackingEnabled=true
dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name}
serverEnabled=true
commandExecutionEvents=false
logDaysToLive=30
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
logLevel=Fine
dataScanFlushRecords=false
logPath={logs}/{date}_{time}
dataLayout=sf
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=false
notificationLevel=null
userAuthenticator=
logLevelConsole=Off
terminalPort=3579
tasksFile={config}/tasks.properties
dataScanStrategy=default
scanStreamerPort=-1
parallelInitialization=false
scanDataRelease=false
createSessionFiles=false
scanStreamingPort=-1
versionTrackingLogin={context}/svcusr-hlapp_robot
devicePoolFile={config}/devices.properties
versionTrackingManual=true
versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-op.git
dataProvider=default
saveCommandStatistics=false
+18 -18
View File
@@ -1,22 +1,22 @@
#Mon Jul 01 14:54:49 CEST 2019
S10CB04-DBLM240GainWsX1=0.6
S10CB04-DBLM240_saturation=39.4
S10DI01-DBLM045GainWsX1=0.8800000000000003
S10DI01-DBLM045GainWsX2=0.8800000000000003
S10DI01-DBLM045GainWsY1=0.7600000000000002
S10DI01-DBLM045GainWsY2=0.8800000000000003
S10DI01-DBLM045_saturation=245.5
S10DI02-DBLM025GainWsY2=0.9
#Tue Feb 04 11:37:22 CET 2020
S20SY03-DBLM110GainWsX1=0.8800000000000003
S20SY03-DBLM110GainWsY1=0.9200000000000004
SARCL02-DBLM135GainWsX1=0.9
SARCL02-DBLM135GainWsX2=0.8600000000000003
SARCL02-DBLM135GainWsY1=0.9556983528903381
SARCL02-DBLM135_saturation=314.9
SINDI02-DBLM025GainWsX1=0.6
SINDI02-DBLM025GainWsX2=0.6
SINDI02-DBLM025GainWsY1=0.6200000000000001
SINDI02-DBLM025GainWsY2=0.7593208544828762
SINDI02-DBLM025GainWsx=0.5397269806333481
SINDI02-DBLM025_saturation=1310.3
S10CB04-DBLM240GainWsX1=0.6
SARCL02-DBLM135_saturation=314.9
SINDI02-DBLM025GainWsX2=0.6
S10DI01-DBLM045_saturation=245.5
S10DI02-DBLM025GainWsY2=0.9
SINDI02-DBLM025GainWsX1=0.6
SINDI02-DBLM025GainWsY2=0.7593208544828762
SINDI02-DBLM025GainWsY1=0.6200000000000001
S10DI01-DBLM045GainWsX2=0.8800000000000003
S10CB04-DBLM240_saturation=39.4
S10DI01-DBLM045GainWsY1=0.7600000000000002
SINDI02-DBLM025GainWsx=0.5397269806333481
S10DI01-DBLM045GainWsX1=0.8800000000000003
S10DI01-DBLM045GainWsY2=0.8800000000000003
SINDI02-DBLM085GainWsX1=0.6800000000000002
SARCL02-DBLM135GainWsY1=0.9556983528903381
SARCL02-DBLM135GainWsX2=0.8600000000000003
SARCL02-DBLM135GainWsX1=1.1
+2 -1
View File
@@ -1,10 +1,11 @@
#Tue Dec 18 10:08:26 CET 2018
#Fri Sep 06 11:37:43 CEST 2019
configFile={config}/config.properties
configFileDevices={config}/devices.properties
configFilePlugins={config}/plugins.properties
configFileSettings={config}/settings.properties
configFileTasks={config}/tasks.properties
configFileUpdateStrategy={config}/update.properties
configFileVariables={config}/variables.properties
configPath={home}/config
contextPath={outp}/context
dataPath={outp}/data
+2
View File
@@ -0,0 +1,2 @@
#Thu Feb 06 18:39:13 CET 2020
FileSequentialNumber=1250
+33 -29
View File
@@ -1,37 +1,41 @@
#Wed Aug 07 14:14:42 CEST 2019
\u0000=
\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
#Fri Feb 07 11:39:15 CET 2020
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
colormap=Flame
colormapAutomatic=false
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000=
\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
spatialCalOffsetY=-50.048875855327466
spatialCalOffsetX=-50.03909304143862
colormapLogarithmic=false
colormapMax=65535.0
colormapMin=39864.0
flipHorizontally=false
flipVertically=false
grayscale=false
imageHeight=494
imageWidth=659
invert=false
regionStartX=0
regionStartY=0
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
serverURL=null
spatialCalOffsetX=-50.01953888237593
spatialCalOffsetY=-50.032030749519535
grayscale=false
spatialCalScaleX=-1.0
spatialCalScaleY=-1.0
serverURL=null
colormapMax=6283.0
rescaleOffset=0.0
roiWidth=-1
colormap=Flame
imageWidth=1744
invert=false
spat=
colormapMin=46.0
rotationCrop=false
rotation=0.0
rescaleFactor=1.0
imageHeight=1680
spatialCalUnits=null
flipVertically=false
r=
roiHeight=-1
t=
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false
regionStartX=433
regionStartY=241
+23 -23
View File
@@ -1,29 +1,29 @@
#Mon Jul 29 16:11:27 CEST 2019
colormap=Flame
colormapAutomatic=true
#Sat Jan 25 10:00:39 CET 2020
spatialCalOffsetY=-283.472459616368
spatialCalOffsetX=-508.635792340687
colormapLogarithmic=false
colormapMax=1023.0
colormapMin=0.0
flipHorizontally=false
flipVertically=false
scale=1.0
grayscale=false
imageHeight=494
spatialCalScaleX=-11.968979779411764
spatialCalScaleY=-10.638298123826168
colormapMax=45095.0
rescaleOffset=0.0
roiWidth=-1
colormap=Flame
imageWidth=659
invert=false
colormapMin=74.0
rotationCrop=false
rotation=0.0
rescaleFactor=1.0
imageHeight=494
spatialCalUnits=null
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false
regionStartX=0
regionStartY=0
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=-456.693006929345
spatialCalOffsetY=-219.4442130289473
spatialCalScaleX=-14.937285913160144
spatialCalScaleY=-11.834319139832656
spatialCalUnits=null
transpose=false
+29
View File
@@ -0,0 +1,29 @@
#Fri Aug 30 09:40:43 CEST 2019
colormap=Grayscale
colormapAutomatic=false
colormapLogarithmic=false
colormapMax=NaN
colormapMin=NaN
flipHorizontally=false
flipVertically=true
grayscale=false
imageHeight=1200
imageWidth=1246
invert=false
regionStartX=304
regionStartY=8
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=-606.0
spatialCalOffsetY=-602.0
spatialCalScaleX=-26.714158504007123
spatialCalScaleY=-27.100271002710027
spatialCalUnits=mm
transpose=false
+12 -11
View File
@@ -1,17 +1,18 @@
#Mon Jul 29 18:07:39 CEST 2019
defaultSpeed=2000.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=2000.0
maxValue=66050.0
minSpeed=50.0
minValue=-50603.0
#Tue Feb 04 11:46:29 CET 2020
offset=0.0
maxValue=51500.0
precision=1
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
estbilizationDelay=0
maxSpeed=2000.0
resolution=0.1
homingType=None
startRetries=1
minValue=-56300.0
unit=um
defaultSpeed=2000.0
hasEnable=false
sign_bit=0
monitorByPosition=false
minSpeed=50.0
+20 -20
View File
@@ -1,25 +1,25 @@
#Thu Jun 13 16:35:07 CEST 2019
colormap=Flame
colormapAutomatic=true
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=-861.4939970777481
#Thu Feb 06 15:36:29 CET 2020
spatialCalOffsetY=-820.4883730911062
spatialCalOffsetX=-861.4939970777481
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=-18.90359092620482
spatialCalScaleY=-19.37984500632817
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Flame
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
+12 -11
View File
@@ -1,14 +1,15 @@
#Thu Apr 05 14:20:51 CEST 2018
alignmentRetries=20
disableCompression=false
dropIncomplete=false
keepListeningOnStop=false
mappingIncomplete=fill_null
parallelHandlerProcessing=true
sendAwaitFirstMessage=false
sendBuildChannelConfig=at_startup
sendIncompleteMessages=true
#Tue Nov 19 12:01:37 CET 2019
sendStrategy=complete_all
sendSyncTimeout=0
dropIncomplete=false
disableCompression=false
keepListeningOnStop=false
parallelHandlerProcessing=true
sendBuildChannelConfig=at_startup
sendAwaitFirstMessage=false
socketType=DEFAULT
validationInconsistency=keep_as_is
byteBufferAllocator=false
alignmentRetries=20
mappingIncomplete=fill_null
sendIncompleteMessages=true
sendSyncTimeout=0
+10
View File
@@ -0,0 +1,10 @@
#Thu Sep 19 19:14:35 CEST 2019
minValue=-10.0
unit=A
offset=0.0
maxValue=10.0
rotation=false
precision=3
sign_bit=0
scale=1.0
resolution=0.1
+10
View File
@@ -0,0 +1,10 @@
#Tue Sep 24 16:19:09 CEST 2019
minValue=-10.0
unit=A
offset=0.0
maxValue=10.0
rotation=false
precision=3
sign_bit=0
scale=1.0
resolution=NaN
+10
View File
@@ -0,0 +1,10 @@
#Tue Sep 24 16:19:09 CEST 2019
minValue=-10.0
unit=A
offset=0.0
maxValue=10.0
rotation=false
precision=3
sign_bit=0
scale=1.0
resolution=NaN
+10
View File
@@ -0,0 +1,10 @@
#Tue Oct 08 09:19:39 CEST 2019
minValue=-10.0
unit=A
offset=0.0
maxValue=10.0
rotation=false
precision=3
sign_bit=0
scale=1.0
resolution=NaN
+10 -8
View File
@@ -1,14 +1,16 @@
#Wed Mar 28 14:33:20 CEST 2018
defaultSpeed=1.0
estbilizationDelay=0
maxSpeed=10.0
maxValue=10.0
minSpeed=0.1
minValue=-10.0
#Mon Sep 23 17:29:11 CEST 2019
offset=0.0
maxValue=10.0
precision=2
resolution=NaN
rotation=false
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
+10 -8
View File
@@ -1,14 +1,16 @@
#Wed Mar 28 14:33:20 CEST 2018
defaultSpeed=1.0
estbilizationDelay=0
maxSpeed=10.0
maxValue=10.0
minSpeed=0.1
minValue=-10.0
#Mon Sep 23 17:29:11 CEST 2019
offset=0.0
maxValue=10.0
precision=2
resolution=NaN
rotation=false
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
+8 -7
View File
@@ -1,9 +1,10 @@
#Tue Jul 11 15:24:17 CEST 2017
maxValue=1000.0
#Mon Sep 23 17:29:11 CEST 2019
minValue=0.0
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
unit=mm
offset=0.0
maxValue=1000.0
precision=-1
rotation=false
sign_bit=0
scale=1.0
resolution=NaN
+10
View File
@@ -0,0 +1,10 @@
#Tue Sep 24 16:19:09 CEST 2019
minValue=0.0
unit=1/m
offset=0.0
maxValue=0.0
rotation=false
precision=3
sign_bit=0
scale=1.0
resolution=NaN
+20 -19
View File
@@ -1,24 +1,25 @@
#Tue Aug 30 17:36:05 CEST 2016
colormap=Temperature
colormapAutomatic=true
colormapMax=255.0
colormapMin=0.0
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
#Mon Sep 23 17:29:11 CEST 2019
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=255.0
rescaleOffset=0.0
roiWidth=-1
colormap=Temperature
invert=false
colormapMin=0.0
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false
+20 -19
View File
@@ -1,24 +1,25 @@
#Tue Aug 30 17:36:05 CEST 2016
colormap=Grayscale
colormapAutomatic=true
colormapMax=255.0
colormapMin=0.0
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
#Mon Sep 23 17:29:11 CEST 2019
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=255.0
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=0.0
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=true
roiY=0
roiX=0
transpose=false
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="449" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="137" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>
+52
View File
@@ -0,0 +1,52 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
/**
*
*/
public class Tst extends Panel {
public Tst() {
initComponents();
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
}
@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() {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 449, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 137, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
+3
View File
@@ -671,6 +671,9 @@
<SpinnerModel initial="1" maximum="2" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerBunchStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel23">
<Properties>
+32 -8
View File
@@ -21,8 +21,10 @@ import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
@@ -40,7 +42,7 @@ public class WireScan extends Panel {
boolean parked;
String currentScannner;
public WireScan() {
public WireScan() {
initComponents();
bpmCombos = new JComboBox[]{comboBpm1, comboBpm2, comboBpm3};
blmCombos = new JComboBox[]{comboBlm1, comboBlm2, comboBlm3};
@@ -94,11 +96,8 @@ public class WireScan extends Panel {
comboWireScanner.setSelectedItem(App.getArgumentValue("ws"));
}
comboWireScannerActionPerformed(null);
Device dev = new ChannelDouble (null, "SIN-TIMAST-TMA:Evt-15-Freq-I");
dev.setMonitored(true);
dev.initialize();
panelRepRate.setDevice(dev);
updatePanelRepRate();
} catch (Exception ex) {
showException(ex);
@@ -106,6 +105,17 @@ public class WireScan extends Panel {
}
void updatePanelRepRate() throws Exception{
if (panelRepRate.getDevice()!=null){
panelRepRate.getDevice().close();
}
int bunch = (Integer)spinnerBunch.getValue();
Device dev = new ChannelDouble (null, (bunch==2) ? "SIN-TIMAST-TMA:Bunch-2-Appl-Freq-RB" : "SIN-TIMAST-TMA:Bunch-1-Appl-Freq-RB");
dev.setMonitored(true);
dev.initialize();
panelRepRate.setDevice(dev);
}
@Override
public void onStart() {
super.onStart();
@@ -121,7 +131,7 @@ public class WireScan extends Panel {
super.onStop();
}
@Override
protected void onTimer(){
try{
@@ -602,6 +612,11 @@ public class WireScan extends Panel {
jLabel21.setText("Bunch:");
spinnerBunch.setModel(new javax.swing.SpinnerNumberModel(1, 1, 2, 1));
spinnerBunch.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerBunchStateChanged(evt);
}
});
jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel23.setText("Vel x (µm/s):");
@@ -1154,7 +1169,7 @@ ChannelDouble channelEndY;
}//GEN-LAST:event_buttonParkActionPerformed
//String caqtdm = "caqtdm -noMsg -stylefile sfop.qss -attach";
String caqtdm = "caqtdm -noMsg -stylefile sfop.qss";
String caqtdm = "startDM -noMsg -stylefile sfop.qss";
ch.psi.pshell.core.Plugin calibrationPlugin;
private void buttonCalibrationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCalibrationActionPerformed
try {
@@ -1172,6 +1187,7 @@ ChannelDouble channelEndY;
private void buttonScannerPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScannerPanelActionPerformed
try {
String cmd = caqtdm + " -macro 'SYS=" + comboWireScanner.getSelectedItem() + "' /sf/common/config/qt/S_DI_WSC_EXPERT.ui";
System.out.println(cmd);
Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});
} catch (Exception ex) {
showException(ex);
@@ -1232,6 +1248,14 @@ ChannelDouble channelEndY;
// TODO add your handling code here:
}//GEN-LAST:event_comboAdaptiveActionPerformed
private void spinnerBunchStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerBunchStateChanged
try {
updatePanelRepRate();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_spinnerBunchStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonCalibration;
+110
View File
@@ -0,0 +1,110 @@
import ch.psi.pshell.epics.Positioner as Positioner
dry_run = False
do_elog = True
is_panel = get_exec_pars().source != CommandSource.ui # must be check before run
run("CPython/wrapper")
#Parameters
if is_panel:
MCR1 = args[0]
else:
U = "X"
MQUA = "SATMA01-MQUA050"
MCR1 = {"X": "SATCB01-MCRX430", "Y": "SATCB01-MCRY430" }
BPM1 = {"X": "SARCL01-DBPM150:X1", "Y": "SARCL01-DBPM150:Y1" }
BPM2 = {"X": "SARCL02-DBPM110:X1", "Y": "SARCL02-DBPM110:Y1" }
dC = 2.0
dK = 0.05
step = 10
nb = 5
lat = 0.0
plt = plot(None, title="Output")[0]
#Plot setup
plt.clear()
plt.removeMarker(None)
plt.setStyle(plt.Style.ErrorXY)
plt.addSeries(LinePlotErrorSeries("run0", Color.red))
plt.addSeries(LinePlotErrorSeries("run1", Color.yellow))
plt.addSeries(LinePlotErrorSeries("run2", Color.green))
plt.getAxis(plt.AxisId.X).setLabel("BPM1 (mm)")
plt.getAxis(plt.AxisId.Y).setLabel("BPM2 (mm)")
plt.setLegendVisible(True)
#Creating Phase positioner
if dry_run:
kick1 = Positioner("kick1", "SATCB01-MCRX430:I-SET", "SATCB01-MCRX430:I-READ")
quad = Positioner("quad", "SATMA01-MQUA050:K1L-SET", "SATMA01-MQUA050:K1L-READ")
else:
kick1 = Positioner("kick1", MCR1[U] + ":I-SET", MCR1[U] + ":I-READ")
quad = Positioner("quad", MQUA + ":K1L-SET", MQUA + ":K1L-READ")
quad.config.minValue = -2.0
quad.config.maxValue = 2.0
kick1.initialize()
quad.initialize()
kick1_ini = kick1.read()
quad_ini = quad.read()
start = kick1_ini - dC / 2
stop = kick1_ini + dC / 2
#Creating averagers
X1 = "ca://" + BPM1[U]
X2 = "ca://" + BPM2[U]
X1_averager = create_averager(X1, nb, -1) # -1 event based, waits for the next value
X2_averager = create_averager(X2, nb, -1) # ca:// it comes from epics channels
X2_averager.monitored = True # not blocking, will return last nb values
#Record callback: uptate of output plot
def after_sample(record, scan):
global plt,i
X1_mean, X1_stdev = record.values[0].mean, record.values[0].stdev
X2_mean, X2_stdev = record.values[1].mean, record.values[1].stdev
plt.getSeries(i).appendData(X1_mean, X2_mean, X1_stdev, X2_stdev)
#The scan loop
try:
data = []
i = 0
for K1L in (quad_ini, quad_ini - dK, quad_ini + dK):
kick1.write(start)
quad.write(K1L)
time.sleep(2.0)
r = lscan(kick1, [X1_averager, X2_averager], start, stop, step , latency=lat, after_read = after_sample)
data.append({"K1L":K1L,"scan":r})
i = i + 1
finally:
kick1.write(kick1_ini)
kick1.close()
quad.write(quad_ini)
quad.close()
#Fitting and plotting
P = []
for i in range(len(data)):
x = data[i]["scan"].getReadable(0)
y = data[i]["scan"].getReadable(1)
(p, x_fit, y_fit, R2) = linfit(x, y)
P.append(p)
plt.addSeries(LinePlotErrorSeries("Fit"+str(i), plt.getSeries(i).color))
plt.getSeries(i+3).setData(x_fit, y_fit)
plt.getSeries(i+3).setPointsVisible(False)
a, b = P[1][0], P[1][1] #second line +K
c, d = P[2][0], P[2][1] #third line -K
ui = (d - b)/(a - c) if a != c else None
#Elog entry
if do_elog:
if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":
title = "BPM_Quad_scan"
log_msg = "Data file: " + get_exec_pars().path + "\n\n"
log_msg = log_msg + "MQUA: " + MQUA + "\n"
log_msg = log_msg + "BPM1: " + BPM1[U] + "\n"
log_msg = log_msg + "BPM2: " + BPM2[U] + "\n"
log_msg = log_msg + "MQUA center: " + str(ui) + "\n"
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
file_name = os.path.abspath(get_context().setup.getContextPath() + "/BPM_Quad_Plot.png")
plt.saveSnapshot(file_name , "png")
elog(title, log_msg, [file_name,])
set_return(ui)
+2 -1
View File
@@ -5,7 +5,7 @@
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
# change the current of the gun soleoid
# change the current of the gun solenoid
# look at the centroid position (BPM or screen) downstream of the gun.
import datetime
@@ -16,6 +16,7 @@ is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before c
camera_name = "simulation" if dry_run else "SINEG01-DSCR190"
bpm_name = "SINEG01-DBPM340"
use_good_region=False
use_screen_panel_stream = True
magnets = ["SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA140","SINEG01-MQSK150",
"SINEG01-MCRX160","SINEG01-MCRY160",
+1
View File
@@ -13,6 +13,7 @@ import datetime
do_elog = True
dry_run = False
use_screen_panel_stream = True
is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before callin "run"
camera_name = "simulation" if dry_run else "SINEG01-DSCR190"
bpm_name = "SINEG01-DBPM340"
+16
View File
@@ -0,0 +1,16 @@
import numpy as np
def linfit(x, y):
"""
Return linear fit
"""
p = np.polyfit(x, y, 1)
f = np.poly1d(p)
x_fit = np.linspace(min(x), max(x), 100)
y_fit = f(x_fit)
yhat = f(x)
ybar = np.sum(y)/len(y)
ssreg = np.sum((yhat - ybar)**2)
sstot = np.sum((y - ybar)**2)
R2 = ssreg / sstot
return (p, x_fit, y_fit, R2)
+4
View File
@@ -12,6 +12,10 @@ def gfitoff(x, y, off=None, amp=None, com=None, sigma=None):
ret = call_jep("CPython/gfitoff", "gfitoff", [to_npa(x), to_npa(y), off, amp, com, sigma])
return ret if ret is None or is_list(ret) else ret.data
def linfit(x, y):
ret = call_jep("CPython/linfit", "linfit", [to_npa(x),to_npa(y)])
return (ret[0].data, ret[1].data, ret[2].data, ret[3])
+73 -58
View File
@@ -11,17 +11,21 @@ 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
dx = "SINEG01-DICT215:B1_CHARGE"
#dx = "SLG-LCAM-C042 x_rms"
dxtype = TYPE_CHANNEL
dxtype = TYPE_STREAM
#dxtype = TYPE_CAMERA
#dy = "SINDI01-RLLE-STA:SLAVE1-DLTIMER"
dy = "SLG-LCAM-C042 y_rms"
dytype = TYPE_STREAM
dytype = TYPE_CHANNEL
dytype = TYPE_CAMERA
dy = "SINEG01-DICT215:B1_CHARGE"
dytype = TYPE_STREAM
interval = 0.10
window = 40
p = plot(None)[0]
@@ -161,66 +165,77 @@ try:
y=bsdata.pop(0)
elif dytype==TYPE_CAMERA:
y=dy.read()
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)
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]
neg_peak = str(round(peak,4))
peak_str = "Negative peak: " + neg_peak
pos_peak = str(round(peak,4))
peak_str = "Positive peak: " + pos_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))
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)
time.sleep(interval)
except KeyboardInterrupt:
pass
finally:
for dev in instances:
dev.close()
try:
dev.close()
except:
pass
+7 -3
View File
@@ -126,7 +126,7 @@ elements = (
(DBLM, "SATDI01-DBLM225", 349.5613),
(DBPM, "SATDI01-DBPM240", 352.1997),
(DBPM, "SATDI01-DBPM270", 355.1797),
(DWSC, "SATDI01-DWSC290", 356.4797),
#(DWSC, "SATDI01-DWSC290", 356.4797),
(DBPM, "SATDI01-DBPM320", 357.0907),
(DBPM, "S30CB07-DBPM420", 358.4150),
(DBPM, "SATCB01-DBPM220", 361.5357),
@@ -168,6 +168,8 @@ elements = (
(DBPM, "SARMA02-DBPM020", 490.0107),
(DBPM, "SARMA02-DBPM040", 492.0597),
(DWSC, "SARMA02-DWSC060", 492.3767),
(DWSC, "SATBD01-DWSC110", 493.078),
(DBLM, "SATBD01-DBLM205", 498.7),
(DBPM, "SARMA02-DBPM110", 496.8097),
(DBLM, "SARUN01-DBLM065", 497.8392),
(DBPM, "SARUN01-DBPM070", 501.5597),
@@ -268,7 +270,9 @@ def get_wire_scanners_bpms(wire_scan):
if len(ret) > 0:
return [ret[0],element[1]]
last = element[1]
return None
if ret is not None and len(ret)==1:
ret.append(None)
return ret
def get_wire_scanners_blms(wire_scan):
@@ -401,4 +405,4 @@ def set_wire_scan_range(wsc, wire, start, end):
start = min (max(start, -2000), 2000.0)
end = min (max(end, -2000), 2000.0)
caput((wsc + ":" + sel[wire] +"_START_SP"), start)
caput((wsc + ":" + sel[wire] +"_END_SP"), end)
caput((wsc + ":" + sel[wire] +"_END_SP"), end)
+2 -2
View File
@@ -16,6 +16,7 @@ ATT_SP = 15.0 #3.0,6.0,9.0,12.0,15.0
RANGE = [0.5, 1.1]
STEP_SIZE = 0.05
SETTLING_TIME = 3
BUNCH = 1
SIMULATION = False
do_elog = True
@@ -41,7 +42,7 @@ for att in attenuators:
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
st.setFilter(get_beam_ok_channel(BUNCH) + " == 1")
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 1, 0)
av = create_averager(blm, SAMPLES, interval = -1)
@@ -72,7 +73,6 @@ for i in range(len(BPMS)):
sensors.append(av1.samples)
line_plots.append(av1.samples)
#Scalar("beam_ok" , st, "SIN-CVME-TIFGUN-EVR0:BEAMOK" , 1, 0)
st.initialize()
st.start()
st.waitCacheChange(5000) #Wait stream be running before starting scan
+2 -2
View File
@@ -12,6 +12,7 @@ ATTENUATORS = ["SINDI02-DBLM084:M06-1-ATT2-VAL", "SINDI02-DBLM084:M06-2-ATT2-VAL
RANGE = [0.5, 1.1]
STEP_SIZE = 0.1
SETTLING_TIME = 0.5
BUNCH = 1
SIMULATION = False
do_elog = True
@@ -37,7 +38,7 @@ for i in range(len(ATTENUATORS)):
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
st.setFilter(get_beam_ok_channel(BUNCH) + " == 1")
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 1, 0)
av = create_averager(blm, SAMPLES, interval = -1)
@@ -61,7 +62,6 @@ for i in range(len(BPMS)):
sensors.append(av1.samples)
line_plots.append(av1.samples)
#Scalar("beam_ok" , st, "SIN-CVME-TIFGUN-EVR0:BEAMOK" , 1, 0)
st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
+1 -1
View File
@@ -1,5 +1,5 @@
st = Stream("st1",dispatcher)
st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
st.setFilter(get_beam_ok_channel(bunch=1) + " == 1")
c = "SARCL02-DBLM135:LOSS_SIGNAL_RAW"
st.addWaveform(c, c, 1, 2048)
+2 -2
View File
@@ -16,6 +16,7 @@ ROT = ["SLGTV-LAPP:SIZE-SET"] # IRIS
RANGE = [4.4, 2.0] # IRIS range
STEP_SIZE = 0.1 # IRIS Step size
SETTLING_TIME = 3
BUNCH = 1
SIMULATION = False
do_elog = True
@@ -28,7 +29,7 @@ for i in range(len(ROT)):
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
st.setFilter(get_beam_ok_channel(BUNCH) + " == 1")
for i in range(len(ICTS)):
ict = Scalar("ict" + str(i+1), st, ICTS[i] + ":B1_CHARGE", 1, 0)
av = create_averager(ict, SAMPLES, interval = -1)
@@ -66,7 +67,6 @@ for i in range(len(ICTV)):
add_device(av2, True)
#sensors.append(ictv)
#Scalar("beam_ok" , st, "SIN-CVME-TIFGUN-EVR0:BEAMOK" , 1, 0)
st.initialize()
st.start()
st.waitCacheChange(5000) #Wait stream be running before starting scan
+4 -4
View File
@@ -2,8 +2,8 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = False
do_elog = True
base_name = "SARBD01-DICT599" # SINEG01-DICT009 S10DI01-DICT113 SARMA01-DICT482 SARBD01-DICT599 SATDI01-DICT344
dev_name = "SARBD01-DICT030" # SINEG01-DICT215 S10DI01-DICT025 SARMA01-DICT090 SARBD01-DICT030 SATDI01-DICT020
base_name = "SATBD02-DICT499" # SINEG01-DICT009 S10DI01-DICT113 SARMA01-DICT482 SARBD01-DICT599 SATDI01-DICT344
dev_name = "SATBD02-DICT020" # SINEG01-DICT215 S10DI01-DICT025 SARMA01-DICT090 SARBD01-DICT030 SATDI01-DICT020
run("CPython/wrapper")
@@ -22,8 +22,8 @@ V.initialize()
t0 = t.read()
start = 5
stop = 10
start = 2.2
stop = 12
step = 0.1
nb = 5
lat = 0.150
+4 -4
View File
@@ -2,8 +2,8 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = False
do_elog = True
base_name = "SATDI01-DICT344" # SINEG01-DICT009 S10DI01-DICT113 SARMA01-DICT482 SARBD01-DICT599
dev_name = "SATDI01-DICT020" # SINEG01-DICT215 S10DI01-DICT025 SARMA01-DICT090 SARBD01-DICT030
base_name = "SATBD02-DICT499" # SINEG01-DICT009 S10DI01-DICT113 SARMA01-DICT482 SARBD01-DICT599
dev_name = "SATBD02-DICT020" # SINEG01-DICT215 S10DI01-DICT025 SARMA01-DICT090 SARBD01-DICT030
if dry_run:
t = ChannelDouble("fine delay (us)", "SINEG01-DICT215:Pul1-Delay-SP-SIM")
@@ -20,9 +20,9 @@ V.initialize()
t0 = t.read()
start = 1002.170
start = 1001.000
stop = 1002.200
step = 0.001
step = 0.01
nb = 5
lat = 0.150
+9 -8
View File
@@ -38,7 +38,7 @@ INCREMENT_FACTOR = 0.5
SCAN_RANGE_FACTOR = 6
MAX_RANGE_STEP = 300
SET_BLM_WS_MODE = True
SET_BLM_WS_MODE = False
SET_BLM_WS_SETTLING_TIME = 2.0
SET_BLM_WS_BS_READBACK_TIMEOUT = 10000 #ms
@@ -71,7 +71,7 @@ if scan_range is None or len(scan_range) !=4:
caget(prefix+":W1Y_END_SP", 'd') ]
rr = get_repetition_rate()
rr = get_repetition_rate(bunch)
velocity_x = abs(scan_range[1]-scan_range[0])*rr/n_shot
velocity_y = abs(scan_range[3]-scan_range[2])*rr/n_shot
@@ -102,7 +102,7 @@ for i in range (len(bpms)):
if SET_BLM_WS_MODE and (len(blms)>0):
channels.append(("blm1_ws_mode", blms[0] + ":WS_RUNNING"))
channels.append(("beam_ok", "SIN-CVME-TIFGUN-EVR0:BEAMOK"))
channels.append(("beam_ok", get_beam_ok_channel(bunch)))
#Metadata
@@ -131,9 +131,9 @@ for retry in range(STREAM_CREATION_RETRIES):
st = Stream("pulse_id", dispatcher)
for c in channels:
if c[1].endswith("LOSS_SIGNAL_RAW"):
st.addWaveform(c[0], c[1], int(100.0 / get_repetition_rate()), 0)
st.addWaveform(c[0], c[1], int(100.0 / rr), 0)
else:
st.addScalar(c[0], c[1], int(100.0 / get_repetition_rate()), 0)
st.addScalar(c[0], c[1], int(100.0 / rr), 0)
st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
@@ -442,7 +442,7 @@ def get_scan_time():
ret += abs(scan_range[2] - scan_range[3])/velocity_y #Y SCAN
ret += 2.0 #ACC/DEC
ret *= cycles
ret += bkgrd * (1.0/get_repetition_rate()) #BACK
ret += bkgrd * (1.0/rr) #BACK
print "Scan time = " + str(ret),
ret = ret * 2.0 + 10.0 #Tolernces
print "; with tolerance = " + str(ret),
@@ -451,7 +451,8 @@ def get_scan_time():
print "Starting scan..."
try:
if SET_BLM_WS_MODE and len(blms)>0:
start_blm_ws(blms[0], get_scan_time())
for i in range(len(blms)):
start_blm_ws(blms[i], get_scan_time())
#TODO: Wait for stream variable indicate bllm is in ws mode
print "Waiting for WS mode..."
#time.sleep(SET_BLM_WS_SETTLING_TIME)
@@ -460,7 +461,7 @@ try:
do_background()
stream_filter = scanner.curr_cycl.get_name() + ">0"
if filter_beam_ok:
stream_filter = stream_filter + " AND SIN-CVME-TIFGUN-EVR0:BEAMOK == 1"
stream_filter = stream_filter + " AND " + get_beam_ok_channel(bunch) + " == 1"
st.setFilter(stream_filter)
print "Executing scan 1..."
do_scan(0)
+7 -6
View File
@@ -19,6 +19,7 @@ n_shot = args[5] if is_panel else 200
saturation = args[6] if is_panel else 19950 / 10 #S10DI01-DBLM113:AL1-WS-PMT-GAIN
scan_range_factor = args[7] if is_panel else 6.0
initial_gain = args[8] if is_panel else 0.6
bunch = 1
ws_blm = get_wire_scanners_blms(ws_prefix )[0]
@@ -40,9 +41,9 @@ print "Setting gain=", initial_gain
#Calculate speed
x_min, x_max = range_start, range_end
#rr = get_repetition_rate()
rr = get_repetition_rate(bunch)
#ws_speed = (x_max- x_min)*rr/n_shot
args = [ ws_prefix , ws_wire, [x_min, x_max, x_min, x_max], 1, n_shot, [], [ws_blm], 10, plt, False,1,0]
args = [ ws_prefix , ws_wire, [x_min, x_max, x_min, x_max], 1, n_shot, [], [ws_blm], 10, plt, False,bunch,0, True]
ret = run("Diagnostics/WireScan", args)
[rms_com, rms_sigma, com, sigma, pos_path, path] = ret
@@ -56,7 +57,7 @@ print "--------------- Optimize gain --------------- "
#Need 30s for 25Hz at full gain range. Have a 2x factor.
start_blm_ws(ws_blm, 2*7.5*(100/get_repetition_rate()))
start_blm_ws(ws_blm, 2*7.5*(100/rr))
ws_info = WireScanInfo("ws_info", ws_prefix )
motor_pos= ws_info.get_motor_pos(com, ws_wire)
@@ -74,9 +75,9 @@ set_status("Creating stream for gain search..." )
st = Stream("blm_stream", dispatcher)
ch_int = ws_blm + ":B1_LOSS"
ch_raw = ws_blm + ":LOSS_SIGNAL_RAW"
st.addScalar(ch_int, ch_int, int(100.0 / get_repetition_rate()), 0)
st.addWaveform(ch_raw, ch_raw, int(100.0 / get_repetition_rate()), 0)
st.addScalar("blm1_ws_mode", ws_blm + ":WS_RUNNING", int(100.0 / get_repetition_rate()), 0)
st.addScalar(ch_int, ch_int, int(100.0 / rr), 0)
st.addWaveform(ch_raw, ch_raw, int(100.0 / rr), 0)
st.addScalar("blm1_ws_mode", ws_blm + ":WS_RUNNING", int(100.0 / rr), 0)
st.initialize()
st.start()
st.waitCacheChange(10000) #Wait stream be running before starting scan
+28
View File
@@ -0,0 +1,28 @@
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
A1 = ChannelDouble("actname", "S20SY02-MKAC040:I-SET")
S1 = ChannelDouble("sensname", "SARFE10-PBPG050:HAMP-INTENSITY-AVG")
A1.initialize()
S1.initialize()
A1_init = A1.read()
A1i = 244.58
A1f = 254.82
step = 0.5122
lat1 = 0.11
lat2 = 1.0
nav = 300
plt = plot(None, title="Output")[0]
plt.clear()
plt.setStyle(plt.Style.ErrorY)
plt.addSeries(LinePlotErrorSeries("Sensor1", Color.red))
def after_sample(record, scan):
plt.getSeries(0).appendData(record.positions[0], record.values[0].mean, record.values[0].stdev)
try:
S1_averager = create_averager(S1, nav, lat1)
A1.write(A1i)
time.sleep(2.0)
r = lscan(A1, (S1_averager), A1i, A1f, step, latency=lat2, after_read = after_sample)
Act1 = r.getPositions(0)
finally:
A1.write(A1_init)
A1.close()
S1.close()
+15 -10
View File
@@ -60,9 +60,9 @@ phase0 = phase.read() % 360
#Camera setup
if USE_SCREEN_PANEL:
cam_server.start(camera_name+"_sp1", True) #True for shared pipeline
cam_server.start(camera_name+"_sp1", True) # shared pipeline
else:
cam_server.start(camera_name)
cam_server.start(camera_name) # generic pipeline
wait_cam_server_message()
x = cam_server.stream.getChild("x_center_of_mass")
dx = cam_server.stream.getChild("x_rms")
@@ -72,7 +72,7 @@ cam_server.setBackgroundSubtraction(False)
#Creating averagers
x_averager = create_averager(x, nb, -1) # -1 event based, waits for the next value
dx_averager = create_averager(dx, nb, -1)
dx_averager.monitored = True # not blocking, will return last nb values
dx_averager.monitored = True # not blocking, will return last nb values
#Record callback: uptate of output plot
def after_sample(record, scan):
@@ -144,16 +144,21 @@ if do_elog:
log_msg = "Data file: " + get_exec_pars().path + "\n\n"
log_msg = log_msg + "Laser: " + Laser + "\n"
if Laser == "Alcor":
log_msg = log_msg + "Energy plate Alcor: %0.2f" % caget("SLGTH01-LMRM-M074:MOT.RBV") + " deg \n"
log_msg = log_msg + "Energy plate Alcor: %0.2f" % caget("SLAUV01-LATN100:MOT.RBV") + " deg \n"
elif Laser == "Jaguar":
log_msg = log_msg + "Energy plate Jaguar: %0.2f" % caget("SLGJG-LMRM-M031:MOT.RBV") + " deg \n"
log_msg = log_msg + "Energy plate Jaguar: %0.2f" % caget("SLJUV01-LATN100:MOT.RBV") + " deg \n"
elif Laser == "Both":
log_msg = log_msg + "Energy plate Alcor: %0.2f" % caget("SLGTH01-LMRM-M074:MOT.RBV") + " deg \n"
log_msg = log_msg + "Energy plate Jaguar: %0.2f" % caget("SLGJG-LMRM-M031:MOT.RBV") + " deg \n"
if caget("SLGTV-LMTO-M053:MOT-ACT-POS") == "IRIS":
log_msg = log_msg + "Collimator: IRIS %0.2f" % caget("SLGTV-LAPP:SIZE-GET") + " mm \n"
log_msg = log_msg + "Energy plate Alcor: %0.2f" % caget("SLAUV01-LATN100:MOT.RBV") + " deg \n"
log_msg = log_msg + "Energy plate Jaguar: %0.2f" % caget("SLJUV01-LATN100:MOT.RBV") + " deg \n"
if caget("SLAUV01-LAPT100:IRIS-POS-GET") == "IRIS":
log_msg = log_msg + "Collimator Alcor: IRIS %0.2f" % caget("SLAUV01-LAPT100:SIZE-GET") + " mm \n"
else:
log_msg = log_msg + "Collimator: " + str(caget("SLGTV-LMTO-M053:MOT-ACT-POS")) + "\n"
log_msg = log_msg + "Collimator Alcor: " + str(caget("SLAUV01-LAPT100:IRIS-POS-GET")) + "\n"
if caget("SLMUV01-LAPT100:IRIS-POS-GET") == "IRIS":
log_msg = log_msg + "Collimator Mizar: IRIS %0.2f" % caget("SLMUV01-LAPT100:SIZE-GET") + " mm \n"
else:
log_msg = log_msg + "Collimator Mizar: " + str(caget("SLMUV01-LAPT100:IRIS-POS-GET")) + "\n"
log_msg = log_msg + "Charge B1: %0.2f" % caget("SINEG01-DICT215:B1_CHARGE-OP") + " pC at %0.2f" % phase0 + " deg beam phase\n"
log_msg = log_msg + "Charge B2: %0.2f" % caget("SINEG01-DICT215:B2_CHARGE-OP") + " pC at %0.2f" % phase0 + " deg beam phase\n"
log_msg = log_msg + "p-max: %0.2f" % p_max + " MeV/c at %0.2f" % ph_p_max + " deg beam phase\n"
+1 -2
View File
@@ -2,7 +2,7 @@ dry_run = False
do_elog = True
if get_exec_pars().source == CommandSource.ui:
bph_ref_user = 90.0
bph_ref_user = 89.0
plt = None
else:
bph_ref_user = args[0]
@@ -11,7 +11,6 @@ phase_offset_old = caget("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
phase_offset_new = phase_offset_old - (bph_ref_user - 90.0)
if not dry_run:
caput("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE" , phase_offset_new )
caput("SINEG01-RSYS:CMD-LOAD-CALIB-BEAM" , 1 )
if do_elog:
title = "Set gun phase"
log_msg = "SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %8.2f" % phase_offset_new + " deg (was %8.2f" % phase_offset_old + " deg)\n"
+17 -16
View File
@@ -3,8 +3,6 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = False
do_elog = True
#set_exec_pars(layout="default")
is_panel = get_exec_pars().source != CommandSource.ui #must be check before run
if is_panel:
@@ -19,7 +17,7 @@ else:
stop = 150.0
step = 5.0
nb = 1
lat = 0.110
lat = 0.110 # lat is applied after each step (but not between samples)
plt = plot(None, title="Output")[0]
#Plot setup
@@ -46,9 +44,9 @@ else:
bph.config.minValue = -90.0
bph.config.maxValue = 360.0
bph.config.precision = 4
bph.config.resolution = 0.5
bph.config.rotation = True
bph.config.precision = 4 # nb of digit to display
bph.config.resolution = 0.5 # set and get have to be within resolution
bph.config.rotation = True # will go back to zero if > 360 deg
bph.config.save()
bph.initialize()
bph0 = bph.read() % 360.0
@@ -75,8 +73,7 @@ finally:
bph.close()
rph.close()
q.close()
#st.close()
#beamphase = r.getPositions(0)
beamphase = [(val + 90) % 360 - 90 for val in r.getPositions(0)]
rfphase = [(val.mean + 90) % 360 - 90 for val in r.getReadable(0)]
rfphaserms = [val.stdev for val in r.getReadable(0)]
@@ -109,17 +106,21 @@ if do_elog:
if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":
Laser = str(caget("SLG-LGEN:WHICH_LASER"))
log_msg = "Data file: " + get_exec_pars().path + "\n\n"
log_msg = log_msg + "Laser: " + Laser + "\n"
log_msg = log_msg + "Laser: " + Laser + "\n"
if Laser == "Alcor":
log_msg = log_msg + "Energy plate: %0.2f" % caget("SLGTH01-LMRM-M074:MOT.RBV") + " deg \n"
log_msg = log_msg + "Energy plate: %0.2f" % caget("SLAUV01-LATN100:MOT.RBV") + " deg \n"
elif Laser == "Jaguar":
log_msg = log_msg + "Energy plate: %0.2f" % caget("SLGJG-LMRM-M031:MOT.RBV") + " deg \n"
if caget("SLGTV-LMTO-M053:MOT-ACT-POS") == "IRIS":
log_msg = log_msg + "Collimator: IRIS %0.2f" % caget("SLGTV-LAPP:SIZE-GET") + " mm \n"
log_msg = log_msg + "Energy plate: %0.2f" % caget("SLJUV01-LATN100:MOT.RBV") + " deg \n"
if caget("SLAUV01-LAPT100:IRIS-POS-GET") == "IRIS":
log_msg = log_msg + "Collimator Alcor: IRIS %0.2f" % caget("SLAUV01-LAPT100:SIZE-GET") + " mm \n"
else:
log_msg = log_msg + "Collimator: " + str(caget("SLGTV-LMTO-M053:MOT-ACT-POS")) + "\n"
log_msg = log_msg + "Charge: %0.2f" % caget("SINEG01-DICT215:B1_CHARGE-OP") + " pC at %0.2f" % bph0 + " deg beam phase\n"
log_msg = log_msg + "Charge onset: %0.2f" % x1 + " deg \n"
log_msg = log_msg + "Collimator Alcor: " + str(caget("SLAUV01-LAPT100:IRIS-POS-GET")) + "\n"
if caget("SLMUV01-LAPT100:IRIS-POS-GET") == "IRIS":
log_msg = log_msg + "Collimator Mizar: IRIS %0.2f" % caget("SLMUV01-LAPT100:SIZE-GET") + " mm \n"
else:
log_msg = log_msg + "Collimator Mizar: " + str(caget("SLMUV01-LAPT100:IRIS-POS-GET")) + "\n"
log_msg = log_msg + "Charge: %0.2f" % caget("SINEG01-DICT215:B1_CHARGE-OP") + " pC at %0.2f" % bph0 + " deg beam phase\n"
log_msg = log_msg + "Charge onset: %0.2f" % x1 + " deg \n"
attachments = []
if plt is not None:
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
+5 -1
View File
@@ -129,12 +129,15 @@ save_dataset ("scan 1/processed/On-crest VS-phase" , ph_crest )
save_dataset ("scan 1/processed/VS-phase offset" , phase_offset )
save_dataset ("scan 1/processed/Amplitude scale" , amplitude_scale )
save_dataset ("scan 1/processed/Power scale" , power_scale )
save_dataset ("scan 1/processed/Dispersion" , disp )
set_attribute("scan 1/processed/Energy" , "Unit", "MeV" )
set_attribute("scan 1/processed/Energy gain" , "Unit", "MeV" )
set_attribute("scan 1/processed/On-crest VS-phase" , "Unit", "deg" )
set_attribute("scan 1/processed/VS-phase offset" , "Unit", "deg" )
set_attribute("scan 1/processed/Amplitude scale" , "Unit", "MV" )
set_attribute("scan 1/processed/Power scale" , "Unit", "MW/MV^2" )
set_attribute("scan 1/processed/Dispersion" , "Unit", "mm" )
#Elog entry
if do_elog:
@@ -144,6 +147,7 @@ if do_elog:
log_msg = log_msg + "Energy gain: %0.3f" % fit_amplitude + " MeV \n"
log_msg = log_msg + "VS-phase offset: %0.2f" % phase_offset + " deg \n"
log_msg = log_msg + "Amplitude scale: %0.3f" % amplitude_scale + " MV \n"
log_msg = log_msg + "Power scale: %0.7f" % power_scale + " MW/MV^2"
log_msg = log_msg + "Power scale: %0.7f" % power_scale + " MW/MV^2 \n"
log_msg = log_msg + "Dispersion: %0.4f" % disp + " mm"
attachments = get_plot_snapshots(size=(600,400))
elog(title, log_msg, attachments)
+1 -1
View File
@@ -31,6 +31,6 @@ if n > 0:
log_msg = ""
if (phase_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %12.2f" % phase_offset + " deg (was %12.2f" % phase_offset_old + " deg )\n"
if (ampli_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-AMPLT-SCALE: %12.3f" % amplitude_scale + " MV (was %12.3f" % amplitude_scale_old + " MV )\n"
if (power_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VOLT-POWER-SCALE: %12.7f" % power_scale + " MW/MV^2 (was %12.5f" % power_scale_old + " MW/MV^2)"
if (power_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VOLT-POWER-SCALE: %12.7f" % power_scale + " MW/MV^2 (was %12.7f" % power_scale_old + " MW/MV^2)"
attachments = []
elog(title, log_msg, attachments)
+39
View File
@@ -0,0 +1,39 @@
E1 = 3722.0 # old energy
E2 = 3789.0 # new energy
do_elog = True
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
#stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04")
stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04","S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
A1, A2 = {}, {}
P1, P2 = {}, {}
for station in stationlist:
A = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE") # MV/unit
P = caget(station + "-RSYS:SET-VOLT-POWER-SCALE") # MW/MV^2
A1[station] = A
A2[station] = A * E2 / E1
P1[station] = P
P2[station] = P * (E1 / E2)**2
# set RF on-delay
caput("SIN-TIMAST-TMA:Beam-RF-Delay-Sel",1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
for station in stationlist:
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", A2[station])
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", P2[station])
caput(station + "-RSYS:CMD-LOAD-CALIB-BEAM", 1)
# set RF on-beam
caput("SIN-TIMAST-TMA:Beam-RF-Delay-Sel",0)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
#Elog entry
if do_elog:
title = "Energy calibration scaling"
log_msg = "Old energy: %0.2f" % E1 + " MeV/c\n"
log_msg = log_msg + "New energy: %0.2f" % E2 + " MeV/c\n\n"
log_msg = log_msg + " A1 A2 P1 P2 \n"
for station in stationlist:
log_msg = log_msg + station + "%10.2f%10.2f%10.6f%10.6f" % (A1[station],A2[station],P1[station],P2[station]) + " \n"
attachments = None
elog(title, log_msg)
+41
View File
@@ -0,0 +1,41 @@
E1 = 288.91 # old energy
E2 = 300.00 # new energy
do_elog = True
stationlist = ("SINSB03","SINSB04","SINXB01")
#stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
#stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04")
#stationlist = ("S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
A1, A2 = {}, {}
P1, P2 = {}, {}
for station in stationlist:
A = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE") # MV/unit
P = caget(station + "-RSYS:SET-VOLT-POWER-SCALE") # MW/MV^2
A1[station] = A
A2[station] = A * E2 / E1
P1[station] = P
P2[station] = P * (E1 / E2)**2
# set RF on-delay
caput("SIN-TIMAST-TMA:Beam-RF-Delay-Sel",1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
for station in stationlist:
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", A2[station])
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", P2[station])
caput(station + "-RSYS:CMD-LOAD-CALIB-BEAM", 1)
# set RF on-beam
caput("SIN-TIMAST-TMA:Beam-RF-Delay-Sel",0)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
#Elog entry
if do_elog:
title = "Energy calibration scaling"
log_msg = "Old energy: %0.2f" % E1 + " MeV/c\n"
log_msg = log_msg + "New energy: %0.2f" % E2 + " MeV/c\n\n"
log_msg = log_msg + " A1 A2 P1 P2 \n"
for station in stationlist:
log_msg = log_msg + station + "%10.2f%10.2f%10.6f%10.6f" % (A1[station],A2[station],P1[station],P2[station]) + " \n"
attachments = None
elog(title, log_msg)
+3 -10
View File
@@ -1,5 +1,5 @@
Eph1 = 9.45 # actual photon energy
Eph2 = 12.0 # desired photon energy
Eph1 = 11.312 # actual photon energy
Eph2 = 12.00 # desired photon energy
do_elog = True
@@ -11,22 +11,15 @@ for und in undlist:
K1[und] = K
K2[und] = ((Eph1 / Eph2 * (K**2 + 2) - 2))**0.5
print K1,K2
# 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", 1.1)
# time.sleep(40.0)
for und in undlist: caput(und + "-UIND030:K_SET", K2[und])
time.sleep(10.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"
attachments = none
attachments = None
elog(title, log_msg, attachments)
+74 -23
View File
@@ -25,20 +25,51 @@ LayoutSF.setExperimentArguments([charge, laser, rep_rate, destination_AR, energy
LASER_SETTLING_TIME = 3.0
def laser_on():
print "Laser On"
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0)
def laser_on(bunch=None):
print "Laser On - bunch “ + str(bunch)
#caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0)
if (bunch==1) or (bunch is None):
caput("SWISSFEL-STATUS:Bunch-1-OnDelay-Sel", 0)
if (bunch==2) or (bunch is None):
caput("SWISSFEL-STATUS:Bunch-2-OnDelay-Sel", 0)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
time.sleep(LASER_SETTLING_TIME)
def laser_off():
print "Laser Off"
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1)
def laser_off(bunch=None):
print "Laser Off - bunch “ + str(bunch)
#caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1)
if (bunch==1) or (bunch is None):
caput("SWISSFEL-STATUS:Bunch-1-OnDelay-Sel", 1)
if (bunch==2) or (bunch is None):
caput("SWISSFEL-STATUS:Bunch-2-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
time.sleep(LASER_SETTLING_TIME)
def is_laser_on():
return (caget ("SIN-TIMAST-TMA:Beam-Las-Delay-Sel",'d') == 0 )
def is_laser_on(bunch=None):
#return (caget ("SIN-TIMAST-TMA:Beam-Las-Delay-Sel",'d') == 0 )
if bunch==1:
return (caget ("SWISSFEL-STATUS:Bunch-1-OnDelay-Sel",'d') == 0 )
if bunch==2:
return (caget ("SWISSFEL-STATUS:Bunch-2-OnDelay-Sel",'d') == 0 )
if bunch is None:
return is_laser_on(1) and is_laser_on(2)
def save_laser_state():
global laser_was_on_1, laser_was_on_2
laser_was_on_1 = is_laser_on(1)
laser_was_on_2 = is_laser_on(2)
def restore_laser_state():
global laser_was_on_1, laser_was_on_2
if laser_was_on_1:
laser_on(1)
else:
laser_off(1)
if laser_was_on_2:
laser_on(2)
else:
laser_off(2)
# Switch off magnets
def ccr(magnet):
@@ -66,8 +97,15 @@ def switch_off_magnets(magnets = None):
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")
def get_repetition_rate(bunch=1, setp=False):
#return caget("SIN-TIMAST-TMA:Evt-15-Freq-I")
if setp:
sel = caget("SIN-TIMAST-TMA:Bunch-" + str(bunch) + "-Freq-Sel")
return float(sel.split(" ")[0])
if bunch==2:
return caget("SIN-TIMAST-TMA:Bunch-2-Appl-Freq-RB", 'd')
else:
return caget("SIN-TIMAST-TMA:Bunch-1-Appl-Freq-RB", 'd')
def ws_status():
"""
@@ -75,6 +113,13 @@ def ws_status():
"""
run("Diagnostics/WireScannersStatus")
def get_beam_ok_channel(bunch):
if bunch==2:
return "SIN-CVME-TIFGUN-EVR0:BUNCH-2-OK"
if bunch==1:
return "SIN-CVME-TIFGUN-EVR0:BUNCH-1-OK"
###################################################################################################
# Maths utilities
###################################################################################################
@@ -336,11 +381,16 @@ def get_camera_type(camera_name):
# source = "server", "camtool", "bpm" or "direct"
def setup_camera_scan():
global source, camera_name, bpm_name, number_images, use_background, multiple_background, number_backgrounds, dry_run, laser_was_on
laser_was_on = is_laser_on()
global source, camera_name, bpm_name, number_images, use_background, multiple_background, number_backgrounds, dry_run
if not is_laser_on(1) and not is_laser_on(2):
raise Exception("Both bunches are on delay")
save_laser_state()
multiple_background = multiple_background and use_background
if source == "server":
cam_server.start(camera_name)
if use_screen_panel_stream:
cam_server.start(camera_name + "_sp1", True)
else:
cam_server.start(camera_name)
if use_background:
if not dry_run:
laser_off()
@@ -379,7 +429,8 @@ def setup_camera_scan():
if not multiple_background:
if not dry_run:
laser_on()
#laser_on()
restore_laser_state()
def before_sample_camera_scan():
global source, camera_name, number_images, use_background, multiple_background, number_backgrounds, dry_run
@@ -388,7 +439,8 @@ def before_sample_camera_scan():
bg = cam_server.captureBackground(number_backgrounds)
wait_cam_server_background(bg)
if not dry_run:
laser_on()
#laser_on()
restore_laser_state()
wait_cam_server_message(number_images)
elif source == "camtool":
if multiple_background:
@@ -396,12 +448,14 @@ def before_sample_camera_scan():
camtool.grabBackground(camera_name, number_backgrounds)
camtool.start(camera_name, 0, use_background, None, 0.0, None)
if not dry_run:
laser_on()
#laser_on()
restore_laser_state()
wait_camtool_message(number_images) #Wait filing the averager cache
else:
if multiple_background:
image_stats.grabBackground(number_backgrounds)
laser_on()
#laser_on()
restore_laser_state()
image_stats.update()
def after_sample_camera_scan():
@@ -426,17 +480,14 @@ def get_camera_scan_sensors():
return sensors
def end_camera_scan():
global source, camera_name, number_images, use_background, multiple_background, number_backgrounds, dry_run, laser_was_on
global source, camera_name, number_images, use_background, multiple_background, number_backgrounds, dry_run
#if source == "server": cam_server.stop()
#elif source == "camtool": camtool.stop()
#elif source == "camtool": camtool.stop()
#else: image_stats.stop()
if not dry_run:
if laser_was_on:
laser_on()
else:
laser_off()
pass
restore_laser_state()
###################################################################################################
#CAS
###################################################################################################
+1 -1
View File
@@ -13,7 +13,7 @@ BLMS = ["SINDI02-DBLM025", ] #"SINDI02-DBLM085", "S10DI01-DBLM045"]
sensors = []
st = Stream("pulse_id", dispatcher)
#st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
#st.setFilter(get_beam_ok_channel(bunch=1) + " == 1")
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 1, 0)
av = create_averager(blm, SAMPLES, interval = -1)
-6
View File
@@ -33,7 +33,6 @@ else:
centroid_excursion_plot = False
#laser_was_on = is_laser_on()
positioner = DummyPositioner("positioner")
original_gun_solenoid = positioner.read()
@@ -60,11 +59,6 @@ finally:
end_camera_scan()
positioner.write(original_gun_solenoid)
#if laser_was_on:
# laser_on()
#else:
# laser_off()
# take the result of the scan and generate convex hull plot
if centroid_excursion_plot:
+8
View File
@@ -0,0 +1,8 @@
from jeputils import *
data, dims = [1,2,3,4,5,6,7,8,9,0], [2,5]
array = to_npa(data, dims,'d') #Auxiliary function to create numpy arrays from lists or java arrays.
ret = call_jep("test/cpython", "calc", [array,])
print ret.getDimensions(),ret.getData()
ret = call_jep("test/cpython", "test_pandas")
+16
View File
@@ -0,0 +1,16 @@
channels = ["SIN-CVME-TIFGUN-EVR0:BUNCH-1-OK", "SIN-CVME-TIFGUN-EVR0:BUNCH-2-OK", \
"S10BC01-DBPM010:Q1","S10DI01-DICT025:B1_CHARGE", "SINEG01-DICT210:GUN_CHARGE"]
st = Stream("st", dispatcher)
for c in channels:
st.addScalar(c, c, 1, 0)
try:
st.initialize()
st.start(True)
st.waitCacheChange(3000)
bscan(st, 100)
except:
st.close()
+38
View File
@@ -0,0 +1,38 @@
from ch.psi.pshell.bs import Stream
from ch.psi.pshell.bs import Provider
from ch.psi.pshell.bs.ProviderConfig import SocketType;
sources = [
#"tcp://sf-daqsync-06.psi.ch:9000", #AARES20-CAMS142-M4 Image Buffer
"tcp://sf-daqsync-06.psi.ch:9001", #AARES20-CAMS142-M4Data Buffer
#"tcp://sf-daqsync-06.psi.ch:9010", #SARES20-CAMS142-M5 Image Buffer
#"tcp://sf-daqsync-06.psi.ch:9011", #SARES20-CAMS142-M5 Data Buffer
#"tcp://sf-daqsync-05.psi.ch:9000", #SARES11-SPEC125-M1 Image Buffer
#"tcp://sf-daqsync-05.psi.ch:9001", #SARES11-SPEC125-M1 Data Buffer
#"tcp://sf-daqsync-05.psi.ch:9010", #SARES11-SPEC125-M2 Image Buffer
#"tcp://sf-daqsync-05.psi.ch:9011", #SARES11-SPEC125-M2 Data Buffer
]
class StreamListener (DeviceListener):
def onCacheChanged(self, device, value, former, timestamp, valueChange):
print value.pulseId
l = StreamListener()
for src in sources:
p = Provider("Provider",src, SocketType.PULL)
s = Stream("Stream", p)
try:
p.initialize()
s.initialize()
s.start(True)
#s.addListener(l)
s.waitCacheChange(3000)
v = s.getValues()
print "SUCCESS getting data from: ", src , " value=", v
#time.sleep(60.0)
except:
print "ERROR getting data from: ", src
finally:
s.close()
p.close()
+2 -2
View File
@@ -1,8 +1,8 @@
run("Diagnostics/sig_process_wrapper")
import random
#Loading test data
#p=get_plots("Wire Scan")[0]
#s=p.getSeries(0)
#s=p.getSeries(0)fra
#indexes = sorted(range(len(s.x)),key=lambda x:s.x[x])
#x,y = [s.x[x] for x in indexes], [s.y[x] for x in indexes]
x=[-200.30429237268825, -200.2650700434188, -200.22115208318002, -199.9457671375377, -199.86345548879072, -199.85213073174933, -199.35687977133284, -199.13811861090275, -197.97304970346386, -197.2952215624348, -195.09076092936948, -192.92276048970703, -191.96871876227698, -189.49577852322938, -187.9652790409825, -183.63756456925222, -180.04899765472996, -178.43839623242422, -174.07311671294445, -172.0410133577918, -165.90824309893102, -160.99771795989466, -159.30176653939253, -154.27688897558514, -152.0854103810786, -145.75652847587313, -140.80843828908465, -139.23982133191495, -134.27073891256106, -132.12649284133064, -125.95947209775511, -121.00309550337462, -119.26736932643232, -114.2706655484383, -112.07393889578914, -105.72295990367157, -100.8088439880125, -99.2034906238494, -94.30042325164636, -92.15010048151461, -85.92203653534293, -81.03913275494665, -79.27412793784428, -74.33487658582118, -72.06274362408762, -65.76562628131825, -60.91255356825276, -59.20334389560392, -54.33286972659312, -52.19387171350535, -45.94978737932291, -41.03014719193582, -39.301602568238906, -34.35572209014114, -32.04464301272608, -25.8221033382824, -20.922074315528747, -19.21590299233186, -14.31090212502093, -12.217203140101386, -5.9283722049240435, -0.9863587170369246, 0.7408048387279834, 5.71126832601389, 7.972628957879352, 14.204559894256546, 19.11839959633025, 20.8218087836657, 25.678748486941828, 27.822718344586864, 34.062659474970715, 38.9745656819391, 40.77409719734158, 45.72080631619803, 47.974156754056835, 54.23453768983539, 59.12020360609568, 60.77306570712026, 65.70734521458867, 67.8344660434617, 74.03187028154134, 78.96532114824849, 80.76070945985495, 85.74802197591286, 87.9140889204674, 94.18082276873524, 99.25790470037091, 100.68454787413205, 105.7213026221542, 107.79483801526698, 113.99555681638138, 119.0707052529143, 120.72715813056156, 125.77551384921307, 127.91257836719551, 134.2011330887875, 139.23043006997628, 140.71673537840158, 145.76288138835983, 147.80216629676042, 154.06420451405637, 159.0846626604798, 160.76183155710717, 165.73699067536242, 167.9265357747636, 173.96705069576544, 178.2522282751915, 179.9042617354548, 183.54586165856657, 185.23269803071796, 189.41678143751972, 191.87149157986588, 192.8741468985015, 195.0241934550453, 195.966634211846, 197.9821647518146, 198.99006812859284, 199.33202054855676, 199.91897441965887, 200.11536227958896, 200.22280936469997, 200.25181179127208]
+1 -2
View File
@@ -59,7 +59,7 @@ def after():
sensors = []
line_plots = []
st = Stream("pulse_id", dispatcher)
st.setFilter("SIN-CVME-TIFGUN-EVR0:BEAMOK == 1")
st.setFilter(get_beam_ok_channel(bunch=1) + " == 1")
for i in range(len(BLMS)):
blm = Scalar("blm" + str(i+1), st, BLMS[i] + ":B1_LOSS", 1, 0)
av = create_averager(blm, SAMPLES, interval = -1)
@@ -87,7 +87,6 @@ for i in range(len(BPMS)):
sensors.append(av1.samples)
line_plots.append(av1.samples)
#Scalar("beam_ok" , st, "SIN-CVME-TIFGUN-EVR0:BEAMOK" , 1, 0)
try:
st.initialize()
st.start()
+2 -2
View File
@@ -2,14 +2,14 @@ blm = "S10DI01-DBLM045"
channels = ["S10DI01-DWSC010:CURR_CYCL","S10CB02-DBPM420:X1","S10DI01-DWSC010:SCANNING",blm+":WS_RUNNING", \
"S10CB02-DBPM420:Y1","S10DI01-DBLM015:B1_LOSS","S10CB02-DBPM420:Q1","S10BD01-DBPM020:Q1","S10DI01-DWSC010:ENC_1_BS", \
"S10BD01-DBPM020:X1","S10BD01-DBPM020:Y1",blm+":B1_LOSS","SIN-CVME-TIFGUN-EVR0:BEAMOK"]
"S10BD01-DBPM020:X1","S10BD01-DBPM020:Y1",blm+":B1_LOSS",get_beam_ok_channel(bunch=1)]
blm = "SARCL02-DBLM135"
channels =[blm+":B1_LOSS", blm+":WS_RUNNING",
"SARCL01-DWSC160:CURR_CYCL","SARCL01-DWSC160:SCANNING","SARCL02-DBPM110:Q1","SARCL02-DBPM110:X1",
,"SARCL01-DBPM150:Y1","SARCL01-DBPM150:X1","SARCL01-DWSC160:ENC_1_BS","SARCL02-DBPM110:Y1",\
"SARCL01-DBPM150:Q1","SIN-CVME-TIFGUN-EVR0:BEAMOK",
"SARCL01-DBPM150:Q1",get_beam_ok_channel(bunch=1),
#"SARCL02-DBLM355:B1_LOSS" ,
]
+116
View File
@@ -0,0 +1,116 @@
###################################################################################################
# This moddule is called by demo scripts to execute and embed CPython.
# Must be put in the scripts folder, or else in the python path.
###################################################################################################
import sys
import os
import matplotlib
matplotlib.use('TkAgg')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
try:
import tkinter as tk
except:
import Tkinter as tk
def calc(array):
return np.transpose(array + array)
def test_pandas():
s = pd.Series([1,3,5,np.nan,6,8])
print (s)
dates = pd.date_range('20130101', periods=6)
print (dates)
df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))
print (df)
df2 = pd.DataFrame({ 'A' : 1.,
'B' : pd.Timestamp('20130102'),
'C' : pd.Series(1,index=list(range(4)),dtype='float32'),
'D' : np.array([3] * 4,dtype='int32'),
'E' : pd.Categorical(["test","train","test","train"]),
'F' : 'foo' })
print (df2)
print (df2.dtypes)
print (df.head())
print (df.tail(3))
print (df.values)
print (df.describe())
print (df.T)
print (df.sort_index(axis=1, ascending=False))
#print (df.sort_values(by='B'))
print (df['A'])
print (df[0:3])
print (df.mean())
return str(df.mean())
def test_tkinter():
root = tk.Tk()
listb = tk.Listbox(root)
for item in ["Hello", "World"]:
listb.insert(0,item)
listb.pack()
root.mainloop()
def test_matplotlib(start,stop,step):
import threading
x = np.arange(start,stop,step)
y = np.exp(-x)
# example variable error bar values
yerr = 0.1 + 0.2*np.sqrt(x)
xerr = 0.1 + yerr
# First illustrate basic pyplot interface, using defaults where possible.
plt.figure()
plt.errorbar(x, y, xerr=0.2, yerr=0.4)
plt.title("Simplest errorbars, 0.2 in x, 0.4 in y")
# Now switch to a more OO interface to exercise more features.
fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True)
ax = axs[0,0]
ax.errorbar(x, y, yerr=yerr, fmt='o')
ax.set_title('Vert. symmetric')
# With 4 subplots, reduce the number of axis ticks to avoid crowding.
ax.locator_params(nbins=4)
ax = axs[0,1]
ax.errorbar(x, y, xerr=xerr, fmt='o')
ax.set_title('Hor. symmetric')
ax = axs[1,0]
ax.errorbar(x, y, yerr=[yerr, 2*yerr], xerr=[xerr, 2*xerr], fmt='--o')
ax.set_title('H, V asymmetric')
ax = axs[1,1]
ax.set_yscale('log')
# Here we have to be careful to keep all y values positive:
ylower = np.maximum(1e-2, y - yerr)
yerr_lower = y - ylower
ax.errorbar(x, y, yerr=[yerr_lower, 2*yerr], xerr=xerr,
fmt='o', ecolor='g', capthick=2)
ax.set_title('Mixed sym., log y')
fig.suptitle('Variable errorbars')
plt.show()
return [start,stop,step]
if __name__ == "__main__":
x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show()
+18
View File
@@ -0,0 +1,18 @@
#devlist = ['SARCL02-MSEX255:I-SET', 'SARCL02-MSEX305:I-SET']
devlist = ['SARCL02-MCRX100:I-SET', 'SARCL02-MCRX120:I-SET', 'SARCL02-MCRX200:I-SET', 'SARCL02-MCRX230:I-SET',
'SARCL02-MCRX240:I-SET', 'SARCL02-MCRX400:I-SET', 'SARCL02-MCRX480:I-SET', 'SARCL02-MCRX500:I-SET',
'SARCL02-MCRX320:I-SET', 'SARCL02-MCRX340:I-SET', 'SARCL02-MCRX450:I-SET' ]
#SARCL02-MCRY120:I-SET, SARCL02-MCRY230:I-SET, SARCL02-MCRY240:I-SET, SARCL02-MCRY480:I-SET,
#SARCL02-MCRY320:I-SET, SARCL02-MCRY340:I-SET, SARCL02-MCRY450:I-SET
energy = 2840.0
energynew = 3398.0
efactor = energynew / energy
print(efactor)
for dev in devlist:
print('\n' + dev)
acq = caget(dev)
print(acq)
setval = acq * efactor
print(setval)
caput(dev, setval)