From dbe1078ff30efbe98a1910598681ba802fcdf336 Mon Sep 17 00:00:00 2001 From: voulot_d Date: Wed, 22 Jun 2016 15:14:07 +0200 Subject: [PATCH] Startup --- config/agkey | 27 -- config/config.properties | 19 +- config/devices.properties | 20 +- config/jcae.properties | 5 +- config/setup.properties | 3 +- devices/Phase.properties | 8 + devices/SARUN02-MCRX080.properties | 8 - devices/SARUN02-MCRY080.properties | 8 - devices/SARUN02_MCRX080.properties | 8 - devices/SARUN02_MCRY080.properties | 8 - devices/SINSB01_phase.properties | 8 - devices/beam_phase.properties | 8 - devices/bpm_1_down_gun.properties | 8 - devices/cv.properties | 8 - devices/dp1.properties | 11 - devices/gun_phase.properties | 8 - devices/gun_sol_current.properties | 8 - devices/m1.properties | 12 - devices/m2.properties | 12 - devices/m3.properties | 12 - devices/mot.properties | 12 - devices/p1.properties | 8 - devices/pos.properties | 10 +- devices/pv.properties | 8 - devices/src1.properties | 13 - devices/src2.properties | 13 - script/Alignment/Gun_solenoid_alignment.py | 34 -- script/Alignment/Gun_solenoid_alignment_dv.py | 99 ----- script/Alignment/Laser_gun_alignment.py | 37 -- script/Alignment/Laser_gun_alignment_dv.py | 57 --- script/RFscan/RF_phase_scan.py | 25 -- script/local.py | 348 ++++++++++-------- .../phase_scan_caqtdm.py => phase_scan.py} | 0 script/test/Gun_solenoid_alignment_dv_test.py | 49 --- script/test/SARUN02_MCOR_scan.py | 1 - script/test/bla.py | 21 -- script/test/phase_scan.py | 36 -- script/test/phase_scan_dv.py | 15 - script/test/pouet.py | 29 -- script/test/region_scan_with_elog.py | 7 - script/test/rf_phase_scan.py | 1 - script/test/test.py | 2 - script/test/test_Simona.py | 52 --- script/test/toto.py | 21 -- 44 files changed, 227 insertions(+), 880 deletions(-) delete mode 100755 config/agkey create mode 100644 devices/Phase.properties delete mode 100755 devices/SARUN02-MCRX080.properties delete mode 100755 devices/SARUN02-MCRY080.properties delete mode 100755 devices/SARUN02_MCRX080.properties delete mode 100755 devices/SARUN02_MCRY080.properties delete mode 100755 devices/SINSB01_phase.properties delete mode 100755 devices/beam_phase.properties delete mode 100755 devices/bpm_1_down_gun.properties delete mode 100755 devices/cv.properties delete mode 100755 devices/dp1.properties delete mode 100755 devices/gun_phase.properties delete mode 100755 devices/gun_sol_current.properties delete mode 100755 devices/m1.properties delete mode 100755 devices/m2.properties delete mode 100755 devices/m3.properties delete mode 100755 devices/mot.properties delete mode 100755 devices/p1.properties delete mode 100755 devices/pv.properties delete mode 100755 devices/src1.properties delete mode 100755 devices/src2.properties delete mode 100755 script/Alignment/Gun_solenoid_alignment.py delete mode 100644 script/Alignment/Gun_solenoid_alignment_dv.py delete mode 100755 script/Alignment/Laser_gun_alignment.py delete mode 100644 script/Alignment/Laser_gun_alignment_dv.py delete mode 100644 script/RFscan/RF_phase_scan.py rename script/{RFscan/phase_scan_caqtdm.py => phase_scan.py} (100%) delete mode 100644 script/test/Gun_solenoid_alignment_dv_test.py delete mode 100755 script/test/SARUN02_MCOR_scan.py delete mode 100755 script/test/bla.py delete mode 100755 script/test/phase_scan.py delete mode 100644 script/test/phase_scan_dv.py delete mode 100755 script/test/pouet.py delete mode 100755 script/test/region_scan_with_elog.py delete mode 100755 script/test/rf_phase_scan.py delete mode 100755 script/test/test.py delete mode 100755 script/test/test_Simona.py delete mode 100755 script/test/toto.py diff --git a/config/agkey b/config/agkey deleted file mode 100755 index a5060b8..0000000 --- a/config/agkey +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAvEQPJ+OW/ctH32MZKHln9+vXvMpST3UOJbk9nPTGM7bYYMjs -bEjg9hHNTHtr+VA4AtQzmzOXeAPqG5zy1lAcoPMrz3Kj9fou86cdMxbN6ei3rFVb -9dDSMLGrGAVuR+iTAch0FNVru5BvZm4s+fn3pyYuy1GcKLv7/pyYdoqiYdUm7ZDL -VhFJjtSmIswCArcv5rpvlTHLGmLirEq9KC6xkcoWnyPACAw/rbWKUuVobXcrcoic -G6N4gZt5Ekl7qg3AUFnKtw2/l6rfx4WFZjRdevGx7k14I4m6UCv/t040dMhCyUXJ -zP73WZTdV3TR4C643ZXkoXNlnlm8uOeSvOy85wIDAQABAoIBAFJddEP/Tg+637bb -pCYQ92t/wuLVoS0iCQ53/HyumggF9qRhQw4c1E7Tev37AUIR1m9mZy1/ZMUc8U8j -Wxpn8h54RLJ9dT4oNmJiumOflna/WZwLvC/PLCYhlLjtp1HOboJZMG/s7zUf+5zU -ltjGg5KdIdvR2H/5vkWmPQ2fmWszFVKbB+RPX9NbAcQMIXwATcIN3tbsISuydaf6 -w0Laa07oGpcMYTJzP1TJAVluUHWfouPoHdDcVc0g737o1wIFQ35e6bbYzM5zBkHJ -dQo7CeET+5+HZjsC9MQRiWw853GYJp0w+bKjDov/aIBJt6ZVx+KB8sZccSofVbaY -JvpwAAECgYEA6nHID0Lgo/P0aFneo38c9MlEdGRLxrfXwsY8LhnKtkF0wgz1Is40 -be6cVIz/XzXvHnB3WrAMsdz2MPiU4COz5T48z9hNcb/BMrVvNCN3x2Bu/FU4qMVU -vKJIhsL9Hq/TF3W0crA+DObvl9Kv4tIQ7hQK/xvbGpsoOiqV4A26Lu8CgYEAzZNa -Nl3W5Ut+VqaEdnED26pbZtzM8eLwioUNme9Etl+WrJQervNf8j8GJ8BUhOVjQrDT -hqA2bkXfBqxYaW2G8wnOVhq6jqLFfb3yZjpOsUf1T2x7naHW2Z3VEPlnMez2GJB/ -/jkRegcXqPMtk8TahbaY/gTjOc+eFTefuDuQUYkCgYAKxlfve59faaLd+ONmmDz4 -cxeWUdW5uFFOPlYduEm8vp1jHb1WcCuwsbq1mBVUhuIKgBi8LkMnGYSnE4WkF3/5 -FTcuRj6o76stbXFC8C5dF22CY1hLSWZvlPXIW8XOVz5YYax9aOQxK5vvWluDDSyC -BKHMv7b+LgtXQQXKWlcoOQKBgAv7hsqcdaYv3FFYq2fr9nmbWHCKdjezLqokT0Kl -u6+Vqsasa41vCiyol8dBYqvMYxjEDdBPDl0nHXTaHt0mUTNhYvGJ5U3jFvfZVoO2 -6ldTBm12uU3a3RcaKA0xPF6gnUeZRJyg3u/p8esbIZD3bHVWy1wjFMuN2n0KHPk0 -H5lhAoGAO8YqRVnHOoz7HeA16+LZoOorDA9r/NEN3/K/jgOJPfrm3CV205Ew7mvQ -Y6im34HAcjHp2fz/kxE0S4vd2iWapMpiQu0U2yvLdX+861pkM/ffAg6x3nEJChzp -lh8rxqEJy4PukTBxUAL0h5wnOWkRYFgOVcx60rHvYJZ8+Qf3lbc= ------END RSA PRIVATE KEY----- diff --git a/config/config.properties b/config/config.properties index 426203c..b2263f2 100755 --- a/config/config.properties +++ b/config/config.properties @@ -1,26 +1,21 @@ -#Thu May 19 13:16:56 CEST 2016 +#Thu May 19 13:18:31 CEST 2016 autoSaveScanData=true createSessionFiles=false dataLayout=default -dataPath={data}/{year}_{month}/{date}/{date}_{time}_{exec} -dataProvider=default +dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name} +dataProvider=h5 dataScanFlushRecords=true -dataScanStrategy=default dataServerPort=-1 -devicePoolFile={config}/devices.properties -deviceUpdateStrategyFile={config}/update.properties hostName=null -instanceName=OP +instanceName=RF logDaysToLive=-1 -logLevel=Info +logLevel=Fine logLevelConsole=Off logPath={logs}/{date}_{time} scanStreamerPort=-1 -scanStreamingPort=-1 serverEnabled=true -serverPort=8080 +serverPort=8090 simulation=false -tasksFile={config}/tasks.properties terminalEnabled=false terminalPort=3579 userAuthenticator= @@ -28,4 +23,4 @@ userManagement=false versionTrackingEnabled=true versionTrackingLogin={context}/svcusr-hlapp_robot versionTrackingManual=false -versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-op.git +versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-rf.git diff --git a/config/devices.properties b/config/devices.properties index 142f569..7ba5141 100755 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,16 +1,4 @@ -bpm_1_down_gun=ch.psi.pshell.epics.Positioner|SINEG01-DBPM340:X1 SINEG01-DBPM340:Y1|Read||true -gun_sol_current=ch.psi.pshell.epics.Positioner|SINEG01-MSOL130:I-SET SINEG01-MSOL130:I-SET|||true -gun_phase=ch.psi.pshell.epics.Positioner|SINEG01-RSYS:SET-VSUM-PHASE SINEG01-RSYS:SET-VSUM-PHASE|||true -#SINSB01_phase=ch.psi.pshell.epics.Positioner|VA-SINSB01-RSYS100:SET-BEAM-PHASE VA-SINSB01-RSYS100:GET-BEAM-PHASE|||true -#BC1_energy=ch.psi.pshell.epics.ChannelDouble|VA-SINBC02-DBPM140:ENERGY|Read||true -#SARUN02_MCRX080=ch.psi.pshell.epics.Positioner|VA-SARUN02-MCRX080:I-SET VA-SARUN02-MCRX080:I-READ|||true -#SARUN02_MCRY080=ch.psi.pshell.epics.Positioner|VA-SARUN02-MCRY080:I-SET VA-SARUN02-MCRY080:I-READ|||true -#SARUN03_DBPM070_X=ch.psi.pshell.epics.ChannelDouble|VA-SARUN03-DBPM070:X1|Read||true -#chd=ch.psi.pshell.epics.ChannelDouble|VA-SINSB01-RSYS100:SET-BEAM-PHASE 3|||true -#pv=ch.psi.pshell.epics.ProcessVariable|VA-SINSB01-RSYS100:SET-BEAM-PHASE|||true -#cv=ch.psi.pshell.epics.ControlledVariable|VA-SINSB01-RSYS100:SET-BEAM-PHASE VA-SINSB01-RSYS100:GET-BEAM-PHASE|||true -#pos=ch.psi.pshell.epics.Positioner|VA-SINSB01-RSYS100:SET-BEAM-PHASE VA-SINSB01-RSYS100:GET-BEAM-PHASE|||true -#mot=ch.psi.pshell.device.DummyMotor||||true -#rf_phase=ch.psi.pshell.epics.ChannelDouble|MINSB03-RSYS:SET-VSUM-PHASE|||true -#rf_phase_rb=ch.psi.pshell.epics.ChannelDouble|MINSB03-RSYS:GET-VSUM-PHASE|Read||true -#rf_ampl_rb=ch.psi.pshell.epics.ChannelDouble|MINSB03-RSYS:GET-VSUM-AMPLT|Read||true +$rf_phase=ch.psi.pshell.epics.ChannelDouble|MINSB03-RSYS:SET-VSUM-PHASE|||true +rf_phase_rb=ch.psi.pshell.epics.ChannelDouble|MINSB03-RSYS:GET-VSUM-PHASE|Read||true +rf_ampl_rb=ch.psi.pshell.epics.ChannelDouble|MINSB03-RSYS:GET-VSUM-AMPLT|Read||true +$pos=ch.psi.pshell.device.DummyPositioner||||true diff --git a/config/jcae.properties b/config/jcae.properties index 1bae494..da0e3c9 100755 --- a/config/jcae.properties +++ b/config/jcae.properties @@ -1,7 +1,8 @@ -#Wed May 04 14:26:21 CEST 2016 -ch.psi.jcae.ContextFactory.addressList=129.129.130.255 129.129.131.255 129.129.137.255 +#Thu May 19 14:19:11 CEST 2016 +ch.psi.jcae.ContextFactory.addressList=129.129.130.255 129.129.131.255 129.129.137.255 129.129.137.113 129.129.146.255 127.0.0.1\:12345 ch.psi.jcae.ContextFactory.maxArrayBytes=10000000 ch.psi.jcae.ChannelFactory.retries=2 ch.psi.jcae.ChannelFactory.timeout=500 ch.psi.jcae.impl.DefaultChannelService.retries=4 ch.psi.jcae.impl.DefaultChannelService.timeout=1000 +ch.psi.jcae.ContextFactory.serverPort= diff --git a/config/setup.properties b/config/setup.properties index 216c670..2142f62 100755 --- a/config/setup.properties +++ b/config/setup.properties @@ -1,9 +1,8 @@ -#Wed Dec 09 13:50:24 CET 2015 +#Tue May 10 16:47:46 CEST 2016 configFile={config}/config.properties configFileDevices={config}/devices.properties configFilePlugins={config}/plugins.properties configFileTasks={config}/tasks.properties -configFileUpdateStrategy={config}/update.properties configPath={home}/config contextPath={outp}/context dataPath={outp}/data diff --git a/devices/Phase.properties b/devices/Phase.properties new file mode 100644 index 0000000..97f7ce8 --- /dev/null +++ b/devices/Phase.properties @@ -0,0 +1,8 @@ +#Mon May 30 09:53:36 CEST 2016 +maxValue=0.0 +minValue=0.0 +offset=0.0 +precision=0 +resolution=NaN +scale=1.0 +unit=DEG diff --git a/devices/SARUN02-MCRX080.properties b/devices/SARUN02-MCRX080.properties deleted file mode 100755 index 2c5d4b7..0000000 --- a/devices/SARUN02-MCRX080.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jan 06 17:01:23 CET 2016 -maxValue=5.0 -minValue=-5.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=A diff --git a/devices/SARUN02-MCRY080.properties b/devices/SARUN02-MCRY080.properties deleted file mode 100755 index 427a68a..0000000 --- a/devices/SARUN02-MCRY080.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jan 06 17:01:36 CET 2016 -maxValue=5.0 -minValue=-5.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=A diff --git a/devices/SARUN02_MCRX080.properties b/devices/SARUN02_MCRX080.properties deleted file mode 100755 index 671c895..0000000 --- a/devices/SARUN02_MCRX080.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jan 06 17:10:52 CET 2016 -maxValue=5.0 -minValue=-5.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=A diff --git a/devices/SARUN02_MCRY080.properties b/devices/SARUN02_MCRY080.properties deleted file mode 100755 index 22e4997..0000000 --- a/devices/SARUN02_MCRY080.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jan 06 17:11:05 CET 2016 -maxValue=5.0 -minValue=-5.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=A diff --git a/devices/SINSB01_phase.properties b/devices/SINSB01_phase.properties deleted file mode 100755 index af191ca..0000000 --- a/devices/SINSB01_phase.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jan 06 16:18:41 CET 2016 -maxValue=360.0 -minValue=0.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=Degree diff --git a/devices/beam_phase.properties b/devices/beam_phase.properties deleted file mode 100755 index 149090e..0000000 --- a/devices/beam_phase.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Dec 09 14:42:00 CET 2015 -maxValue=360.0 -minValue=0.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=Degree diff --git a/devices/bpm_1_down_gun.properties b/devices/bpm_1_down_gun.properties deleted file mode 100755 index 9ba674a..0000000 --- a/devices/bpm_1_down_gun.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Tue May 10 13:57:11 CEST 2016 -maxValue=NaN -minValue=NaN -offset=0.0 -precision=-1 -resolution=NaN -scale=1.0 -unit=null diff --git a/devices/cv.properties b/devices/cv.properties deleted file mode 100755 index 813be07..0000000 --- a/devices/cv.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Fri Jan 08 10:12:30 CET 2016 -maxValue=360.0 -minValue=0.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=Degree diff --git a/devices/dp1.properties b/devices/dp1.properties deleted file mode 100755 index 771eef9..0000000 --- a/devices/dp1.properties +++ /dev/null @@ -1,11 +0,0 @@ -#Wed Dec 09 13:57:47 CET 2015 -motor1=0.0|4.0|8.0|0.0 -motor2=0.0|5.0|3.0|NaN -motor3=null -motor4=null -motor5=null -motor6=null -motor7=null -motor8=null -positions=Park|Ready|Out|Clear -precision=-1 diff --git a/devices/gun_phase.properties b/devices/gun_phase.properties deleted file mode 100755 index 5b67728..0000000 --- a/devices/gun_phase.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Tue May 10 09:59:44 CEST 2016 -maxValue=180.0 -minValue=-179.99 -offset=0.0 -precision=2 -resolution=1.0 -scale=1.0 -unit=DEG diff --git a/devices/gun_sol_current.properties b/devices/gun_sol_current.properties deleted file mode 100755 index c443463..0000000 --- a/devices/gun_sol_current.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Tue May 10 09:38:33 CEST 2016 -maxValue=210.0 -minValue=0.0 -offset=0.0 -precision=3 -resolution=NaN -scale=1.0 -unit=A diff --git a/devices/m1.properties b/devices/m1.properties deleted file mode 100755 index 2823983..0000000 --- a/devices/m1.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Wed Dec 09 13:57:47 CET 2015 -defaultSpeed=1.0 -estbilizationDelay=0 -maxSpeed=10.0 -maxValue=10.0 -minSpeed=0.1 -minValue=-10.0 -offset=0.0 -precision=2 -resolution=NaN -scale=1.0 -unit=mm diff --git a/devices/m2.properties b/devices/m2.properties deleted file mode 100755 index 2823983..0000000 --- a/devices/m2.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Wed Dec 09 13:57:47 CET 2015 -defaultSpeed=1.0 -estbilizationDelay=0 -maxSpeed=10.0 -maxValue=10.0 -minSpeed=0.1 -minValue=-10.0 -offset=0.0 -precision=2 -resolution=NaN -scale=1.0 -unit=mm diff --git a/devices/m3.properties b/devices/m3.properties deleted file mode 100755 index 84d6771..0000000 --- a/devices/m3.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Jan 08 10:18:25 CET 2016 -defaultSpeed=1.0 -estbilizationDelay=0 -maxSpeed=10.0 -maxValue=10.0 -minSpeed=0.1 -minValue=-10.0 -offset=0.0 -precision=2 -resolution=NaN -scale=1.0 -unit=mm diff --git a/devices/mot.properties b/devices/mot.properties deleted file mode 100755 index 558d71a..0000000 --- a/devices/mot.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Fri Jan 08 10:07:38 CET 2016 -defaultSpeed=1.0 -estbilizationDelay=0 -maxSpeed=10.0 -maxValue=10.0 -minSpeed=0.1 -minValue=-10.0 -offset=0.0 -precision=2 -resolution=NaN -scale=1.0 -unit=mm diff --git a/devices/p1.properties b/devices/p1.properties deleted file mode 100755 index fc08633..0000000 --- a/devices/p1.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Dec 09 13:57:47 CET 2015 -maxValue=1000.0 -minValue=0.0 -offset=0.0 -precision=-1 -resolution=NaN -scale=1.0 -unit=mm diff --git a/devices/pos.properties b/devices/pos.properties index 6f30f5f..b5c7c6b 100755 --- a/devices/pos.properties +++ b/devices/pos.properties @@ -1,8 +1,8 @@ -#Fri Jan 08 10:13:11 CET 2016 -maxValue=90.0 -minValue=0.0 +#Thu May 12 10:17:39 CEST 2016 +maxValue=180.0 +minValue=-180.0 offset=0.0 -precision=3 +precision=1 resolution=NaN scale=1.0 -unit=Degree +unit=null diff --git a/devices/pv.properties b/devices/pv.properties deleted file mode 100755 index 5ea8da8..0000000 --- a/devices/pv.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Fri Jan 08 10:09:44 CET 2016 -maxValue=0.0 -minValue=0.0 -offset=0.0 -precision=3 -resolution=0.01 -scale=1.0 -unit=Degree diff --git a/devices/src1.properties b/devices/src1.properties deleted file mode 100755 index e46a54e..0000000 --- a/devices/src1.properties +++ /dev/null @@ -1,13 +0,0 @@ -#Wed Dec 09 13:57:47 CET 2015 -colormap=Temperature -colormapAutomatic=true -colormapMax=255.0 -colormapMin=0.0 -flipHorizontally=false -flipVertically=false -grayscale=false -invert=false -rescaleFactor=1.0 -rescaleOffset=0.0 -rotation=0.0 -scale=1.0 diff --git a/devices/src2.properties b/devices/src2.properties deleted file mode 100755 index 09161b2..0000000 --- a/devices/src2.properties +++ /dev/null @@ -1,13 +0,0 @@ -#Wed Dec 09 13:57:47 CET 2015 -colormap=Grayscale -colormapAutomatic=true -colormapMax=255.0 -colormapMin=0.0 -flipHorizontally=false -flipVertically=false -grayscale=false -invert=false -rescaleFactor=1.0 -rescaleOffset=0.0 -rotation=0.0 -scale=1.0 diff --git a/script/Alignment/Gun_solenoid_alignment.py b/script/Alignment/Gun_solenoid_alignment.py deleted file mode 100755 index d181868..0000000 --- a/script/Alignment/Gun_solenoid_alignment.py +++ /dev/null @@ -1,34 +0,0 @@ -#Tool to align the laser on the cathode. -# S. Bettoni, A. Gobbo, D. Voulot -#10/05/2016 - - -#Procedure: - #I switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement - #I change the current of the gun soleoid - #I look at the centroid position (BPM or screen) downstream of the gun. - -#TO BE PUT THE SIGNAL I-READ IN THE DEVICE DEFINITION GUN SOLENOID - -#caput("shutter:state", Closed) - -start_I = 0.001 #20 -end_I = 0.005 #150 -step_I = 0.0001 #1 - -#Scan using the screen -r = lscan(gun_sol_current, [center_x, center_y], start_I, end_I, step_I, latency = 0.2) -#Scan using the BPM -#r = lscan(gun_sol_current, bpm_1_down_gun, start_I, end_I, step_I, latency = 0.2) - -#I take the result of the scan and I do the plots -x = r.getReadable(0) -y = r.getReadable(1) -plot(y, xdata=x, title = "CM") - - - - -#I save the entry in the logbook - - \ No newline at end of file diff --git a/script/Alignment/Gun_solenoid_alignment_dv.py b/script/Alignment/Gun_solenoid_alignment_dv.py deleted file mode 100644 index d4eb769..0000000 --- a/script/Alignment/Gun_solenoid_alignment_dv.py +++ /dev/null @@ -1,99 +0,0 @@ -# Tool to align the solenoid on the gun. -# S. Bettoni, A. Gobbo, D. Voulot -# 06/06/2016 - - -# 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 - # look at the centroid position (BPM or screen) downstream of the gun. - -I_set = Channel("SINEG01-MSOL130:I-SET", alias = "I_set"); -I_get = Channel("SINEG01-MSOL130:I-READ", alias = "I_get") -# cam_x, cam_y = ... # some camtool command / channel? -bpm_x = Channel("SINEG01-DBPM340:X1") -bpm_y = Channel("SINEG01-DBPM340:Y1") - -cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com", alias = "cam_x") -cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y") -cam_raw_data = Channel("SINEG01-DSCR190:data") - - -class CameraImage(ReadableMatrix): - def read(self): - raw = cam_raw_data.read() - ret = [] - for i in range (self.getHeight()): - ret.append(raw[i*self.getWidth() : (i+1)*self.getWidth()]) - return ret - - def getWidth(self): - return 640 - - def getHeight(self): - return 480 - -cam_img = CameraImage() - - -def ccr(mag): - n = 1 - while n > 0: - sleep(0.5) - n = caget(mag + ":I-COMP") -def laser_on(): - caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0) - -def laser_off(): - caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1) - - -def run_pipeline(): - caput("camtool...:start") - - while !caget("camtool...:done"): - sleep(0.1) - - caget("camtool....:data") - #caget("camtool....:X_stats.com") - #caget("camtool....:X_stats.com") - - -I1 = 20.0 -I2 = 150.0 -dI = 1.0 -settling_time = 0.0 - -# Switch off magnets -mag = [ "SINEG01-MCRX120","SINEG01-MCRY120", - "SINEG01-MQUA140", - "SINEG01-MQUA150", - "SINEG01-MCRX160","SINEG01-MCRY160", - "SINEG01-MCRX180","SINEG01-MCRY180", - "SINEG01-MCRX200","SINEG01-MCRY200", - "SINEG01-MCRX220","SINEG01-MCRY220", - "SINEG01-MQUA310", - "SINEG01-MQUA320" ] -for m in mag: - caput(m + ":I-SET", 0.0) -#for m in mag: -# ccr(m) - -laser_on() -# Scan using the screen -#r = lscan(I_set, [I_read, cam_x, cam_y], I1, I2, dI, 1.0, passes = 2, zigzag = True) -# Scan using the BPM -try: - #r = lscan(I_set, [I_get, cam_x, cam_y], I1, I2, dI, 1.0, before_read = ccr) - r = lscan(I_set, [I_get, cam_x, cam_y, cam_img], I1, I2, dI, settling_time) -finally: - laser_off() - -# take the result of the scan and do the plots -p = plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")[0] - -# save the entry in the logbook -msg = str(r) -msg = msg + "\nFile: " + get_context().path -#msg = msg + "\n\n" + r.print() -#elog("Gun solenoid current scan", msg , get_plot_snapshots()) diff --git a/script/Alignment/Laser_gun_alignment.py b/script/Alignment/Laser_gun_alignment.py deleted file mode 100755 index a1df303..0000000 --- a/script/Alignment/Laser_gun_alignment.py +++ /dev/null @@ -1,37 +0,0 @@ -#Tool to align the laser on the cathode. -# S. Bettoni, A. Gobbo, D. Voulot -#10/05/2016 - -from operator import sub - - -#Procedure: - #I switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement - #I change the current of the gun soleoid - #I look at the centroid position (BPM or screen) downstream of the gun. - -#TO BE PUT THE SIGNAL I-READ IN THE DEVICE DEFINITION GUN SOLENOID - -#caput("shutter:state", Closed) - -start_I = 0.001 #20 -end_I = 0.005 #150 -step_I = 0.001 #1 - -#Scan using the screen -r = lscan(gun_sol_current, [center_x, center_y], start_I, end_I, step_I, latency = 0.2) -#Scan using the BPM -#r = lscan(gun_sol_current, bpm_1_down_gun, start_I, end_I, step_I, latency = 0.2) - -#I take the result of the scan and I do the plots -x = r.getReadable(0) -y = r.getReadable(1) -p = plot(y, xdata=x, title = "CM") -yerr = 0.1 -xerr = 0.5 - - -#I save the entry in the logbook -#elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "SwissFEL commissioning data", encoding=1): -#elog("Test Simona", "message", author = "Simona", get_plot_snapshots(), logbook = "SwissFEL commissioning data", encoding=1) - \ No newline at end of file diff --git a/script/Alignment/Laser_gun_alignment_dv.py b/script/Alignment/Laser_gun_alignment_dv.py deleted file mode 100644 index 96dbfb8..0000000 --- a/script/Alignment/Laser_gun_alignment_dv.py +++ /dev/null @@ -1,57 +0,0 @@ -# Tool to align the laser on the cathode. -# S. Bettoni, A. Gobbo, D. Voulot -# 06/06/2016 - -# Procedure: - # switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement - # change the phase of the gun RF - # look at the centroid position (BPM or screen) downstream of the gun. - -phi_set = Channel("SINEG01-RSYS:SET-BEAM-PHASE") -phi_get = Channel("SINEG01-RSYS:GET-BEAM-PHASE") -# cam_x, cam_y = ... # some camtool command / channel? -bpm_x = Channel("SINEG01-DBPM340:X1") -bpm_y = Channel("SINEG01-DBPM340:Y1") - -def ccr(mag): - n = 1 - while n > 0: - sleep(0.5) - n = caget(mag + ":I-COMP") -def laser_on(): - caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0) -def laser_off(): - caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1) - -phi1 = 20.0 -phi2 = 150.0 -dphi = 1.0 - -# Switch off magnets -mag = [ "SINEG01-MCRX120","SINEG01-MCRY120", - "SINEG01-MQUA140", - "SINEG01-MQUA150", - "SINEG01-MCRX160","SINEG01-MCRY160", - "SINEG01-MCRX180","SINEG01-MCRY180", - "SINEG01-MCRX200","SINEG01-MCRY200", - "SINEG01-MCRX220","SINEG01-MCRY220", - "SINEG01-MQUA310", - "SINEG01-MQUA320" ] -for m in mag: - caput(m + ":I-SET", 0.0) -for m in mag: - ccr(m) - -# Scan using the screen -#r = lscan(phi_set, [phi_get, cam_x, cam_y], phi1, phi2, dphi, 0.5) -# Scan using the BPM -r = lscan(phi_set, [phi_get, bpm_x, bpm_y], phi1, phi2, dphi, 0.5, before_read = laser_on(), after_read = laser_off()) - -# take the result of the scan and do the plots -plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion") - -# save the entry in the logbook -msg = str(r) -msg = msg + "\nFile: " + get_context().path -msg = msg + "\n\n" + r.print() -elog("Gun solenoid current scan", msg , get_plot_snapshots()) diff --git a/script/RFscan/RF_phase_scan.py b/script/RFscan/RF_phase_scan.py deleted file mode 100644 index 156cc91..0000000 --- a/script/RFscan/RF_phase_scan.py +++ /dev/null @@ -1,25 +0,0 @@ -rsys = "SINSB01-RSYS" -bpm = "SINLH02-DBPM210" -phi1 = -175.0 -phi2 = 180.0 -dphi = 5.0 - -def laser_on(): - caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0) -def laser_off(): - caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1) - -phi_set = Channel(rsys + ":SET-VSUM-PHASE") -phi_get = Channel(rsys + ":GET-VSUM-PHASE") -amp_get = Channel(rsys + ":GET-VSUM-AMPLT") -bpm_x = Channel(bpm + ":X1") - -r = lscan(phi_set, [phi_get, amp_get, bpm_x], phi1, phi2, dphi, 0.5, before_read = laser_on(), after_read = laser_off()) - -plot(r.getReadable(2), xdata = r.getReadable(0), title = "Phase scan") - -(amplitude, angular_frequency, phase, ok, maximum) = hfit(r.getReadable(2), xdata = r.getReadable(0)) - -caput(rsys + ":SET-ON-CREST-VSUM-PHASE", maximum) - -set_return(r.print()) diff --git a/script/local.py b/script/local.py index e022b07..b076ac7 100755 --- a/script/local.py +++ b/script/local.py @@ -1,149 +1,199 @@ -################################################################################################### -# Deployment specific global definitions - executed after startup.py -################################################################################################### - -from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list, Gaussian -from mathutils import fit_polynomial,fit_gaussian, fit_harmonic, calculate_peaks -from mathutils import PolynomialFunction, Gaussian, HarmonicOscillator - -import java.awt.Color as Color - - -def fit(ydata, xdata = None): - """ - Gaussian fit - """ - if xdata is None: - xdata = frange(0, len(ydata), 1) - max_y= max(ydata) - index_max = ydata.index(max_y) - max_x= xdata[index_max] - print "Max index:" + str(index_max), - print " x:" + str(max_x), - print " y:" + str(max_y) - gaussians = fit_gaussians(ydata, xdata, [index_max,]) - (norm, mean, sigma) = gaussians[0] - p = plot([ydata],["data"],[xdata], title="Fit" )[0] - fitted_gaussian_function = Gaussian(norm, mean, sigma) - scale_x = [float(min(xdata)), float(max(xdata)) ] - points = max((len(xdata)+1), 100) - resolution = (scale_x[1]-scale_x[0]) / points - fit_y = [] - fit_x = frange(scale_x[0],scale_x[1],resolution, True) - for x in fit_x: - fit_y.append(fitted_gaussian_function.value(x)) - p.addSeries(LinePlotSeries("fit")) - p.getSeries(1).setData(fit_x, fit_y) - - if abs(mean - xdata[index_max]) < ((scale_x[0] + scale_x[1])/2): - print "Mean -> " + str(mean) - p.addMarker(mean, None, "Mean="+str(round(norm,2)), Color.MAGENTA.darker()) - return (norm, mean, sigma) - else: - p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY) - print "Invalid gaussian fit: " + str(mean) - return (None, None, None) - - -def hfit(ydata, xdata = None): - """ - Harmonic fit - """ - if xdata is None: - xdata = frange(0, len(ydata), 1) - - max_y= max(ydata) - index_max = ydata.index(max_y) - max_x= xdata[index_max] - - start,end = min(xdata), max(xdata) - (amplitude, angular_frequency, phase) = fit_harmonic(ydata, xdata) - fitted_harmonic_function = HarmonicOscillator(amplitude, angular_frequency, phase) - - print "amplitude = ", amplitude - print "angular frequency = ", angular_frequency - print "phase = ", phase - - f = angular_frequency/ (2* math.pi) - print "frequency = ", f - - resolution = 0.01 - fit_y = [] - for x in frange(start,end,resolution, True): - fit_y.append(fitted_harmonic_function.value(x)) - fit_x = frange(start, end+resolution, resolution) - - p = plot(ydata,"data", xdata, title="HFit")[0] - p.addSeries(LinePlotSeries("fit")) - p.getSeries(1).setData(fit_x, fit_y) - - #m = (phase + math.pi)/ angular_frequency - m = -phase / angular_frequency - if (m " + str(mean) + p.addMarker(mean, None, "Mean="+str(round(norm,2)), Color.MAGENTA.darker()) + return (norm, mean, sigma) + else: + p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY) + print "Invalid gaussian fit: " + str(mean) + return (None, None, None) + + + +def hfit(ydata, xdata = None): + if xdata is None: + xdata = frange(0, len(ydata), 1) + + max_y= max(ydata) + index_max = ydata.index(max_y) + max_x= xdata[index_max] + + start,end = min(xdata), max(xdata) + (amplitude, angular_frequency, phase) = fit_harmonic(ydata, xdata) + fitted_harmonic_function = HarmonicOscillator(amplitude, angular_frequency, phase) + + print "amplitude = ", amplitude + print "angular frequency = ", angular_frequency + print "phase = ", phase + + f = angular_frequency/ (2* math.pi) + resolution = 0.01 + fit_y = [] + for x in frange(start,end,resolution, True): + fit_y.append(fitted_harmonic_function.value(x)) + fit_x = frange(start, end+resolution, resolution) + + p = plot(ydata,"data", xdata, title="HFit")[0] + p.addSeries(LinePlotSeries("fit")) + p.getSeries(1).setData(fit_x, fit_y) + + #m = (phase + math.pi)/ angular_frequency + fit_max = -phase / angular_frequency + if (fit_max 0: - sleep(0.5) - n = caget(mag + ":I-COMP") -def laser_on(): - print(laser_on) #caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0) -def laser_off(): - print(laser_off) #caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1) - -I1 = 2.0 -I2 = 5.0 -dI = 0.5 - -# Switch off magnets -mag = ["SINEG01-MCRX120","SINEG01-MCRY120"] -for m in mag: - caput(m + ":I-SET", 0.0) -for m in mag: - ccr(m) - -# Scan using the screen -#r = lscan(I_set, [I_get, cam_x, cam_y], I1, I2, dI, passes = 2, zigzag = True) -# Scan using the BPM -r = lscan(I_set, [I_get, bpm_x, bpm_y], I1, I2, dI, 1.0, before_read = laser_on(), after_read = laser_off()) - -# take the result of the scan and do the plots -plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion") - -# save the entry in the logbook -msg = str(r) -msg = msg + "\nFile: " + get_context().path -msg = msg + "\n\n" + r.print() -elog("Gun solenoid current scan", msg , get_plot_snapshots()) diff --git a/script/test/SARUN02_MCOR_scan.py b/script/test/SARUN02_MCOR_scan.py deleted file mode 100755 index 9da63b9..0000000 --- a/script/test/SARUN02_MCOR_scan.py +++ /dev/null @@ -1 +0,0 @@ -ascan((SARUN02_MCRX080,SARUN02_MCRY080), (SARUN03_DBPM070), (-2.0,-2.0), (2.0,2.0), (5,5), 0.01) \ No newline at end of file diff --git a/script/test/bla.py b/script/test/bla.py deleted file mode 100755 index bda6bfa..0000000 --- a/script/test/bla.py +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################################### -# Demonstrate use of scan callbacks to trigger a detector at falling edge. -################################################################################################### - - -def BeforeReadout(): - ao1.write(1) - ao1.write(0) - - #Example with an epics direct channel access - #caput("CHANNEL_NAME", 1) - #caput("CHANNEL_NAME", 0) - -index=0 - -def AfterReadout(): - global index - print "Aquired frame: " + str(index) - index=index+1 - -a= lscan((m1,m2), (ai1, ai2), (0,0), (4,8), steps=20, latency = 0.01, before_read=BeforeReadout, after_read=AfterReadout) \ No newline at end of file diff --git a/script/test/phase_scan.py b/script/test/phase_scan.py deleted file mode 100755 index e36d125..0000000 --- a/script/test/phase_scan.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Parameters: -prefix -""" - -prefix = "MINSB03-RSYS" -start = -179.0 -stop = 180.0 -step = 10.0 - - - -rf_phase_setpoint = Channel(prefix + ":SET-VSUM-PHASE") -rf_phase_readback = Channel(prefix + ":GET-VSUM-PHASE") -rf_ampl_readback = Channel(prefix + ":GET-VSUM-AMPLT") - -r = lscan(rf_phase_setpoint, [rf_phase_readback, rf_ampl_readback, sim], start, stop, step , latency=0.2) - -plot(r.getReadable(2), xdata = r.getReadable(0), title = "data") - -#fit(r.getReadable(1)) - - -set_return(r.print()) - - -""" -r = lscan(rf_phase, [rf_phase_rb, rf_ampl_rb, sim], -179.0, 180, 10.0, latency=0.2) - -plot(r.getReadable(2), xdata = r.getReadable(0), title = "data") - -fit(r.getReadable(1)) - - -set_return(r.print()) -""" \ No newline at end of file diff --git a/script/test/phase_scan_dv.py b/script/test/phase_scan_dv.py deleted file mode 100644 index 600e024..0000000 --- a/script/test/phase_scan_dv.py +++ /dev/null @@ -1,15 +0,0 @@ -prefix = "MINSB03-RSYS" # SINEG01-RSYS -start = -175.0 -stop = 180.0 -step = 5.0 - -rf_phase_setpoint = ao1 # Channel(prefix + ":SET-VSUM-PHASE") -rf_phase_readback = phase # Channel(prefix + ":GET-VSUM-PHASE") -rf_ampl_readback = ai2 # Channel(prefix + ":GET-VSUM-AMPLT") -bpm_q = bpm # SINEG01-DBPM340:Q1, SINEG01-DWCM170:Q_B1 - -r = lscan(rf_phase_setpoint, [rf_phase_readback, rf_ampl_readback, bpm_q], start, stop, step , latency=0.5) - -plot(r.getReadable(2), xdata = r.getReadable(0), title = "data") - -set_return(r.print()) \ No newline at end of file diff --git a/script/test/pouet.py b/script/test/pouet.py deleted file mode 100755 index cc5d94f..0000000 --- a/script/test/pouet.py +++ /dev/null @@ -1,29 +0,0 @@ -################################################################################################### -# Demonstrate the use of Line Scan: one or multiple positioners move together linearly. -################################################################################################### - - -#This optional preference limits the displayed plots -#set_preference(Preference.ENABLED_PLOTS, [ai1, ai2,]) - -#This optional preference displays wf1 as a 1d plot at each scan point, instead of a matrix plot -#set_preference(Preference.PLOT_TYPES, {wf1:1}) - -#Execute the scan: 200 steps, a1 from 0 to 40 -a= lscan(ao1, (ai1,ai2,wf1), 0, 40, 200, 0.01) - -#Also samples an image: -#a= lscan(ao1, (ai1,ai2,wf1), 0, 40, 200, 0.01) - -#Alternative: Steps of size 0.1, a1 from 0 to 40 -#a= lscan(ao1, (ai1,ai2,wf1), 0, 40, 0.5, 0.01) - -#2 positioners moving together in 200 steps, a1 from 0 to 40 and a2 from 0 to 100 -#a= lscan((ao1,ao2), (ai1,ai2,wf1), (0, 0), (40, 100), 200, 0.01) - -#Setting attributes to the scan group -path = get_current_group() -set_attribute(path, "AttrString", "Value") -set_attribute(path, "AttrInteger", 1) -set_attribute(path, "AttrDouble", 2.0) -set_attribute(path, "AttrBoolean", True) diff --git a/script/test/region_scan_with_elog.py b/script/test/region_scan_with_elog.py deleted file mode 100755 index 192a189..0000000 --- a/script/test/region_scan_with_elog.py +++ /dev/null @@ -1,7 +0,0 @@ -#Execute the scan: 3 regions with different number of steps -a= rscan(ao1, (ai1,ai2), [(0,5,5), (10,15,20), (20,25,5)] , 0.01) - -msg = str(a) -msg = msg + "\nFile: " + get_context().path -msg = msg + "\n\n" + a.print() -elog("Region scan", msg , get_plot_snapshots()) diff --git a/script/test/rf_phase_scan.py b/script/test/rf_phase_scan.py deleted file mode 100755 index 0cf1a41..0000000 --- a/script/test/rf_phase_scan.py +++ /dev/null @@ -1 +0,0 @@ -lscan(SINSB01_phase, energy_BC1, 0.0, 360.0, 10.0, 2.0) \ No newline at end of file diff --git a/script/test/test.py b/script/test/test.py deleted file mode 100755 index 2b60a9d..0000000 --- a/script/test/test.py +++ /dev/null @@ -1,2 +0,0 @@ -caput("SINEG01-MCRX120:I-SET", 5.0) -print(caget("SINEG01-MCRX120:I-READ")) \ No newline at end of file diff --git a/script/test/test_Simona.py b/script/test/test_Simona.py deleted file mode 100755 index 780779a..0000000 --- a/script/test/test_Simona.py +++ /dev/null @@ -1,52 +0,0 @@ - - - -import numpy as np -import matplotlib.pyplot as plt - -# example data -x = np.arange(0.5, 5.5, 0.5) -y = np.exp(-x) -xerr = 0.1 -yerr = 0.2 -ls = 'dotted' - -fig = plt.figure() -ax = fig.add_subplot(1, 1, 1) - -# standard error bars -plt.errorbar(x, y, xerr=xerr, yerr=yerr, ls=ls, color='blue') - -# including upper limits -uplims = np.zeros(x.shape) -uplims[[1, 5, 9]] = True -plt.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims, ls=ls, - color='green') - -# including lower limits -lolims = np.zeros(x.shape) -lolims[[2, 4, 8]] = True -plt.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims, ls=ls, - color='red') - -# including upper and lower limits -plt.errorbar(x, y + 1.5, marker='o', ms=8, xerr=xerr, yerr=yerr, - lolims=lolims, uplims=uplims, ls=ls, color='magenta') - -# including xlower and xupper limits -xerr = 0.2 -yerr = np.zeros(x.shape) + 0.2 -yerr[[3, 6]] = 0.3 -xlolims = lolims -xuplims = uplims -lolims = np.zeros(x.shape) -uplims = np.zeros(x.shape) -lolims[[6]] = True -uplims[[3]] = True -plt.errorbar(x, y + 2.1, marker='o', ms=8, xerr=xerr, yerr=yerr, - xlolims=xlolims, xuplims=xuplims, uplims=uplims, lolims=lolims, - ls='none', mec='blue', capsize=0, color='cyan') - -ax.set_xlim((0, 5.5)) -ax.set_title('Errorbar upper and lower limits') -plt.show() \ No newline at end of file diff --git a/script/test/toto.py b/script/test/toto.py deleted file mode 100755 index 9c6851c..0000000 --- a/script/test/toto.py +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################################### -# Demonstrate use of Vector Scan: one or multiple positioners set according to a position vector. -################################################################################################### - - -#1D vector scan, plot to 1D Vector tab -vector = [ 1, 3, 5, 10, 25, 40, 45, 47, 49] -a= vscan(ao1,(ai1,ai2),vector,False, 0.5, context = "1D Vector") - - - - -#2D vector scan, plot to 2D Vector tab -vector = [ [1,1] , [1,2] , [1,3] , [1,4] , - [1.5,2.5] , - [2,1] , [2,2] , [2,3] , [2,4] , - [2.5,2.5] , - [3,1] , [3,2] , [3,3] , [3,4] ] - -a= vscan((m1,m2),(ai1,ai2),vector,False, 0.1, context = "2D Vector") -