diff --git a/config/config.properties b/config/config.properties index 6926570..1d63a2d 100755 --- a/config/config.properties +++ b/config/config.properties @@ -1,4 +1,4 @@ -#Mon Mar 26 14:15:56 CEST 2018 +#Thu Aug 02 10:45:31 CEST 2018 autoSaveScanData=true createSessionFiles=true dataLayout=default diff --git a/config/devices.properties b/config/devices.properties index c06ce8f..a26e781 100755 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,5 +1,6 @@ dispatcher=ch.psi.pshell.bs.Provider|tcp://localhost:9999||| -cam_server=ch.psi.pshell.bs.PipelineServer|localhost:8889|||true +cam_server_local=ch.psi.pshell.bs.PipelineServer|localhost:8889|||true +cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889|||true #stream=ch.psi.pshell.bs.Stream| #false:boolean||| #scalar=ch.psi.pshell.bs.Scalar|stream Int8Scalar||| #cam=ch.psi.pshell.bs.StreamCamera|"tcp://gfa-lc6-64:10100" 1|||true @@ -108,4 +109,5 @@ phi=ch.psi.pshell.device.DummyMotor||||true sixc=ch.psi.pshell.device.MotorGroupBase|mu delta gam eta chi phi||| fivec=ch.psi.pshell.device.MotorGroupBase|delta gam eta chi phi||| fourc=ch.psi.pshell.device.MotorGroupBase|delta eta chi phi||| +fourcv=ch.psi.pshell.device.MotorGroupBase|mu delta gam eta||| en=ch.psi.pshell.device.DummyPositioner||||true diff --git a/config/plugins.properties b/config/plugins.properties index dbc6b91..475df3a 100755 --- a/config/plugins.properties +++ b/config/plugins.properties @@ -1,3 +1,5 @@ +ScreenPanel3.java=disabled +Tomaz.java=disabled ScreenPanel2.java=disabled Correlation2.java=disabled Correlation.java=disabled diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 20907e5..a103678 100755 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,6 +1,7 @@ -#Wed May 16 15:31:51 CEST 2018 +#Thu Aug 09 15:37:16 CEST 2018 colormap=Flame colormapAutomatic=true +colormapLogarithmic=false colormapMax=25300.0 colormapMin=0.0 custom=12345 @@ -22,9 +23,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=http\://gfa-lc6-64\:8889 -spatialCalOffsetX=-634.4956973840979 -spatialCalOffsetY=-509.5307480984911 -spatialCalScaleX=-26.954178679632527 -spatialCalScaleY=-35.8422927936001 +spatialCalOffsetX=-131.47810112809645 +spatialCalOffsetY=-114.68674851532894 +spatialCalScaleX=-26.95417819057938 +spatialCalScaleY=-35.84229324524661 spatialCalUnits=mm transpose=false diff --git a/devices/PiezoRoll1.properties b/devices/PiezoRoll1.properties index 0388355..b56883f 100755 --- a/devices/PiezoRoll1.properties +++ b/devices/PiezoRoll1.properties @@ -1,8 +1,9 @@ -#Thu Feb 16 13:51:32 CET 2017 -maxValue=1000.0 -minValue=0.0 -offset=0.0 -precision=5 -resolution=NaN -scale=1.0 -unit=mm +#Tue Jun 19 17:19:36 CEST 2018 +maxValue=1000.0 +minValue=0.0 +offset=0.0 +precision=5 +resolution=NaN +scale=1.0 +sign_bit=0 +unit=mm diff --git a/devices/Time.properties b/devices/Time.properties index a213619..2ca7570 100755 --- a/devices/Time.properties +++ b/devices/Time.properties @@ -1,9 +1,10 @@ -#Fri Jun 16 17:47:37 CEST 2017 -maxValue=NaN -minValue=NaN -offset=0.0 -precision=-1 -resolution=NaN -rotation=false -scale=1.0 -unit=null +#Wed Jul 25 10:47:11 CEST 2018 +maxValue=NaN +minValue=NaN +offset=0.0 +precision=-1 +resolution=NaN +rotation=false +scale=1.0 +sign_bit=0 +unit=null diff --git a/devices/cam_server.properties b/devices/cam_server.properties index c5a08f6..61e604e 100755 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,12 +1,14 @@ -#Thu Mar 22 10:22:45 CET 2018 -colormap=Flame +#Thu Aug 09 15:41:34 CEST 2018 +colormap=Temperature colormapAutomatic=true +colormapLogarithmic=false colormapMax=NaN colormapMin=NaN flipHorizontally=false flipVertically=false grayscale=false invert=false +logarithmic=true rescaleFactor=1.0 rescaleOffset=0.0 roiHeight=-1 @@ -16,9 +18,9 @@ roiY=0 rotation=0.0 rotationCrop=false scale=1.0 -spatialCalOffsetX=0.0 -spatialCalOffsetY=0.0 -spatialCalScaleX=1.0 -spatialCalScaleY=1.0 +spatialCalOffsetX=-50.048875855327466 +spatialCalOffsetY=-50.048875855327466 +spatialCalScaleX=-1.0 +spatialCalScaleY=-1.0 spatialCalUnits=mm transpose=false diff --git a/devices/cam_server_local.properties b/devices/cam_server_local.properties new file mode 100644 index 0000000..292f8fb --- /dev/null +++ b/devices/cam_server_local.properties @@ -0,0 +1,25 @@ +#Thu Aug 09 15:38:40 CEST 2018 +colormap=Grayscale +colormapAutomatic=false +colormapLogarithmic=false +colormapMax=NaN +colormapMin=NaN +flipHorizontally=false +flipVertically=false +grayscale=false +invert=false +rescaleFactor=1.0 +rescaleOffset=0.0 +roiHeight=-1 +roiWidth=-1 +roiX=0 +roiY=0 +rotation=0.0 +rotationCrop=false +scale=1.0 +spatialCalOffsetX=NaN +spatialCalOffsetY=NaN +spatialCalScaleX=NaN +spatialCalScaleY=NaN +spatialCalUnits=mm +transpose=false diff --git a/devices/chi.properties b/devices/chi.properties index 070e1e6..c853b53 100644 --- a/devices/chi.properties +++ b/devices/chi.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:03:01 CEST 2018 +#Tue Jun 19 17:19:37 CEST 2018 defaultSpeed=10.0 estbilizationDelay=0 maxSpeed=10.0 @@ -10,5 +10,6 @@ precision=2 resolution=NaN rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/cv.properties b/devices/cv.properties index c70284c..3d57b9d 100755 --- a/devices/cv.properties +++ b/devices/cv.properties @@ -1,9 +1,10 @@ -#Fri Mar 24 15:08:15 CET 2017 -accessType=ReadWrite -maxValue=1000.0 -minValue=-1000.0 -offset=0.0 -precision=3 -resolution=1.0 -scale=1.0 -unit=C +#Tue Jun 19 17:19:36 CEST 2018 +accessType=ReadWrite +maxValue=1000.0 +minValue=-1000.0 +offset=0.0 +precision=3 +resolution=1.0 +scale=1.0 +sign_bit=0 +unit=C diff --git a/devices/delta.properties b/devices/delta.properties index 9334e6a..f59f1cf 100644 --- a/devices/delta.properties +++ b/devices/delta.properties @@ -1,4 +1,4 @@ -#Mon Apr 16 17:23:26 CEST 2018 +#Tue Jun 19 17:19:36 CEST 2018 defaultSpeed=50.0 estbilizationDelay=0 maxSpeed=50.0 @@ -10,5 +10,6 @@ precision=2 resolution=NaN rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/en.properties b/devices/en.properties index a6e6b8d..291e827 100644 --- a/devices/en.properties +++ b/devices/en.properties @@ -1,4 +1,4 @@ -#Mon Apr 16 16:57:32 CEST 2018 +#Tue Jun 19 17:19:37 CEST 2018 maxValue=100.0 minValue=0.0 offset=0.0 @@ -6,4 +6,5 @@ precision=4 resolution=NaN rotation=false scale=1.0 +sign_bit=0 unit=kEv diff --git a/devices/eta.properties b/devices/eta.properties index be754db..c853b53 100644 --- a/devices/eta.properties +++ b/devices/eta.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:02:49 CEST 2018 +#Tue Jun 19 17:19:37 CEST 2018 defaultSpeed=10.0 estbilizationDelay=0 maxSpeed=10.0 @@ -10,5 +10,6 @@ precision=2 resolution=NaN rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/gam.properties b/devices/gam.properties index 0a1f710..c853b53 100644 --- a/devices/gam.properties +++ b/devices/gam.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:02:41 CEST 2018 +#Tue Jun 19 17:19:37 CEST 2018 defaultSpeed=10.0 estbilizationDelay=0 maxSpeed=10.0 @@ -10,5 +10,6 @@ precision=2 resolution=NaN rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/h.properties b/devices/h.properties index 4ba926d..913260d 100644 --- a/devices/h.properties +++ b/devices/h.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:38:15 CEST 2018 +#Wed Aug 15 09:55:09 CEST 2018 maxValue=10.0 minValue=-10.0 offset=0.0 @@ -6,4 +6,5 @@ precision=4 resolution=0.01 rotation=false scale=1.0 +sign_bit=0 unit=deg diff --git a/devices/k.properties b/devices/k.properties index 22ee5c9..913260d 100644 --- a/devices/k.properties +++ b/devices/k.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:38:04 CEST 2018 +#Wed Aug 15 09:55:09 CEST 2018 maxValue=10.0 minValue=-10.0 offset=0.0 @@ -6,4 +6,5 @@ precision=4 resolution=0.01 rotation=false scale=1.0 +sign_bit=0 unit=deg diff --git a/devices/l.properties b/devices/l.properties index b0bfa0a..913260d 100644 --- a/devices/l.properties +++ b/devices/l.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:37:53 CEST 2018 +#Wed Aug 15 09:55:09 CEST 2018 maxValue=10.0 minValue=-10.0 offset=0.0 @@ -6,4 +6,5 @@ precision=4 resolution=0.01 rotation=false scale=1.0 +sign_bit=0 unit=deg diff --git a/devices/m1.properties b/devices/m1.properties index 1b5e6ac..4a2e4e3 100755 --- a/devices/m1.properties +++ b/devices/m1.properties @@ -1,14 +1,15 @@ -#Wed Oct 18 16:49:39 CEST 2017 -defaultSpeed=1.0 -estbilizationDelay=0 -maxSpeed=10.0 -maxValue=10.0 -minSpeed=0.1 -minValue=-10.0 -offset=0.0 -precision=2 -resolution=NaN -rotation=false -scale=1.0 -startRetries=1 -unit=mm +#Mon Aug 06 08:57:31 CEST 2018 +defaultSpeed=1.0 +estbilizationDelay=0 +maxSpeed=10.0 +maxValue=10.0 +minSpeed=0.1 +minValue=-10.0 +offset=0.0 +precision=2 +resolution=NaN +rotation=false +scale=1.0 +sign_bit=0 +startRetries=1 +unit=mm diff --git a/devices/m2.properties b/devices/m2.properties index 0b66b61..8f6cf94 100755 --- a/devices/m2.properties +++ b/devices/m2.properties @@ -1,15 +1,16 @@ -#Wed Oct 18 16:49:39 CEST 2017 -accessType=ReadWrite -defaultSpeed=1.0 -estbilizationDelay=0 -maxSpeed=10.0 -maxValue=10.0 -minSpeed=0.1 -minValue=-10.0 -offset=0.0 -precision=4 -resolution=NaN -rotation=false -scale=1.0 -startRetries=1 -unit=mm +#Mon Aug 06 08:57:31 CEST 2018 +accessType=ReadWrite +defaultSpeed=1.0 +estbilizationDelay=0 +maxSpeed=10.0 +maxValue=10.0 +minSpeed=0.1 +minValue=-10.0 +offset=0.0 +precision=4 +resolution=NaN +rotation=false +scale=1.0 +sign_bit=0 +startRetries=1 +unit=mm diff --git a/devices/motor.properties b/devices/motor.properties index e1af856..69eec92 100755 --- a/devices/motor.properties +++ b/devices/motor.properties @@ -1,10 +1,7 @@ -#Wed Mar 28 11:52:13 CEST 2018 -accessType=ReadWrite -channel=MTEST-GOBBO\:MOT1 +#Fri Jun 22 08:53:29 CEST 2018 defaultSpeed=1.0 estbilizationDelay=0 hasEnable=true -homingDirection=Backward homingType=Backward maxSpeed=20.0 maxValue=75.0 @@ -15,6 +12,6 @@ precision=4 resolution=0.00125 rotation=false scale=1.0 -simulation=false +sign_bit=0 startRetries=2 unit=mm diff --git a/devices/motor2.properties b/devices/motor2.properties index 2376a1a..6eec265 100755 --- a/devices/motor2.properties +++ b/devices/motor2.properties @@ -1,20 +1,21 @@ -#Fri Sep 22 09:54:50 CEST 2017 -accessType=ReadWrite -channel=MTEST-GOBBO\:MOT2 -defaultSpeed=0.2 -estbilizationDelay=0 -hasEnable=true -homingDirection=Backward -homingType=Backward -maxSpeed=100.0 -maxValue=2.0 -minSpeed=0.001 -minValue=-2.0 -offset=10.0 -precision=3 -resolution=NaN -rotation=false -scale=2.0 -simulation=false -startRetries=1 -unit=null +#Tue Jun 19 17:19:36 CEST 2018 +accessType=ReadWrite +channel=MTEST-GOBBO\:MOT2 +defaultSpeed=0.2 +estbilizationDelay=0 +hasEnable=true +homingDirection=Backward +homingType=Backward +maxSpeed=100.0 +maxValue=2.0 +minSpeed=0.001 +minValue=-2.0 +offset=10.0 +precision=3 +resolution=NaN +rotation=false +scale=2.0 +sign_bit=0 +simulation=false +startRetries=1 +unit=null diff --git a/devices/mu.properties b/devices/mu.properties index 4302ffa..ee38ec6 100644 --- a/devices/mu.properties +++ b/devices/mu.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:02:07 CEST 2018 +#Tue Jun 19 17:19:36 CEST 2018 defaultSpeed=10.0 estbilizationDelay=0 maxSpeed=10.0 @@ -10,5 +10,6 @@ precision=2 resolution=NaN rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/mycv.properties b/devices/mycv.properties index fedd8c5..d834f51 100644 --- a/devices/mycv.properties +++ b/devices/mycv.properties @@ -1,8 +1,9 @@ -#Thu Feb 15 17:19:47 CET 2018 +#Tue Jun 19 17:19:36 CEST 2018 maxValue=100.0 minValue=-100.0 offset=0.0 precision=2 resolution=0.1 scale=1.0 +sign_bit=0 unit=mm diff --git a/devices/mymot.properties b/devices/mymot.properties index 7aa4113..1be44fd 100644 --- a/devices/mymot.properties +++ b/devices/mymot.properties @@ -1,4 +1,4 @@ -#Thu Feb 15 17:16:13 CET 2018 +#Tue Jun 19 17:19:36 CEST 2018 defaultSpeed=1.0 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=2 resolution=0.1 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/mypos.properties b/devices/mypos.properties index 7199894..965b443 100644 --- a/devices/mypos.properties +++ b/devices/mypos.properties @@ -1,4 +1,4 @@ -#Thu Feb 15 17:17:18 CET 2018 +#Tue Jun 19 17:19:36 CEST 2018 maxValue=100.0 minValue=100.0 offset=0.0 @@ -6,4 +6,5 @@ precision=2 resolution=0.1 rotation=false scale=1.0 +sign_bit=0 unit=mm diff --git a/devices/p1.properties b/devices/p1.properties index c518c22..ab9746b 100755 --- a/devices/p1.properties +++ b/devices/p1.properties @@ -1,9 +1,10 @@ -#Fri Jun 16 17:46:24 CEST 2017 -maxValue=NaN -minValue=NaN -offset=0.0 -precision=-1 -resolution=NaN -rotation=false -scale=1.0 -unit=null +#Mon Aug 06 08:57:31 CEST 2018 +maxValue=NaN +minValue=NaN +offset=0.0 +precision=-1 +resolution=NaN +rotation=false +scale=1.0 +sign_bit=0 +unit=null diff --git a/devices/pe.properties b/devices/pe.properties index e1e324c..d7f9bfd 100755 --- a/devices/pe.properties +++ b/devices/pe.properties @@ -1,10 +1,11 @@ -#Mon Jun 12 18:25:49 CEST 2017 -accessType=ReadWrite -maxValue=1000.0 -minValue=0.0 -offset=0.0 -precision=5 -resolution=NaN -rotation=true -scale=1.0 -unit=mm +#Tue Jun 19 17:19:36 CEST 2018 +accessType=ReadWrite +maxValue=1000.0 +minValue=0.0 +offset=0.0 +precision=5 +resolution=NaN +rotation=true +scale=1.0 +sign_bit=0 +unit=mm diff --git a/devices/phi.properties b/devices/phi.properties index 61b1784..c853b53 100644 --- a/devices/phi.properties +++ b/devices/phi.properties @@ -1,4 +1,4 @@ -#Thu Apr 12 11:03:09 CEST 2018 +#Tue Jun 19 17:19:37 CEST 2018 defaultSpeed=10.0 estbilizationDelay=0 maxSpeed=10.0 @@ -10,5 +10,6 @@ precision=2 resolution=NaN rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/pv.properties b/devices/pv.properties index 598b23e..22025fe 100755 --- a/devices/pv.properties +++ b/devices/pv.properties @@ -1,11 +1,12 @@ -#Mon Jun 12 18:07:43 CEST 2017 -accessType=ReadWrite -channel=TESTIOC\:TESTCALCOUT\:Input -maxValue=180.0 -minValue=-180.0 -offset=1.0 -precision=5 -resolution=-1.0 -scale=2.0 -simulation=false -unit=mm +#Tue Jun 19 17:19:36 CEST 2018 +accessType=ReadWrite +channel=TESTIOC\:TESTCALCOUT\:Input +maxValue=180.0 +minValue=-180.0 +offset=1.0 +precision=5 +resolution=-1.0 +scale=2.0 +sign_bit=0 +simulation=false +unit=mm diff --git a/devices/scanner.properties b/devices/scanner.properties index 7fa2491..82bb0f4 100644 --- a/devices/scanner.properties +++ b/devices/scanner.properties @@ -1,4 +1,4 @@ -#Tue Feb 06 14:46:43 CET 2018 +#Thu Aug 02 17:12:34 CEST 2018 maxValue=NaN minValue=NaN offset=0.0 @@ -6,4 +6,5 @@ precision=-1 resolution=NaN rotation=false scale=1.0 +sign_bit=0 unit=null diff --git a/devices/src1.properties b/devices/src1.properties index 1074f5c..60fcd6f 100755 --- a/devices/src1.properties +++ b/devices/src1.properties @@ -1,32 +1,33 @@ -#Wed Mar 22 10:57:46 CET 2017 -calOffsetX=NaN -calOffsetY=NaN -calScaleX=NaN -calScaleY=NaN -colormap=Temperature -colormapAutomatic=true -colormapMax=255.0 -colormapMin=0.0 -dataMonitoring=false -dataPolling=100 -flipHorizontally=true -flipVertically=false -grayscale=false -invert=false -pollingBackground=false -pollingInterval=0 -rescaleFactor=1.0 -rescaleOffset=0.0 -roiHeight=-1 -roiWidth=-1 -roiX=0 -roiY=0 -rotation=0.0 -rotationCrop=false -scale=1.0 -spatialCalOffsetX=NaN -spatialCalOffsetY=NaN -spatialCalScaleX=NaN -spatialCalScaleY=NaN -spatialCalUnits=mm -transpose=false +#Mon Aug 06 10:26:59 CEST 2018 +calOffsetX=NaN +calOffsetY=NaN +calScaleX=NaN +calScaleY=NaN +colormap=Temperature +colormapAutomatic=true +colormapLogarithmic=false +colormapMax=255.0 +colormapMin=0.0 +dataMonitoring=false +dataPolling=100 +flipHorizontally=true +flipVertically=false +grayscale=false +invert=false +pollingBackground=false +pollingInterval=0 +rescaleFactor=1.0 +rescaleOffset=0.0 +roiHeight=-1 +roiWidth=-1 +roiX=0 +roiY=0 +rotation=0.0 +rotationCrop=false +scale=1.0 +spatialCalOffsetX=NaN +spatialCalOffsetY=NaN +spatialCalScaleX=NaN +spatialCalScaleY=NaN +spatialCalUnits=mm +transpose=false diff --git a/devices/src2.properties b/devices/src2.properties index f022812..a29a5d3 100755 --- a/devices/src2.properties +++ b/devices/src2.properties @@ -1,32 +1,33 @@ -#Tue Jan 17 11:08:33 CET 2017 -calOffsetX=NaN -calOffsetY=NaN -calScaleX=NaN -calScaleY=NaN -colormap=Grayscale -colormapAutomatic=true -colormapMax=255.0 -colormapMin=0.0 -dataMonitoring=false -dataPolling=100 -flipHorizontally=false -flipVertically=false -grayscale=false -invert=false -pollingBackground=false -pollingInterval=0 -rescaleFactor=1.0 -rescaleOffset=0.0 -roiHeight=-1 -roiWidth=-1 -roiX=0 -roiY=0 -rotation=0.0 -rotationCrop=false -scale=1.0 -spatialCalOffsetX=NaN -spatialCalOffsetY=NaN -spatialCalScaleX=NaN -spatialCalScaleY=NaN -spatialCalUnits=mm -transpose=false +#Mon Aug 06 10:26:59 CEST 2018 +calOffsetX=NaN +calOffsetY=NaN +calScaleX=NaN +calScaleY=NaN +colormap=Grayscale +colormapAutomatic=true +colormapLogarithmic=false +colormapMax=255.0 +colormapMin=0.0 +dataMonitoring=false +dataPolling=100 +flipHorizontally=false +flipVertically=false +grayscale=false +invert=false +pollingBackground=false +pollingInterval=0 +rescaleFactor=1.0 +rescaleOffset=0.0 +roiHeight=-1 +roiWidth=-1 +roiX=0 +roiY=0 +rotation=0.0 +rotationCrop=false +scale=1.0 +spatialCalOffsetX=NaN +spatialCalOffsetY=NaN +spatialCalScaleX=NaN +spatialCalScaleY=NaN +spatialCalUnits=mm +transpose=false diff --git a/devices/test_cfg.properties b/devices/test_cfg.properties new file mode 100644 index 0000000..64a2c42 --- /dev/null +++ b/devices/test_cfg.properties @@ -0,0 +1,5 @@ +#Fri Jun 22 09:13:00 CEST 2018 +b=false +d=1.0 +i=5 +s=Test5 diff --git a/devices/testd.properties b/devices/testd.properties index 1cfac83..9b22cd9 100755 --- a/devices/testd.properties +++ b/devices/testd.properties @@ -1,9 +1,10 @@ -#Mon Jun 12 17:34:43 CEST 2017 -maxValue=NaN -minValue=NaN -offset=0.0 -precision=-1 -resolution=NaN -rotation=false -scale=1.0 -unit=null +#Tue Jun 19 17:19:36 CEST 2018 +maxValue=NaN +minValue=NaN +offset=0.0 +precision=-1 +resolution=NaN +rotation=false +scale=1.0 +sign_bit=0 +unit=null diff --git a/plugins/MXSC-1.10.0.jar b/plugins/MXSC-1.10.0.jar new file mode 100644 index 0000000..4617163 Binary files /dev/null and b/plugins/MXSC-1.10.0.jar differ diff --git a/plugins/Nilson.form b/plugins/Nilson.form index 5a85b75..6bd39ed 100755 --- a/plugins/Nilson.form +++ b/plugins/Nilson.form @@ -24,6 +24,11 @@ + + + + + @@ -33,7 +38,9 @@ - + + + @@ -55,5 +62,10 @@ + + + + + diff --git a/plugins/Nilson.java b/plugins/Nilson.java index b66783b..5d5091c 100755 --- a/plugins/Nilson.java +++ b/plugins/Nilson.java @@ -44,6 +44,7 @@ buttonRun.setEnabled(state==State.Ready); buttonRun = new javax.swing.JButton(); buttonAbort = new javax.swing.JButton(); + jCheckBox1 = new javax.swing.JCheckBox(); buttonRun.setText("Run"); buttonRun.addActionListener(new java.awt.event.ActionListener() { @@ -59,6 +60,8 @@ buttonRun.setEnabled(state==State.Ready); } }); + jCheckBox1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -69,6 +72,10 @@ buttonRun.setEnabled(state==State.Ready); .addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonRun, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(467, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(141, 141, 141)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -77,7 +84,9 @@ buttonRun.setEnabled(state==State.Ready); .addComponent(buttonRun) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(buttonAbort) - .addContainerGap(151, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addComponent(jCheckBox1) + .addContainerGap(110, Short.MAX_VALUE)) ); }// //GEN-END:initComponents @@ -100,5 +109,6 @@ buttonRun.setEnabled(state==State.Ready); // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonAbort; private javax.swing.JButton buttonRun; + private javax.swing.JCheckBox jCheckBox1; // End of variables declaration//GEN-END:variables } diff --git a/plugins/ScreenPanel3.java b/plugins/ScreenPanel3.java index 7ac58bd..cc49097 100644 --- a/plugins/ScreenPanel3.java +++ b/plugins/ScreenPanel3.java @@ -3428,30 +3428,33 @@ public class ScreenPanel3 extends Panel { ChannelInteger setpoint = null; try { int index = comboScreen.getSelectedIndex(); - if (cameraName.contains("DSRM")) { - setpoint = new ChannelInteger(null, cameraName + ":POSITION_SP"); - } else { - setpoint = new ChannelInteger(null, cameraName + ":SET_SCREEN1_POS"); + if (index>=0){ + if (cameraName.contains("DSRM")) { + setpoint = new ChannelInteger(null, cameraName + ":POSITION_SP"); + } else { + setpoint = new ChannelInteger(null, cameraName + ":SET_SCREEN1_POS"); + } + setpoint.initialize(); + Integer readback = setpoint.read(); + if ((readback==null) || (setpoint.read() != index)) { + setpoint.write(index); + //Must be threaded to control the laser because of sleep in setLaserState + /* + boolean laserOn = getLaserState(); + if (laserOn) { + setLaserState(false); + } + try { + setpoint.write(index); + } finally { + if (laserOn) { + setLaserState(true); + } + } + */ + } + screen.read(); } - setpoint.initialize(); - if (setpoint.read() != index) { - setpoint.write(index); - //Must be threaded to control the laser because of sleep in setLaserState - /* - boolean laserOn = getLaserState(); - if (laserOn) { - setLaserState(false); - } - try { - setpoint.write(index); - } finally { - if (laserOn) { - setLaserState(true); - } - } - */ - } - screen.read(); } catch (Exception ex) { showException(ex); } finally { @@ -3467,8 +3470,10 @@ public class ScreenPanel3 extends Panel { private void comboFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboFilterActionPerformed try { String setpoint = (String) comboFilter.getSelectedItem(); - if (!setpoint.equals(filter.read())) { - filter.write(setpoint); + if (setpoint!=null){ + if (!setpoint.equals(filter.read())) { + filter.write(setpoint); + } } } catch (Exception ex) { showException(ex); diff --git a/plugins/Tomaz.form b/plugins/Tomaz.form new file mode 100644 index 0000000..76ddc7e --- /dev/null +++ b/plugins/Tomaz.form @@ -0,0 +1,46 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/Tomaz.java b/plugins/Tomaz.java new file mode 100644 index 0000000..ac425c0 --- /dev/null +++ b/plugins/Tomaz.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2014-2018 Paul Scherrer Institute. All rights reserved. + */ + +import ch.psi.pshell.bs.ProviderConfig; +import ch.psi.pshell.ui.Console; +import ch.psi.pshell.ui.Panel; +import ch.psi.utils.Config; +import ch.psi.utils.State; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + */ +public class Tomaz extends Panel { + + final Console console; + + public Tomaz() { + initComponents(); + console = new Console() { + protected void onConsoleCommand(String name, String[] pars, String trimming) throws Exception { + switch (name) { + case "test": + System.out.println("OK"); + break; + } + } + }; + } + + @Override + public void onStart() { + super.onStart(); + console.start(); + } + + @Override + public void onStop() { + super.onStart(); + console.stop(); + } + + //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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + + jButton1.setText("jButton1"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(133, 133, 133) + .addComponent(jButton1) + .addContainerGap(219, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(38, 38, 38) + .addComponent(jButton1) + .addContainerGap(70, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + //showSettingsEditor(false); + //showSettingsEditor(true); + Config cfg = new ProviderConfig(); + try { + cfg.load("~/test.cfg"); + } catch (IOException ex) { + Logger.getLogger(Tomaz.class.getName()).log(Level.SEVERE, null, ex); + } + showConfigEditor(cfg, true); + }//GEN-LAST:event_jButton1ActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + // End of variables declaration//GEN-END:variables +} diff --git a/script/TestRet.py b/script/TestRet.py index e020c93..9794975 100644 --- a/script/TestRet.py +++ b/script/TestRet.py @@ -3,7 +3,7 @@ is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before callin "run" - +#time.sleep(4) print is_panel, get_exec_pars().source ret = [] @@ -11,4 +11,5 @@ for i in range(10): ret.extend([i]) print "OK" +#raise Exception("test ex") set_return(ret) diff --git a/script/cpython/wrapper.py b/script/cpython/wrapper.py index 51ee494..c61c851 100755 --- a/script/cpython/wrapper.py +++ b/script/cpython/wrapper.py @@ -1,6 +1,5 @@ from jeputils import * - def gfitoff(x, y, off=None, amp=None, com=None, sigma=None): ret = call_jep("cpython/GaussFit", "gfitoff", [to_npa(x), to_npa(y), off, amp, com, sigma]) return ret if ret is None or is_list(ret) else ret.data diff --git a/script/diffcalc/diffutils.py b/script/diffcalc/diffutils.py index 9324f3b..cf848ad 100644 --- a/script/diffcalc/diffutils.py +++ b/script/diffcalc/diffutils.py @@ -15,7 +15,7 @@ # Library loading and Hardware setup ################################################################################################### -#1- Create a MontorGroup with the diffractometer motors +#1- Create a MotorGroup with the diffractometer motors # e.g. 'sixc', containing mu, delta, gam, eta, chi, phi motors (gam = nu) # or 'fivec', containing delta, gam, eta, chi, phi motors # or 'fourc', containing delta, eta, chi, phi motors @@ -35,7 +35,7 @@ if not diffcalc_path in sys.path: import diffcalc from diffcalc import settings -from diffcalc.hkl.you.geometry import SixCircle, FiveCircle, FourCircle +from diffcalc.hkl.you.geometry import YouGeometry,SixCircle, FiveCircle, FourCircle, YouPosition from diffcalc.hardware import HardwareAdapter from diffcalc.ub.persistence import UbCalculationNonPersister from diffcalc.gdasupport.minigda.scannable import ScannableBase, ScannableGroup @@ -80,31 +80,13 @@ class PositionerScannable(ScannableBase): class PositionerScannableGroup(ScannableGroup): def __init__(self, name, motors): self.name = name - if len(motors)==6: - [mu, delta, gam, eta, chi, phi] = motors - self.mu = PositionerScannable(mu, "mu") - self.delta = PositionerScannable(delta, "delta") - self.gam = PositionerScannable(gam, "gam") - self.eta = PositionerScannable(eta, "eta") - self.chi = PositionerScannable(chi, "chi") - self.phi = PositionerScannable(phi, "phi") - ScannableGroup.__init__(self, self.name, [self.mu, self.delta, self.gam, self.eta, self.chi, self.phi]) - elif len(motors)==5: - [delta, gam, eta, chi, phi] = motors - self.delta = PositionerScannable(delta, "delta") - self.gam = PositionerScannable(gam, "gam") - self.eta = PositionerScannable(eta, "eta") - self.chi = PositionerScannable(chi, "chi") - self.phi = PositionerScannable(phi, "phi") - ScannableGroup.__init__(self, self.name, [self.delta, self.gam, self.eta, self.chi, self.phi]) - elif len(motors)==4: - [delta, eta, chi, phi] = motors - self.delta = PositionerScannable(delta, "delta") - self.eta = PositionerScannable(eta, "eta") - self.chi = PositionerScannable(chi, "chi") - self.phi = PositionerScannable(phi, "phi") - ScannableGroup.__init__(self, self.name, [self.delta, self.eta, self.chi, self.phi]) - + print self.getInputNames() + positioners = [] + for m in motors: + exec('self.' + m.name + ' = PositionerScannable(' + m.name + ', "' + m.name + '")') + exec('positioners.append(self.' + m.name + ')' ) + ScannableGroup.__init__(self, self.name, positioners) + class MotorGroupScannable(PositionerScannableGroup): def __init__(self, motor_group): self.motor_group = motor_group @@ -223,18 +205,21 @@ class HklGroup(RegisterBase, Register.RegisterArray): you = None dc, ub, hardware, hkl = None, None, None, None _motor_group = None -def setup_diff(diffractometer, energy): +def setup_diff(diffractometer, energy, geometry=None): """ diffractometer: Motor group containing: - mu, delta, gam, eta, chi, phi (six circle) or - delta, gam, eta, chi, phi (ficve circle) or - delta, eta, chi, phi (four circle) energy: Positioner having energy in kev + geometry: YouGeometry extension. If none, uses default """ global you, dc, ub, hardware, hkl, _motor_group _motor_group = diffractometer - you =None - if len(diffractometer.motors) == 6: + you = None + if geometry is not None: + settings.geometry = geometry + elif len(diffractometer.motors) == 6: settings.geometry = SixCircle() elif len(diffractometer.motors) == 5: settings.geometry = FiveCircle() @@ -348,14 +333,14 @@ def hklscan(vector, readables,latency = 0.0, passes = 1, **pars): return scan.result -def test_difcalc(): +def test_diffcalc(): en.move(20.0) delta.config.maxSpeed = 50.0 delta.speed = 50.0 delta.move(1.0) #Setup - setup_sixc(sixc, en) + setup_diff(sixc, en) setup_axis('gam', 0, 179) setup_axis('delta', 0, 179) setup_axis('delta', min=0) diff --git a/script/diffcalc/testsixc.py b/script/diffcalc/testsixc.py index f69e368..0fb0b97 100644 --- a/script/diffcalc/testsixc.py +++ b/script/diffcalc/testsixc.py @@ -77,6 +77,7 @@ hkl_group.sim([0.0,1.0,1.0]) hkl_group.write([0.0,1.0,1.0]) + ###################################################################################################\ #Scans ################################################################################################### diff --git a/script/test/TestCfg.py b/script/test/TestCfg.py new file mode 100644 index 0000000..0c8e7f6 --- /dev/null +++ b/script/test/TestCfg.py @@ -0,0 +1,16 @@ +""" +class DevConfig(DeviceConfig): + def __init__(self): + self.i = 1 + self.d = 1.0 + self.b = True + self.s = "Test" +""" + + +class Dev(DeviceBase): + def __init__(self, name): + #DeviceBase.__init__(self, name, DevConfig()) + DeviceBase.__init__(self, name, DeviceConfig({"i":1, "d":1.0, "b":True, "s": "Test"})) +raise Exception("test ex") +add_device(Dev("test_cfg"), True) diff --git a/script/test/WireScanMock.py b/script/test/WireScanMock.py index 0090bd8..e5d4ba8 100644 --- a/script/test/WireScanMock.py +++ b/script/test/WireScanMock.py @@ -1,6 +1,6 @@ import traceback -is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before callin "run" +is_panel = False #get_exec_pars().source != CommandSource.ui #Must be checked before callin "run" #set_exec_pars(provider="txt") @@ -10,8 +10,8 @@ BPM_SENSORS = [("x","X1"), ("y","Y1"), ("q","Q1")] #(logic name sufix, channel s prefix = args[0] if is_panel else "S30CB09-DWSC440" #"SINDI01-DWSC090" scan_type = args[1] if is_panel else "X1" scan_range = args[2] if is_panel else [-200, 200, -200, 200] -cycles = args[3] if is_panel else 3 -velocity = args[4] if is_panel else 200 +cycles = args[3] if is_panel else 1 +velocity = args[4] if is_panel else 400 bpms = args[5] if is_panel else ["BPM1", "BPM2"] blms = args[6] if is_panel else ["BLM1", "BLM2"] bkgrd = args[7] if is_panel else 10 diff --git a/script/test/averager.py b/script/test/averager.py index 82039e6..3d92136 100755 --- a/script/test/averager.py +++ b/script/test/averager.py @@ -6,11 +6,11 @@ -#iavg = create_averager("ca://TESTIOC:TESTSINUS:SinCalc", 3, interval = -1) -iavg = create_averager("bs://Int8Scalar", 3, interval = 0.1) +iavg = create_averager("ca://TESTIOC:TESTSINUS:SinCalc", 3, interval = -1) +#iavg = create_averager("bs://Int8Scalar", 3, interval = 0.1) -tscan (iavg, 10, 0.5) +tscan (iavg, 10, 0.2, layout = "sf", domain_axis = "Time") #$iavg.close() \ No newline at end of file diff --git a/script/test/test_binary.py b/script/test/test_binary.py new file mode 100644 index 0000000..98f9c7a --- /dev/null +++ b/script/test/test_binary.py @@ -0,0 +1,23 @@ +################################################################################################### +# Example of using ImageJ functionalities through ijutils. +################################################################################################### + +from ijutils import * +import java.awt.Color as Color + +#Image Loading +ip = load_image("images/img.png", title="Image") + +aux = grayscale(ip, in_place = False) +bin = ip.duplicate() +ip_bin = auto_threshold(aux, in_place=False) +create_stack([ ip_bin, + #binary_fill_holes(ip_bin, in_place=False), + #binary_outline(ip_bin, in_place=False), + #binary_outline(binary_fill_holes(ip_bin, in_place=False)), + binary_dilate(ip_bin, in_place=False), + binary_erode(ip_bin, in_place=False), + binary_open(ip_bin, in_place=False), + binary_close(ip_bin, in_place=False), + binary_skeletonize(ip_bin, in_place=False)], title = "Binarization").show() + diff --git a/script/test/testmain.py b/script/test/testmain.py new file mode 100644 index 0000000..2dd94e1 --- /dev/null +++ b/script/test/testmain.py @@ -0,0 +1,7 @@ + +def add(a1, a2): + return a1+a2 + + +if __name__ == "__main__": + print add(4,3) diff --git a/script/testfourcv.py b/script/testfourcv.py new file mode 100644 index 0000000..354ff67 --- /dev/null +++ b/script/testfourcv.py @@ -0,0 +1,114 @@ +en.move(20.0) +delta.config.maxSpeed = 50.0 +delta.speed = 50.0 +delta.move(1.0) + +run("diffcalc/diffutils") +###################################################################################################\ +#Setup +################################################################################################### + +class FourCircleX04SA_V(YouGeometry): + """For a diffractometer with angles: + mu, delta, nu, eta + """ + def __init__(self): + YouGeometry.__init__(self, 'fourcv', {'phi': 0, 'chi': 0}) + + def physical_angles_to_internal_position(self, physical_angle_tuple): + # mu, delta, nu, eta, chi, phi + mu, delta, nu, eta = physical_angle_tuple + return YouPosition(mu, delta, nu, eta, 0, 0) + + def internal_position_to_physical_angles(self, internal_position): + mu, delta, nu, eta, _, _ = internal_position.totuple() + return mu, delta, nu, eta + + + + +###################################################################################################\ +#Setup +################################################################################################### + +#alp, del, gam, ov +FourCircleX04SA_V() +setup_diff(fourcv, en, FourCircleX04SA_V()) + +# Set some limits +setup_axis('delta', 0, 90) +setup_axis('delta', min=0) +#setup_axis('gam', 0, 180) +#setup_axis('eta', cut=-180.0) + +print_axis_setup() + +###################################################################################################\ +#Orientation +################################################################################################### +help(ub.ub) +ub.listub() + +# Create a new ub calculation and set lattice parameters +ub.newub('test') +ub.setlat('cubic', 1, 1, 1, 90, 90, 90) + +# Add 1st reflection (demonstrating the hardware adapter) +settings.hardware.wavelength = 1 +ub.c2th([1, 0, 0]) # energy from hardware +settings.hardware.position = 0, 60, 0, 30, 0, 0 +ub.addref([1, 0, 0])# energy and position from hardware + +# Add 2nd reflection (this time without the harware adapter) +ub.c2th([0, 1, 0], 12.39842) +ub.addref([0, 1, 0], [60, 30, 0, 90], 12.39842) + +# check the state +ub.ub() +ub.checkub() + + + +###################################################################################################\ +#Constraints +################################################################################################### +help(hkl.con) +hkl.con('a_eq_b') + + +###################################################################################################\ +#Motion +################################################################################################### +print angles_to_hkl((0.0, 60., 0.0, 30.)) +print hkl_to_angles(1, 0, 0) +fourc.write([60, 30, 90, 0]) +print "fourc=" , fourc.position +wl.write(1.0) +print "wl = ", wl.read() + +# Load the last ub calculation used +ub.lastub() +ub.setu ([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) +ub.showref() +ub.swapref(1,2) + +#print you.hkl +#pos(get_hkl()) +hkl_group.read() +#you.hkl.simulateMoveTo([0,1,1]) +#sim(get_hkl(), [0,1,1]) +hkl_group.sim([0.0,1.0,1.0]) +#pos(get_hkl(), [0,1,1]) +hkl_group.write([0.0,1.0,1.0]) + + +###################################################################################################\ +#Scans +################################################################################################### +lscan(l, [sin], 0.5, 1.0, 0.1) +ascan([k,l], [sin], [1.0, 1.0], [1.2, 1.3], [0.1, 0.1], latency=0.5, zigzag=True, parallel_positioning = False) +vector = [[1.0,1.0,1.0], [1.0,1.0,1.1], [1.0,1.0,1.2], [1.0,1.0,1.4]] +hklscan(vector, [sin, arr]) + + + diff --git a/script/testmain.py b/script/testmain.py new file mode 100644 index 0000000..6bee76e --- /dev/null +++ b/script/testmain.py @@ -0,0 +1,8 @@ + +def add(a1, a2): + print __name__ + return a1+a2 + + +if __name__ == "__main__": + print add(4,3) diff --git a/script/testws.py b/script/testws.py new file mode 100644 index 0000000..33fe39d --- /dev/null +++ b/script/testws.py @@ -0,0 +1,8 @@ + +def testwsm(): + + from startup import run, get_return + ret = run ("test/WireScanMock") + + + print "Ret:", ret \ No newline at end of file diff --git a/script/testws2.py b/script/testws2.py new file mode 100644 index 0000000..16e497b --- /dev/null +++ b/script/testws2.py @@ -0,0 +1,3 @@ +from testws import testwsm + +testwsm() \ No newline at end of file diff --git a/script/tools/findrecord.py b/script/tools/findrecord.py new file mode 100644 index 0000000..07345af --- /dev/null +++ b/script/tools/findrecord.py @@ -0,0 +1,314 @@ +#!/usr/bin/env python +# ---------------------------------------------------------------------- +# Find IOCs providing an EPICS record using a web service +# +# $Id: findrecord.py,v 1.25 2016/07/01 12:15:30 lauk Exp $ +# ---------------------------------------------------------------------- + +import getopt +import os +import socket +import sys +import urllib +import urllib2 +import xml.sax + +PROGRAM = os.path.basename(sys.argv[0]) +CVS_REVISION = "$Revision: 1.25 $" +__version__ = CVS_REVISION + +WS_URL = 'http://epics-boot-info.psi.ch/find-channel.aspx' +TIMEOUT = 15 # seconds + + +HEADER_FIELDS = { + 'active': (('RECORD', 40, 'Channel'), + ('RECORD TYPE', 16, 'RecordType'), + ('DESCRIPTION', 40, 'Description'), + ('IOC', 25, 'IOC'), + ('FACILITY', 8, 'Facility')), + 'deleted': (('RECORD', 40, 'Channel'), + ('RECORD TYPE', 16, 'RecordType'), + ('DESCRIPTION', 40, 'Description'), + ('IOC', 25, 'IOC'), + ('FACILITY', 8, 'Facility'), + ('LAST SEEN', 19, 'LastSeenOn'), + ('DELETED ON', 19, 'DeletedOn')) +} + + +class FindChannelHandler(xml.sax.ContentHandler): + """ + SAX handler for parsing the XML of the find-channel.aspx web service. + """ + + attr_names = ('Channel', 'RecordType', 'Description', 'IOC', 'Facility', 'LastSeenOn', 'DeletedOn') + + def __init__(self, channel_callback): + self._channel_callback = channel_callback + + def startElement(self, name, attrs): + if name == 'entry': + d = {} + for a in FindChannelHandler.attr_names: + d[a] = attrs.get(a, None) + self._channel_callback(d) + + +class OutputProcessor: + """ + A base class for processing results to output. This class defines the common interface. + """ + + def __init__(self, out): + """ + Create a new instance. + + :param out: A stream to write to (any object with a ``write`` method, that takes a string). + """ + self.__out = out + + def write(self, s): + """ + Write ``s`` to this processors stream. + + :param s: The ``string`` to write. + """ + self.__out.write(s.encode('utf-8')) + + def print_header(self): + """ + API for printing a header. + """ + pass + + def print_channel(self, channel): + """ + API for handling a single result entry. + + :param channel: A ``dict`` with keys set from the XML handler. + """ + pass + + def print_footer(self): + """ + API for printing a footer + """ + pass + + +class TableOutputProcessor(OutputProcessor): + """ + An output processor that generates ASCII tables + """ + + def __init__(self, out, field_separator, header_labels, field_lengths, field_names): + """ + Create a new instance. + + :param out: The stream to ``write`` to. + :param field_separator: The field separator, separating columns from each other. + :param header_labels: The labels for displaying a header line. + :param field_lengths: The width of each column. + """ + OutputProcessor.__init__(self, out) + self._header_labels = dict(zip(field_names, header_labels)) + self._header_lines = dict(zip(field_names, tuple(['-' * x for x in field_lengths]))) + self._format = field_separator.join(['%%(%s)-%ds' % (f, n) for (f, n) in zip(field_names, field_lengths)]) + "\n" + + def print_header(self): + self.write(self._format % self._header_labels) + self.write(self._format % self._header_lines) + + def print_channel(self, channel): + self.write(self._format % channel) + + +class ListPVsOutputProcessor(OutputProcessor): + + def __init__(self, out): + OutputProcessor.__init__(self, out) + + def print_channel(self, channelDict): + self.write(channelDict['Channel']) + self.write('\n') + + +class Counter: + """ + A simple counter, because for closures to work, Python needs an object, not a primitive. + """ + def __init__(self, start_from=0): + self.count = start_from + + def increment(self, amount=1): + self.count += amount + + +def main(): + + opts, args = getopt.getopt(sys.argv[1:], 'df:hi:lrt:u:vx', + ['deleted', 'exact-search', 'facility=', 'help', 'ioc=', 'limit=', 'listpvs', 'regex', + 'timeout=', 'url=', 'version']) + url = WS_URL + timeout = TIMEOUT + search_opts = {'source': 'active', 'limit': 100} + display_opts = {'outputmode': 'table', + 'header_fields': HEADER_FIELDS['active'], + 'field_separator': ' ' + } + for o, a in opts: + if o in ('-d', '--deleted'): + search_opts['source'] = 'deleted' + timeout = 60 + if o in ('-f', '--facility'): + search_opts['facility'] = a + if o in ('-h', '--help'): + usage(sys.stdout) + return 0 + if o in ('-i', '--ioc'): + search_opts['ioc'] = a + if o in ('-l', '--listpvs'): + display_opts['outputmode'] = 'listpvs' + if o in ('--limit',): + search_opts['limit'] = int(a) + timeout = 60 + if o in ('-r', '--regex'): + search_opts['match'] = 'regex' + if o in ('-t', '--timeout'): + timeout = float(a) + if o in ('-u', '--url'): + url = a + if o in ('-v', '--version'): + sys.stdout.write('%s - %s\n' % (PROGRAM, __version__)) + return 0 + if o in ('-x', '--exact-search'): + search_opts['match'] = 'exact' + if len(args) == 0: + raise RuntimeError('No search pattern given. Try -h for help.') + if len(args) > 1: + raise RuntimeError('Too many arguments. Try -h for help.') + display_opts['header_fields'] = HEADER_FIELDS[search_opts['source']] + output_processor = create_output_processor(sys.stdout, display_opts) + output_processor.print_header() + pattern = args[0] + num_results = Counter() # need instance, because of closure + + def channel_callback(channel): + num_results.increment() + output_processor.print_channel(channel) + + search(url, pattern, search_opts, timeout, FindChannelHandler(channel_callback)) + output_processor.print_footer() + if num_results.count and num_results.count == search_opts['limit']: + sys.stderr.write('%s: WARNING! Number of search results exactly matches limit. Maybe there is more data...\n' + % PROGRAM) + + +def usage(out): + out.write(''' +Usage: findrecord [OPTIONS] PVSEARCH + +OPTIONS: + -d, --deleted Search for deleted records + -f FACILITY, --facility FACILITY Limit search to FACILITY + -h, --help Display instructions and exit + -i IOC, --ioc IOC Limit search to IOC + -l, --listpvs Display only PV names (one per line) + --limit COUNT Limit number of results to COUNT + (default: 100, 0=no limit) + -r, --regex Treat PATTERN as a regular expression + -t SEC, --timeout SEC Timeout in seconds (default = 15) + -u URL, --url URL Set base URL of web service. + -v, --version Display version and exit + -x, --exact-search Disable wildcard searches + + +NOTE: PVSEARCH must be preceded with '--' if PVSEARCH itself starts +with a '-' (see examples below). + +EXAMPLES: + 1. Search for all PVs that contain 'VME' anywhere in the name + (implicit wildcard search): + findrecord VME + + 2. Search for all PVs that start with 'ARIDI-PCT': + findrecord ARIDI-PCT% + findrecord -r '^ARIDI-PCT' + + 3. Search for all PVs ending in ':CURRENT': + findrecord %:CURRENT + findrecord -r ':CURRENT$' + + 4. Search for all PVs containing '-PCT' (note the '--'): + findrecord -- -PCT + + 5. Search for all PVs starting with 'ARIDI' and ending in ':CURRENT' + (note that no implicit prefix and suffix % are added for you): + findrecord ARIDI%:CURRENT + findrecord -r '^ARIDI.*:CURRENT$' + + 6. Search for all PVs with 'ARIDI' anywhere in the name, followed by + ':CURRENT' anywhere behind that (note the exmplicit prefix and + suffix % around the search term): + findrecord %ARIDI%:CURRENT% + findrecord -r 'ARIDI.*:CURRENT' +''') + + +def create_output_processor(out, display_opts): + if display_opts['outputmode'] == 'table': + labels, widths, field_names = zip(*display_opts['header_fields']) + result = TableOutputProcessor(out, display_opts['field_separator'], labels, widths, field_names) + elif display_opts['outputmode'] == 'listpvs': + result = ListPVsOutputProcessor(out) + else: + raise RuntimeError('Unsupported output mode: %s' % display_opts['outputmode']) + return result + + +def search(url, pattern, search_opts, timeout, xml_handler): + """ + Search the webservice at `url` for `pattern`. + + :param url: The URL to the web service. + :param pattern: The pattern to search for. + :param ioc: Limit search to this IOC + :param timeout: The number of seconds to wait for an HTTP connection. + :param xml_handler: The SAX content handler to use when parsing the HTTP response. + """ + # Workaround for https://tracker.psi.ch/jira/browse/CTRLIT-3391 + if pattern[-1] == ':': + if 'match' not in search_opts: + pattern = '%' + pattern + '%' + elif search_opts['match'] == 'regex': + pattern = pattern + '.*' + elif search_opts['match'] == 'exact': + raise ValueError('Unfortunately you found a known bug. Your search pattern must not end in ":" when using the exact matching mode.') + query = search_opts.copy() + query['format'] = 'xml' + + full_url = '%s/%s?%s' % (url, urllib.quote(pattern), urllib.urlencode(query)) + # In Python 2.4 (SL5), `urlopen` does not have a `timeout` parameter. + # We have to use the timeout mechanism of the `socket` module. + socket.setdefaulttimeout(timeout) + try: + f = urllib2.urlopen(full_url) + try: + parser = xml.sax.make_parser() + parser.setContentHandler(xml_handler) + parser.parse(f) + finally: + f.close() + except urllib2.HTTPError, e: + if e.code == 500: # internal server error + raise RuntimeError('The web service encountered an error. Please inform Controls IT.') + if e.code == 503: # service not available + raise RuntimeError('The web service is currently not available. Try again in a few minutes.') + raise e # nothing special; just raise it again + + +if __name__ == '__main__': + print "a" + sys.argv = ["findrecord.py", "AVG"] + main() diff --git a/script/tstinject.py b/script/tstinject.py new file mode 100644 index 0000000..87b98de --- /dev/null +++ b/script/tstinject.py @@ -0,0 +1,14 @@ + +from startup import inject, set_return + +def test(): + #from startup import lscan + #print lscan + inject() + global motor + print motor + motor=1 + print motor + inject() + print motor + set_return("VIVA") \ No newline at end of file