PSI sics-cvs-psi-2008-10-02

This commit is contained in:
2008-10-02 00:00:00 +00:00
committed by Douglas Clowes
parent 6e926b813f
commit 4baffb9b7a
304 changed files with 77527 additions and 3612 deletions

View File

@ -1,3 +1,3 @@
120
230
NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n

36
mcstas/dmc/README Normal file
View File

@ -0,0 +1,36 @@
VIRTUAL DMC
This is the SICS-McStas virtual instrument DMC modelled after the real
powder diffcractometer DMC at SINQ:
http://sinq.web.psi.ch/sinq/instr/dmc/dmc.html
The McStas simulation used for this system has been verified against
the real instrument. The basic usage is to start the SICServer with:
./SICServer vdmc.tcl
in this directory. Then you can connect to SICS at localhost/2911
with any SICS client and start issuing commands.
In order to save simulation time, the simulation works with
neutron data files presimulated for four wavelength up to the sample.
This is why you get your wavelength coerced to the nearest
precalculated value.
If you desire to "measure" your own sample on virtual DMC, you first
have to create a LazyPulverix output file. You then can proceed to
load the sample into SICS with the SICS command:
sample load path-to-lazy-pulverix-outputfile
The command:
sample list
tells you which samples virtual DMC already knows about.
Questions and comments to: Mark.Koennecke@psi.ch

8436
mcstas/dmc/dmcafter.c Normal file

File diff suppressed because it is too large Load Diff

174
mcstas/dmc/gumibatch.tcl Normal file
View File

@ -0,0 +1,174 @@
#-------------------------------------------------------------
# This is a set of Tcl procedures which try to convert an old
# batch file into a batch file suitable for Mountaingum.
#
# copyright: GPL
#
# Mark Koennecke, February 2008
#-------------------------------------------------------------
if {[string first tmp $home] < 0} {
set tmppath $home/tmp
} else {
set tmppath $home
}
#-------------------------------------------------------------
proc searchPathForDrivable {name} {
set path [string trim [hmatchprop / sicsdev $name]]
if {[string compare $path NONE] != 0} {
return $path
}
set txt [findalias $name]
if {[string compare $txt NONE] == 0} {
return NONE
}
set l1 [split $txt =]
set l [split [lindex $l1 1] ,]
foreach alias $l {
set alias [string trim $alias]
set path [string trim [hmatchprop / sicsdev $alias]]
if {[string compare $path NONE] != 0} {
return $path
}
}
return NONE
}
#----------------------------------------------------------------
proc searchForCommand {name} {
return [string trim [hmatchprop / sicscommand $name]]
}
#----------------------------------------------------------------
proc treatsscan {scanpath command out} {
set l [split $command]
set len [llength $l]
set noVar [expr ($len-2)/3]
set np [lindex $l [expr $len -2]]
set preset [lindex $l [expr $len -1]]
for {set i 0} {$i < $noVar} {incr i} {
set start [expr $i * 3]
set scanVar [lindex $l [expr 1 + $start]]
set scanStart [lindex $l [expr 2 + $start]]
set scanEnd [lindex $l [expr 3 + $start]]
set scanStep [expr ($scanEnd*1. - $scanStart*1.)/$np*1.]
append hdbVar $scanVar ,
append hdbStart $scanStart ,
append hdbStep $scanStep ,
}
set hdbVar [string trim $hdbVar ,]
set hdbStart [string trim $hdbStart ,]
set hdbStep [string trim $hdbStep ,]
puts $out "\#NODE: $scanpath"
puts $out "clientput BatchPos = 1"
puts $out "hdbscan $hdbVar $hdbStart $hdbStep $np monitor $preset"
}
#----------------------------------------------------------------
proc treatcscan {scanpath command out} {
set l [split $command]
set scanVar [lindex $l 1]
set scanCenter [lindex $l 2]
set scanStep [lindex $l 3]
set np [lindex $l 4]
set preset [lindex $l 5]
set hdbStart [expr $scanCenter - ($np*1.0)/2. * $scanStep*1.0]
puts $out "\#NODE: $scanpath"
puts $out "clientput BatchPos = 1"
puts $out "hdbscan $scanVar $hdbStart $scanStep $np monitor $preset"
}
#----------------------------------------------------------------
proc translateCommand {command out} {
set drivelist [list drive dr run]
set textList [list for while source if]
# clientput "Translating: $command"
set command [string trim $command]
if {[string length $command] < 2} {
return
}
set l [split $command]
set obj [string trim [lindex $l 0]]
#------- check for drive commands
set idx [lsearch $drivelist $obj]
if {$idx >= 0} {
set dev [lindex $l 1]
set path [searchPathForDrivable $dev]
if {[string compare $path NONE] != 0} {
set realTxt [hgetprop $path sicsdev]
set realL [split $realTxt =]
set realDev [lindex $realL 1]
set mapList [list $dev $realDev]
set newCom [string map $mapList $command]
puts $out "\#NODE: $path"
puts $out "clientput BatchPos = 1"
puts $out $newCom
return
}
}
#------ check for well known broken commands
set idx [lsearch $textList $obj]
if {$idx >= 0} {
puts $out "\#NODE: /batch/commandtext"
puts $out "clientput BatchPos = 1"
set buffer [string map {\n @nl@} $command]
puts $out "hset /batch/commandtext $buffer"
return
}
#--------- check for simple commands
set path [searchForCommand $command]
if {[string compare $path NONE] != 0} {
puts $out "\#NODE: $path"
puts $out "clientput BatchPos = 1"
puts $out $command
return
}
set scancom [searchForCommand hdbscan]
#---------- deal with scans
if {[string first sscan $obj] >= 0} {
if {[catch {treatsscan $scancom $command $out}] == 0} {
return
}
}
if {[string first cscan $obj] >= 0} {
if {[catch {treatsscan $scancom $command $out}] == 0} {
return
}
}
#--------- give up: output as a text node
puts $out "\#NODE: /batch/commandtext"
puts $out "clientput BatchPos = 1"
set buffer [string map {\n @nl@} $command]
puts $out "hset /batch/commandtext $buffer"
}
#----------------------------------------------------------------
proc mgbatch {filename} {
global tmppath
set f [open $filename r]
gets $f line
close $f
if {[string first MOUNTAINBATCH $line] > 0} {
#--------- This is a mountaingum batch file which does not need
# to be massaged
return $filename
}
set f [open $filename r]
set realfilename [file tail $filename]
set out [open $tmppath/$realfilename w]
puts $out \#MOUNTAINBATCH
while {[gets $f line] >= 0} {
append buffer $line
if {[info complete $buffer] == 1} {
translateCommand $buffer $out
unset buffer
} else {
append buffer \n
}
}
close $out
return $tmppath/$realfilename
}
#----------------------------------------------------------------
proc loadmgbatch {filename} {
set txt [exe fullpath $filename]
set l [split $txt =]
set realf [lindex $l 1]
set realf [mgbatch $realf]
return [exe print $realf]
}

80
mcstas/dmc/gumxml.tcl Normal file
View File

@ -0,0 +1,80 @@
proc getdataType {path} {
return [lindex [split [hinfo $path] ,] 0]
}
proc make_nodes {path result indent} {
set nodename [file tail $path];
set type [getdataType $path]
set prefix [string repeat " " $indent]
set newIndent [expr $indent + 2]
#array set prop_list [ string trim [join [split [hlistprop $path] =]] ]
set prop_list(control) true
set we_have_control [info exists prop_list(control)]
if {$we_have_control == 0 || $we_have_control && $prop_list(control) == "true"} {
append result "$prefix<component id=\"$nodename\" dataType=\"$type\">\n"
foreach p [property_elements $path $newIndent] {
append result $p
}
foreach x [hlist $path] {
set result [make_nodes [string map {// /} "$path/$x"] $result $newIndent]
}
append result "$prefix</component>\n"
}
return $result
}
proc property_elements_old {path indent} {
set prefix [string repeat " " $indent]
foreach {key value} [string map {= " "} [hlistprop $path]] {
if {[string compare -nocase $key "control"] == 0} {continue}
lappend proplist "$prefix<property id=\"$key\">\n"
# foreach v [split $value ,] {
# lappend proplist "$prefix$prefix<value>$v</value>\n"
# }
lappend proplist "$prefix$prefix<value>$value</value>\n"
lappend proplist "$prefix</property>\n"
}
if [info exists proplist] {return $proplist}
}
proc property_elements {path indent} {
set prefix [string repeat " " $indent]
set data [hlistprop $path]
set propList [split $data \n]
foreach prop $propList {
set pl [split $prop =]
set key [string trim [lindex $pl 0]]
set value [string trim [lindex $pl 1]]
if {[string length $key] < 1} {
continue
}
lappend proplist "$prefix<property id=\"$key\">\n"
lappend proplist "$prefix$prefix<value>$value</value>\n"
lappend proplist "$prefix</property>\n"
}
if [info exists proplist] {return $proplist}
}
proc getgumtreexml {path} {
append result "<?xml version = \"1.0\" encoding = \"UTF-8\"?>\n"
append result "<hipadaba:SICS xmlns:hipadaba=\"http://www.psi.ch/sics/hipadaba\" >\n"
if {[string compare $path "/" ] == 0} {
foreach n [hlist $path] {
set result [make_nodes $n $result 2]
}
} else {
# set result [make_nodes $path $result 2]
foreach n [hlist $path] {
set result [make_nodes $path/$n $result 2]
}
}
append result "</hipadaba:SICS>\n"
}
if {[info exists guminit] == 0} {
set guminit 1
Publish getgumtreexml Spy
}

View File

@ -30,7 +30,7 @@ proc washsimfile {name} {
# dump its data. Otherwise we observe that data reading fails.
# mcwaittime is used for this. Increase if you see problems
#--------------------------------------------------------------------
set mcwaittime 7
set mcwaittime 2
#----------------------------------------------------------------------
proc mcstasdump {pid} {
global mcwaittime

View File

@ -4,6 +4,7 @@
# This is the scripted version using nxscript
#
# Mark Koennecke, May 2004
# This is a special version for virtual DMC on lns00
#---------------------------------------------------------------------------
proc storeMonochromator {} {
@ -75,14 +76,34 @@ proc makeLinks {} {
nxscript makelink dana dtnstep
nxscript makelink dana mlambda
}
#------------------------------------------------------------------------
proc makeSimFileName args {
global datahome
sicsdatanumber incr
set num [SplitReply [sicsdatanumber]]
return [makeSimForNum $num]
}
#------------------------------------------------------------------------
proc makeSimForNum {num} {
global datahome
set pre [string trim [SplitReply [sicsdataprefix]]]
set po [string trim [SplitReply [sicsdatapostfix]]]
return [format "%s/%s2006n%6.6d%s" $datahome $pre $num $po]
}
#-------------------------------------------------------------------------
# store DMC data
#-------------------------------------------------------------------------
proc storedata {} {
global home
set fil [newFileName]
global home wwwMode
if {$wwwMode == 1} {
set fil [makeSimFileName]
} else {
set fil [newFileName]
}
lastdatafile $fil
clientput "Opening $fil for writing"
nxscript create4 $fil $home/dmc.dic
nxscript createxml $fil $home/dmc.dic
writeStandardAttributes $fil
writeTextVar etitle title

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,19 @@
# --------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Initialization script for a virtual DMC instrument using a McStas
# simulationas a data source
#
# Dr. Mark Koennecke, June 2005
#---------------------------------------------------------------------------
# O P T I O N S
set home $env(HOME)/src/workspace/sics/mcstas/dmc
# wwwMode = 1 when running for the WWW-VDMC application
set wwwMode 0
if {$wwwMode == 1} {
set home /home/lnswww/vinstrument/mcstas/dmc
set datahome /home/lnswww/www/vinstrument
} else {
set home $env(HOME)/src/workspace/sics/mcstas/dmc
ServerOption LoggerDir $env(HOME)/src/workspace/sics/mcstas/dmc/samenv
}
#--------------------------------- first all the server options are set
#ServerOption RedirectFile $home/stdcdmc
ServerOption ReadTimeOut 10
@ -26,21 +32,22 @@ SicsUser lnsmanager lnsSICSlns 1
SicsUser Manager Manager 1
SicsUser user looser 2
SicsUser Spy 007 1
SicsUser User 07lns1 2
#--------------------------------------------------------------------------
# D E V I C E S : M O T O R S
#---------------------------------------------------------------------------
ClientPut "Installing Motors"
Motor OmegaM SIM 0 120 -.1 2.
Motor TwoThetaM SIM 30 100 -.1 1.
Motor MonoX SIM -30 30 -.1 3.0
Motor MonoY SIM -30 30 -.1 3.0
Motor CurveM SIM 0 20 -.1 3.0
Motor MonoPhi SIM -30 30 -.1 3.0
Motor MonoChi SIM -30 30 -.1 3.0
Motor OmegaM SIM 0 120 .0000001 2.
Motor TwoThetaM SIM 30 100 .0000001 1.
Motor MonoX SIM -30 30 .00000001 3.0
Motor MonoY SIM -30 30 .000000001 3.0
Motor CurveM SIM 0 20 .000000001 3.0
Motor MonoPhi SIM -30 30 .00000001 3.0
Motor MonoChi SIM -30 30 .00000001 3.0
# sample Table
Motor Table SIM -180 360 -.1 2.
Motor TwoThetaD SIM -10 120 -.1 1.
Motor Table SIM -180 360 .0000001 2.
Motor TwoThetaD SIM -10 120 .0000001 1.
#-------------------------------------------------------------
# Monochromator
#-------------------------------------------------------------
@ -61,6 +68,7 @@ allowexec $home/dmcafter
allowexec $home/dmc_sics05
ClientPut "Installing counter"
MakeCounter counter mcstas
counter SetExponent 1
MakeHM banana mcstas
@ -74,7 +82,7 @@ banana CountMode Timer
banana configure Counter counter
banana configure init 0
banana init
banana exponent 3
#banana exponent 3
#-------------------------------------------------------------------------
# Aliases
#-------------------------------------------------------------------------
@ -117,33 +125,251 @@ VarMake starttime Text User
starttime ""
VarMake SicsDataPrefix Text Internal
SicsDataPrefix vdmc
#--------- make data number
MakeDataNumber SicsDataNumber $home/DataNumber
VarMake SicsDataPostFix Text Internal
SicsDataPostFix ".hdf"
SicsDataPostFix ".xml"
VarMake Adress Text User
VarMake phone Text User
VarMake fax Text User
VarMake email Text User
VarMake sample_mur Float User
VarMake lastdatafile Text User
VarMake lastscancommand Text User
lastscancommand "unknown scan"
#--------------------------------------------------------------------------
# P R O C E D U R E S
#--------------------------------------------------------------------------
MakeDrive
MakeBatchManager
MakeNXScript
MakeRuenBuffer
#------------------------------------------------------------------------
# simulated scanning for demo purposes
#-----------------------------------------------------------------------
MakeCounter lieselotte SIM -1
MakeMultiCounter scanCter lieselotte
#------------------------------
proc SICSValue {command} {
set txt [eval $command]
set l [split $txt =]
return [string trim [lindex $l 1]]
}
#-----------------------------------------------------------------------
proc scantransfer {} {
set FWHM 1.5
set pos 5.33
set height 700
set stddev [expr $FWHM/2.354]
set ftmp [expr ([SICSValue a3] - $pos)/$stddev]
set count [expr 10 + $height*0.4*exp(-.5*$ftmp*$ftmp)]
set counti [expr int($count)]
append res [SICSValue "lieselotte gettime"] " "
append res $counti " "
for {set i 1} {$i < 7} {incr i} {
append res [SICSValue "lieselotte getmonitor $i"] " "
}
return $res
}
scancter transferscript scantransfer
MakeScanCommand xxxscan scancter $home/dmc.hdd $home/recover.bin
MakePeakCenter xxxscan
#-------------------- initialize scripted commands
source $home/vdmccom.tcl
#-------------------- configure commandlog
commandlog auto
commandlog intervall 5
#----------- enable sycamore
#InstallProtocolHandler
#InstallSinfox
#source sycFormat.tcl
#source /usr/lib/tcllib1.6.1/stooop/stooop.tcl
#namespace import stooop::*
#source sinfo.tcl
#source sycamore.tcl
#Publish sinfo Spy
#==================== install Hipadaba
proc hdbReadOnly {} {
error "Parameter is READ ONLY"
}
#------------------------------------
proc maketwotheta {} {
set txt [TwoThetaD]
set l [split $txt =]
set start [string trim [lindex $l 1]]
for {set i 0} {$i < 400} {incr i } {
append result [expr $start + $i * .2] " "
}
return $result
}
#-------------------------------------
InstallHdb
MakeStateMon
MakeHdbQueue hdbqueue HdbQueue
hmake /instrument spy none
hsetprop /instrument type instrument
#-------- experiment
hmake /instrument/experiment spy none
hattach /instrument/experiment title title
hattach /instrument/experiment starttime starttime
hattach /instrument/experiment user user
hattach /instrument/experiment/user adress address
hattach /instrument/experiment/user phone phone
hattach /instrument/experiment/user email email
hattach /instrument/experiment comment1 comment1
hattach /instrument/experiment comment2 comment2
hattach /instrument/experiment comment3 comment3
#------- SINQ
hmake /instrument/sinq spy none
hmake /instrument/sinq/proton_monitor internal int
hattach /instrument/sinq/proton_monitor counter 4
#-------- monochromator
hmake /instrument/monochromator spy none
hattach /instrument/monochromator lambda wavelength
hsetprop /instrument/monochromator/wavelength priv user
hattach /instrument/monochromator OmegaM theta
hattach /instrument/monochromator TwoThetaM two_theta
hchain /instrument/monochromator/wavelength /instrument/monochromator/two_theta
hattach /instrument/monochromator MonoX x_translation
hattach /instrument/monochromator MonoY y_translation
hattach /instrument/monochromator MonoChi chi
hattach /instrument/monochromator MonoPhi phi
hattach /instrument/monochromator CurveM vertical_focusing
hmakescript /instrument/monochromator/d_value "mono dd" "mono dd" float
hsetprop /instrument/monochromator/d_value priv manager
hmakescript /instrument/monochromator/scattering_sense "mono ss" "mono ss" int
hsetprop /instrument/monochromator/scattering_sense priv manager
#----------- sample
hmake /instrument/sample spy none
hmakescript /instrument/sample/name sample sample Text
hattach /instrument/sample Table rotation
hmake /instrument/sample/monitor internal int
hattach /instrument/sample/monitor counter 1
hsetprop /instrument/sample/monitor priv internal
hsetprop /instrument/sample/monitor sicsdev histogrammemory
#---------- detector
hmake /instrument/detector spy none
hattach /instrument/detector TwoThetaD two_theta
hmakescript /instrument/detector/preset "banana preset" hdbReadOnly float
hsetprop /instrument/detector/preset priv internal
hmakescript /instrument/detector/countmode "banana countmode" hdbReadOnly text
hsetprop /instrument/detector/countmode priv internal
sicspoll add /instrument/detector/preset hdb 30
sicspoll add /instrument/detector/countmode hdb 30
hmake /instrument/detector/count_time internal float
hattach /instrument/detector/count_time counter -1
#------------ commands
hmake /instrument/commands spy none
hcommand /instrument/commands/count count
hsetprop /instrument/commands/count type command
hsetprop /instrument/commands/count priv user
hmake /instrument/commands/count/mode user text
hsetprop /instrument/commands/count/mode values "monitor,timer"
hmake /instrument/commands/count/preset user float
hset /instrument/commands/count/preset 60000
hset /instrument/commands/count/mode monitor
hcommand /instrument/commands/killfile killfile
hsetprop /instrument/commands/killfile type command
hsetprop /instrument/commands/killfile priv manager
#------------- scan command
hcommand /instrument/commands/scan hdbscan
hsetprop /instrument/commands/scan type command
hsetprop /instrument/commands/scan priv user
hsetprop /instrument/commands/scan viewer mountaingumui.ScanEditor
hmake /instrument/commands/scan/scan_variables user text
hsetprop /instrument/commands/scan/scan_variables argtype drivable
hmake /instrument/commands/scan/scan_start user text
hmake /instrument/commands/scan/scan_increments user text
hmake /instrument/commands/scan/NP user int
hmake /instrument/commands/scan/mode user text
hsetprop /instrument/commands/scan/mode values "timer,monitor"
hmake /instrument/commands/scan/preset user float
hset /instrument/commands/scan/mode timer
hset /instrument/commands/scan/scan_start 2.
hset /instrument/commands/scan/scan_increments .3
hset /instrument/commands/scan/NP 25
hset /instrument/commands/scan/preset 2
hcommand /instrument/commands/wait wait
hsetprop /instrument/commands/wait type command
hsetprop /instrument/commands/wait priv user
hmake /instrument/commands/wait/time user int
#---------------- graphics
hmake /graphics spy none
hmake /graphics/powder_diagram spy none
hattach /graphics/powder_diagram title title
hsetprop /graphics/powder_diagram type graphdata
hsetprop /graphics/powder_diagram viewer default
hmake /graphics/powder_diagram/rank internal int
hset /graphics/powder_diagram/rank 1
hmake /graphics/powder_diagram/dim internal intar 1
hset /graphics/powder_diagram/dim 400
hmakescript /graphics/powder_diagram/two_theta maketwotheta hdbReadOnly floatar 400
hchain /graphics/powder_diagram/two_theta /instrument/detector/two_theta
hsetprop /graphics/powder_diagram/two_theta type axis
hsetprop /graphics/powder_diagram/two_theta transfer zip
hsetprop /graphics/powder_diagram/two_theta dim 0
hattach /graphics/powder_diagram banana counts
hsetprop /graphics/powder_diagram/counts type data
hsetprop /graphics/powder_diagram/counts transfer zip
hsetprop /graphics/powder_diagram/counts priv internal
sicspoll add /graphics/powder_diagram/counts hdb 60
hmake /graphics/scan_data spy none
hsetprop /graphics/scan_data type graphdata
hsetprop /graphics/scan_data viewer default
hmake /graphics/scan_data/rank mugger int
hset /graphics/scan_data/rank 1
hsetprop /graphics/scan_data/rank priv internal
hmakescript /graphics/scan_data/dim "xxxscan np" hdbReadOnly intar 1
hsetprop /graphics/scan_data/dim priv internal
hmakescript /graphics/scan_data/scan_variable "gethdbscanvardata 0" hdbReadOnly floatvarar 1
hsetprop /graphics/scan_data/scan_variable type axis
hsetprop /graphics/scan_data/scan_variable dim 0
hsetprop /graphics/scan_data/scan_variable transfer zip
hsetprop /graphics/scan_data/scan_variable priv internal
hmakescript /graphics/scan_data/counts "gethdbscancounts" hdbReadOnly intvarar 1
hsetprop /graphics/scan_data/counts type data
hsetprop /graphics/scan_data/counts transfer zip
hsetprop /graphics/scan_data/counts priv internal
hmake /graphics/samenv spy none
hsetprop /graphics/samenv type graphdata
hsetprop /graphics/samenv viewer mountaingumui.TimeSeries
hmake /graphics/samenv/vars user text
hset /graphics/samenv/vars tomato
hmake /graphics/samenv/rank user int
hset /graphics/samenv/rank 1
hmake /graphics/samenv/dim user intar 1
hset /graphics/samenv/dim 300
hmake /graphics/samenv/getdata user text
hsetprop /graphics/samenv/getdata type logcommand
hsetprop /graphics/samenv/getdata datacom true
hmake /graphics/samenv/getdata/starttime spy text
hmake /graphics/samenv/getdata/endtime spy text
hmake /batch spy none
hmakescript /batch/bufferlist listbatchfiles hdbReadOnly text
sicspoll add /batch/bufferlist hdb 30
hmake /batch/commandtext spy text
hsetprop /batch/commandtext viewer mountaingumui.TextEdit
hsetprop /batch/commandtext commandtext true
hmake /gui spy none
hmake /gui/status internal text
status hdbinterest /gui/status
proc makeQuickPar {name path} {
hmake /quickview/$name mugger text
hset /quickview/$name $path
}
hmake /quickview spy none
makeQuickPar title /instrument/experiment/title
makeQuickPar sample /instrument/sample/name
makeQuickPar lambda /instrument/monochromator/wavelength
makeQuickPar two-theta /instrument/detector/two_theta
makeQuickPar preset /instrument/detector/preset
makeQuickPar monitor /instrument/sample/monitor
restore

View File

@ -15,11 +15,21 @@ if { [info exists vdmcinit] == 0 } {
Publish copydmcdata User
Publish sample User
Publish wwwsics Spy
Publish wwwfilefornumber Spy
mcinstall
Publish gethm Spy
Publish hdbscan User
Publish hdbprepare User
Publish hdbcollect User
Publish mgbatch Spy
Publish loadmgbatch Spy
Publish listbatchfiles Spy
}
source $home/log.tcl
source $home/nxsupport.tcl
source $home/nxdmc.tcl
source $home/gumxml.tcl
source $home/gumibatch.tcl
#------------------------------------------------------------------------
proc SplitReply { text } {
set l [split $text =]
@ -38,12 +48,19 @@ proc washlazy {name} {
if { [string first "H K L THETA 2THETA D VALUE" $line] > 0} {
break
}
#-------- A second version to treat the messed up lazy pulverix files
# uploaded through the WWW-interface
if { [string first "H K L THETA" $line] >= 0} {
break
}
}
#------- process data lines
puts $out "// mult Q(hkl) F2 DW w"
clientput "HKL found at: $line"
while { [gets $in line] >= 0} {
set num [scan $line "%d %d %d %f %f %f %f %f %d %d %d %f %f %f %f %f %d"\
h k l th th2 d di sin h2 k2 l2 I F A B ang mul]
clientput "Line = $num, $line"
if { $num == 17} {
set q [expr (2.*3.14159265358979323846)/$d]
set f2 [expr $F * $F]
@ -155,6 +172,7 @@ proc rundmcoptsim {mode preset } {
} else {
return $msg
}
wait 5
}
#------------------------------------------------------------------------
proc copydmcdataold { } {
@ -183,8 +201,17 @@ proc copydmcdataold { } {
proc copydmcdata { } {
global home
set mcversion "McStas 1.8 - Mar. 05, 2004"
washsimfile $home/dmc.xml
mcreader open $home/dmc.xml
#---- loop till the file can be opened
for {set i 0} {$i < 20} {incr i} {
washsimfile $home/dmc.xml
set stat [catch {mcreader open $home/dmc.xml} msg]
if {$stat == 0} {
break
} else {
file copy -force $home/dmc.xml $home/brokenfile.xml
wait 1
}
}
mcreader insertmon \
"/$mcversion/DMC_diff/dmc.xml/PSD_sample/values" \
counter 1 [expr 1./350]
@ -250,6 +277,7 @@ proc count { {mode NULL } { preset NULL } } {
#------- count
banana InitVal 0
wait 1
hupdate /graphics/powder_diagram/counts
banana count
set ret [catch {Success} msg]
#------- StoreData
@ -363,7 +391,7 @@ proc wwwpar {type mot} {
}
#------------- wwwuser formats user information into a html table
proc wwwuser {} {
lappend list title sample user email phone adress
lappend list title user email phone adress
append txt "<table>"
foreach e $list {
set ret [catch {$e} msg]
@ -376,6 +404,101 @@ proc wwwuser {} {
}
return $txt
}
#------------- wwwfilefornumber returns the path to a data file for a
# number
proc wwwfilefornumber {num} {
return [makeSimForNum $num]
}
#-------------------------------------------------------------------
proc gethm {} {
banana uuget 0
}
#--------------------------------------------------------------------
proc hdbscan {scanvars scanstart scanincr np mode preset} {
xxxscan clear
xxxscan configure script
xxxscan function prepare hdbprepare
xxxscan function collect hdbcollect
set varlist [split $scanvars ,]
set startlist [split $scanstart ,]
set incrlist [split $scanincr ,]
set count 0
foreach var $varlist {
if {[string first / $var] >= 0} {
set var [string trim [SplitReply [hgetprop $var sicsdev]]]
}
xxxscan add $var [lindex $startlist $count] [lindex $incrlist $count]
incr count
}
set status [catch {xxxscan run $np $mode $preset} msg]
if {$status == 0} {
return $msg
} else {
error $msg
}
}
#------------------------------------------------------------------------------
proc hdbprepare {obj userdata } {
stdscan prepare $obj userdata
hupdate /graphics/scan_data/dim
}
#------------------------------------------------------------------------------
proc hdbcollect {obj userobj np} {
stdscan collect $obj $userobj $np
hupdate /graphics/scan_data/scan_variable
hupdate /graphics/scan_data/counts
}
#-----------------------------------------------------------------------------
proc gethdbscanvardata {no} {
set np [string trim [SplitReply [xxxscan np]]]
if {$np == 0} {
return ".0 .0 .0"
}
set status [catch {SplitReply [xxxscan getvardata $no]} txt]
if {$status == 0} {
return [join $txt]
} else {
return ".0 .0 .0"
}
}
#----------------------------------------------------------------------------
proc gethdbscancounts {} {
set np [string trim [SplitReply [xxxscan np]]]
if {$np == 0} {
return "0 0 0"
}
set status [catch {SplitReply [xxxscan getcounts]} txt]
if {$status == 0} {
return [join $txt]
} else {
return "0 0 0"
}
}
#================= helper to get the list of batch files =================
proc listbatchfiles {} {
set ext [list *.tcl *.job]
set txt [SplitReply [exe batchpath]]
set dirlist [split $txt :]
set txt [SplitReply [exe syspath]]
set dirlist [concat $dirlist [split $txt :]]
set result [list ""]
foreach dir $dirlist {
foreach e $ext {
set status [catch {glob [string trim $dir]/$e} filetxt]
if {$status == 0} {
set filelist [split $filetxt]
foreach f $filelist {
set nam [file tail $f]
if { [lsearch $result $nam] < 0} {
lappend result $nam
}
}
}
}
}
foreach bf $result {
append resulttxt $bf ,
}
return [string trim $resulttxt ,]
}
#-----------------------------------------------------------------------

View File

@ -1,3 +1,9 @@
exe batchpath tmp
exe syspath ./
#--- BEGIN (commands producing errors on last restore)
#--- END (commands producing errors on last restore)
# Motor omegam
omegam sign 1.000000
omegam SoftZero 0.000000
@ -8,17 +14,21 @@ omegam InterruptMode 0.000000
omegam precision 0.010000
omegam ignorefault 0.000000
omegam AccessCode 2.000000
omegam failafter 3.000000
omegam maxretry 3.000000
omegam movecount 10.000000
# Motor twothetam
twothetam sign 1.000000
twothetam SoftZero 0.000000
twothetam SoftLowerLim 30.000000
twothetam SoftLowerLim 35.000000
twothetam SoftUpperLim 100.000000
twothetam Fixed -1.000000
twothetam InterruptMode 0.000000
twothetam precision 0.010000
twothetam ignorefault 0.000000
twothetam AccessCode 2.000000
twothetam failafter 3.000000
twothetam maxretry 3.000000
twothetam movecount 10.000000
# Motor monox
monox sign 1.000000
@ -30,6 +40,8 @@ monox InterruptMode 0.000000
monox precision 0.010000
monox ignorefault 0.000000
monox AccessCode 2.000000
monox failafter 3.000000
monox maxretry 3.000000
monox movecount 10.000000
# Motor monoy
monoy sign 1.000000
@ -41,6 +53,8 @@ monoy InterruptMode 0.000000
monoy precision 0.010000
monoy ignorefault 0.000000
monoy AccessCode 2.000000
monoy failafter 3.000000
monoy maxretry 3.000000
monoy movecount 10.000000
# Motor curvem
curvem sign 1.000000
@ -52,6 +66,8 @@ curvem InterruptMode 0.000000
curvem precision 0.010000
curvem ignorefault 0.000000
curvem AccessCode 2.000000
curvem failafter 3.000000
curvem maxretry 3.000000
curvem movecount 10.000000
# Motor monophi
monophi sign 1.000000
@ -63,6 +79,8 @@ monophi InterruptMode 0.000000
monophi precision 0.010000
monophi ignorefault 0.000000
monophi AccessCode 2.000000
monophi failafter 3.000000
monophi maxretry 3.000000
monophi movecount 10.000000
# Motor monochi
monochi sign 1.000000
@ -74,17 +92,21 @@ monochi InterruptMode 0.000000
monochi precision 0.010000
monochi ignorefault 0.000000
monochi AccessCode 2.000000
monochi failafter 3.000000
monochi maxretry 3.000000
monochi movecount 10.000000
# Motor table
table sign 1.000000
table SoftZero 0.000000
table SoftLowerLim -180.000000
table SoftLowerLim -360.000000
table SoftUpperLim 360.000000
table Fixed -1.000000
table InterruptMode 0.000000
table precision 0.010000
table ignorefault 0.000000
table AccessCode 2.000000
table failafter 3.000000
table maxretry 3.000000
table movecount 10.000000
# Motor twothetad
twothetad sign 1.000000
@ -96,9 +118,11 @@ twothetad InterruptMode 0.000000
twothetad precision 0.010000
twothetad ignorefault 0.000000
twothetad AccessCode 2.000000
twothetad failafter 3.000000
twothetad maxretry 3.000000
twothetad movecount 10.000000
# Counter counter
counter SetPreset 60000000.000000
counter SetPreset 60000.000000
counter SetMode Monitor
banana CountMode monitor
banana preset 60000.000000
@ -112,28 +136,34 @@ a1 InterruptMode 0.000000
a1 precision 0.010000
a1 ignorefault 0.000000
a1 AccessCode 2.000000
a1 failafter 3.000000
a1 maxretry 3.000000
a1 movecount 10.000000
# Motor a2
a2 sign 1.000000
a2 SoftZero 0.000000
a2 SoftLowerLim 30.000000
a2 SoftLowerLim 35.000000
a2 SoftUpperLim 100.000000
a2 Fixed -1.000000
a2 InterruptMode 0.000000
a2 precision 0.010000
a2 ignorefault 0.000000
a2 AccessCode 2.000000
a2 failafter 3.000000
a2 maxretry 3.000000
a2 movecount 10.000000
# Motor a3
a3 sign 1.000000
a3 SoftZero 0.000000
a3 SoftLowerLim -180.000000
a3 SoftLowerLim -360.000000
a3 SoftUpperLim 360.000000
a3 Fixed -1.000000
a3 InterruptMode 0.000000
a3 precision 0.010000
a3 ignorefault 0.000000
a3 AccessCode 2.000000
a3 failafter 3.000000
a3 maxretry 3.000000
a3 movecount 10.000000
# Motor a4
a4 sign 1.000000
@ -145,6 +175,8 @@ a4 InterruptMode 0.000000
a4 precision 0.010000
a4 ignorefault 0.000000
a4 AccessCode 2.000000
a4 failafter 3.000000
a4 maxretry 3.000000
a4 movecount 10.000000
# Motor a5
a5 sign 1.000000
@ -156,6 +188,8 @@ a5 InterruptMode 0.000000
a5 precision 0.010000
a5 ignorefault 0.000000
a5 AccessCode 2.000000
a5 failafter 3.000000
a5 maxretry 3.000000
a5 movecount 10.000000
# Motor a6
a6 sign 1.000000
@ -167,6 +201,8 @@ a6 InterruptMode 0.000000
a6 precision 0.010000
a6 ignorefault 0.000000
a6 AccessCode 2.000000
a6 failafter 3.000000
a6 maxretry 3.000000
a6 movecount 10.000000
# Motor a7
a7 sign 1.000000
@ -178,6 +214,8 @@ a7 InterruptMode 0.000000
a7 precision 0.010000
a7 ignorefault 0.000000
a7 AccessCode 2.000000
a7 failafter 3.000000
a7 maxretry 3.000000
a7 movecount 10.000000
# Motor a8
a8 sign 1.000000
@ -189,6 +227,8 @@ a8 InterruptMode 0.000000
a8 precision 0.010000
a8 ignorefault 0.000000
a8 AccessCode 2.000000
a8 failafter 3.000000
a8 maxretry 3.000000
a8 movecount 10.000000
# Motor a9
a9 sign 1.000000
@ -200,10 +240,12 @@ a9 InterruptMode 0.000000
a9 precision 0.010000
a9 ignorefault 0.000000
a9 AccessCode 2.000000
a9 failafter 3.000000
a9 maxretry 3.000000
a9 movecount 10.000000
title D3C
title Lieselotte Nass
title setAccess 2
user UNKNOWN
user Lukas
user setAccess 2
collimation UNKNOWN
collimation setAccess 2
@ -215,17 +257,25 @@ comment2 UNKNOWN
comment2 setAccess 2
comment3 UNKNOWN
comment3 setAccess 2
starttime 2006-03-10 15:33:04
starttime 2008-03-18 13:09:23
starttime setAccess 2
adress UNKNOWN
adress 2223 Luketown, 33 Luke Drive
adress setAccess 2
phone UNKNOWN
phone setAccess 2
fax UNKNOWN
fax setAccess 2
email UNKNOWN
email Luke@luke.ch
email setAccess 2
sample_mur 0.000000
sample_mur setAccess 2
exe batchpath ./
exe syspath ./
lastdatafile /afs/psi.ch/user/k/koennecke/src/workspace/sics/mcstas/dmc/000/vdmc2008n000230.xml
lastdatafile setAccess 2
lastscancommand unknown scan
lastscancommand setAccess 2
# Counter lieselotte
lieselotte SetPreset 2.000000
lieselotte SetMode Timer
# Counter scancter
scancter SetPreset 2.000000
scancter SetMode Timer