write scan step to file r1391 | ffr | 2007-01-10 09:26:44 +1100 (Wed, 10 Jan 2007) | 3 lines
126 lines
3.9 KiB
Tcl
126 lines
3.9 KiB
Tcl
MakeNXScript
|
|
#nxscript createxml junk4.xml echidna.dic
|
|
proc getVal {msg} {
|
|
return [string trim [lindex [split $msg =] 1 ] ]
|
|
}
|
|
|
|
proc nxreopenfile {} {
|
|
global dataFileName nxFileOpen;
|
|
nxscript reopen $dataFileName echidna.dic;
|
|
set nxFileOpen true;
|
|
}
|
|
|
|
proc nxclosefile {} {
|
|
global dataFileName nxFileOpen;
|
|
if {$nxFileOpen == true} {
|
|
nxscript close;
|
|
set nxFileOpen false;
|
|
set flist [split $dataFileName "/"];
|
|
set fname [lindex $flist [expr [llength $flist] - 1] ];
|
|
clientput "$fname updated" "event";
|
|
}
|
|
}
|
|
|
|
set dradius 1.25
|
|
set ndect 128
|
|
set tubedia 0.0254
|
|
set pi 3.1415926
|
|
#set angsep [expr $tubedia/$dradius *(180/$pi)]
|
|
set angsep 1.25
|
|
# stthmin = (180 - (1.25*127))/2
|
|
proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep} {
|
|
global dradius ndect angsep;
|
|
putcommon $nxobj $entryname $scanVariable
|
|
putcrystal $nxobj
|
|
putmonitor $nxobj
|
|
putsample $nxobj
|
|
set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]]
|
|
$nxobj putfloat $scanVariable $scanVar_value
|
|
# Add thetamin and stth to tharr(i)
|
|
set sampletwotheta [string trim [lindex [split [stth] =] 1]]
|
|
for {set i 0} {$i < $ndect} {incr i} {
|
|
set tharr($i) [expr ($i-63.5)*$angsep + $sampletwotheta]
|
|
}
|
|
$nxobj updatedictvar thetadim $ndect
|
|
$nxobj putarray dtheta tharr $ndect
|
|
$nxobj puttext dtype He-3 position sensitive detector, tube active length=335+/-5mm, tube diameter=25.4 +/- 0.8mm
|
|
$nxobj puttext ddesc 128 He-3 proportional counter detector tubes (GE Energy Reuter Stokes Inc. item=RS-P4-0814-217)
|
|
$nxobj putfloat dradius $dradius
|
|
$nxobj puttext dlayout area
|
|
$nxobj puthm dcounts hmm
|
|
$nxobj puthm deff hmm
|
|
$nxobj makelink scandata dcounts
|
|
$nxobj makelink scandata dtheta
|
|
$nxobj makelink scanvar $scanVariable
|
|
$nxobj putfloat scanstep $scanVarStep
|
|
|
|
}
|
|
|
|
proc bm_addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep} {
|
|
global dradius ndect angsep;
|
|
putcommon $nxobj $entryname $scanVariable
|
|
putcrystal $nxobj
|
|
putmonitor $nxobj
|
|
putsample $nxobj
|
|
set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]]
|
|
$nxobj putfloat $scanVariable $scanVar_value
|
|
# Add thetamin and stth to tharr(i)
|
|
# $nxobj puttext dtype He-3 position sensitive detector, tube active length=335+/-5mm, tube diameter=25.4 +/- 0.8mm
|
|
# $nxobj puttext ddesc 128 He-3 proportional counter detector tubes (GE Energy Reuter Stokes Inc. item=RS-P4-0814-217)
|
|
# $nxobj putfloat dradius $dradius
|
|
$nxobj puttext dlayout point
|
|
$nxobj makelink scandata mdata
|
|
$nxobj makelink scanvar $scanVariable
|
|
$nxobj putfloat scanstep $scanVarStep
|
|
|
|
}
|
|
|
|
proc putmonitor {nxobj} {
|
|
$nxobj puttext mmode [string trim [lindex [split [bm getmode] =] 1]]
|
|
$nxobj putfloat mpreset [string trim [lindex [split [bm getpreset] =] 1]]
|
|
$nxobj putint mdata [string trim [lindex [split [bm getcounts] =] 1]]
|
|
$nxobj putfloat mdistance [getVal [sics_bm_distance]]
|
|
}
|
|
|
|
proc putsample {nxobj} {
|
|
$nxobj puttext saname [getVal [Sample]]
|
|
}
|
|
proc putcrystal {nxobj} {
|
|
$nxobj puttext ctype [sics_mono_crystal]
|
|
}
|
|
proc putcommon {nxobj entryName scanVariable} {
|
|
$nxobj updatedictvar entryName $entryName
|
|
$nxobj updatedictvar scan_variable $scanVariable
|
|
$nxobj puttext etitle [getVal [Title]]
|
|
$nxobj puttext iname [getVal [Instrument]]
|
|
|
|
# NXsource
|
|
$nxobj puttext sname OPAL
|
|
$nxobj puttext stype Reactor Neutron Source
|
|
$nxobj puttext sprobe Neutron
|
|
putsamplemotors $nxobj
|
|
putslitmotors $nxobj
|
|
putmonomotors $nxobj
|
|
}
|
|
|
|
proc putsamplemotors {nxobj} {
|
|
foreach motor { som schi sphi sx sy stth sth } {
|
|
$nxobj putfloat $motor [getVal [$motor] ];
|
|
}
|
|
}
|
|
|
|
proc putmonomotors {nxobj} {
|
|
foreach motor { mom mchi mphi mx my mtth mth } {
|
|
$nxobj putfloat $motor [getVal [$motor] ];
|
|
}
|
|
}
|
|
|
|
proc putslitmotors {nxobj} {
|
|
foreach motor {ss1u ss1d ss1l ss1r ss1vg ss1vo ss1hg ss1ho ss2u ss2d ss2l ss2r ss2vg ss2vo ss2hg ss2ho } {
|
|
$nxobj putfloat $motor [getVal [$motor] ];
|
|
}
|
|
}
|
|
publish addnxentry user
|
|
publish bm_addnxentry user
|
|
|