diff --git a/site_ansto/instrument/hipd/config/nexus/Makefile b/site_ansto/instrument/hipd/config/nexus/Makefile new file mode 100644 index 00000000..f4962064 --- /dev/null +++ b/site_ansto/instrument/hipd/config/nexus/Makefile @@ -0,0 +1,18 @@ +BMON_COMMON=nexus_in_common_1.dic nexus_in_bmon_common_1.dic nexus_in_scan_common_1.dic +HMM_COMMON=nexus_in_common_1.dic nexus_in_hmm_common_1.dic nexus_in_bmon_common_1.dic nexus_in_scan_common_1.dic + +all: nexus_bmonscan.dic nexus_hmscan.dic + rm -f $(BMON_COMMON) $(HMM_COMMON) + +%.dic: + cp ../../../config/nexus/$@ . + +nexus_bmonscan.dic: $(BMON_COMMON) nexus_in_motors.dic + cat $^ > $@ + +nexus_hmscan.dic: $(HMM_COMMON) nexus_in_motors.dic + cat $^ > $@ + +clean: + rm nexus_bmonscan.dic nexus_hmscan.dic + diff --git a/site_ansto/instrument/hipd/config/nexus/nexus_in_motors.dic b/site_ansto/instrument/hipd/config/nexus/nexus_in_motors.dic new file mode 100644 index 00000000..a72d1493 --- /dev/null +++ b/site_ansto/instrument/hipd/config/nexus/nexus_in_motors.dic @@ -0,0 +1,33 @@ +#--------------- NXmonochromator +mom=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mom -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mom} +mchi=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mchi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mchi} +mphi=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mphi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mphi} +mx=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mx -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mx} +my=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS my -type NX_FLOAT32 -attr {units,degree} -attr {long_name,my} +mtth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mtth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mtth} +mth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mth} +#--------------- NXsample +som=/$(entryName),NXentry/sample,NXsample/SDS som -type NX_FLOAT32 -attr {units,degree} -attr {long_name,som} +schi=/$(entryName),NXentry/sample,NXsample/SDS schi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,schi} +sphi=/$(entryName),NXentry/sample,NXsample/SDS sphi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sphi} +sx=/$(entryName),NXentry/sample,NXsample/SDS sx -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sx} +sy=/$(entryName),NXentry/sample,NXsample/SDS sy -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sy} +stth=/$(entryName),NXentry/sample,NXsample/SDS stth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,stth} +sth=/$(entryName),NXentry/sample,NXsample/SDS sth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sth} +# Slit motors +ss1u=/$(entryName),NXentry/slits,NXfilter/SDS ss1u -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1u} +ss1d=/$(entryName),NXentry/slits,NXfilter/SDS ss1d -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1d} +ss1l=/$(entryName),NXentry/slits,NXfilter/SDS ss1l -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1l} +ss1r=/$(entryName),NXentry/slits,NXfilter/SDS ss1r -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1r} +ss1vg=/$(entryName),NXentry/slits,NXfilter/SDS ss1vg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1vg} +ss1vo=/$(entryName),NXentry/slits,NXfilter/SDS ss1vo -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1vo} +ss1hg=/$(entryName),NXentry/slits,NXfilter/SDS ss1hg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1hg} +ss1ho=/$(entryName),NXentry/slits,NXfilter/SDS ss1ho -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1ho} +ss2u=/$(entryName),NXentry/slits,NXfilter/SDS ss2u -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2u} +ss2d=/$(entryName),NXentry/slits,NXfilter/SDS ss2d -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2d} +ss2l=/$(entryName),NXentry/slits,NXfilter/SDS ss2l -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2l} +ss2r=/$(entryName),NXentry/slits,NXfilter/SDS ss2r -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2r} +ss2vg=/$(entryName),NXentry/slits,NXfilter/SDS ss2vg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2vg} +ss2vo=/$(entryName),NXentry/slits,NXfilter/SDS ss2vo -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2vo} +ss2hg=/$(entryName),NXentry/slits,NXfilter/SDS ss2hg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2hg} +ss2ho=/$(entryName),NXentry/slits,NXfilter/SDS ss2ho -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2ho} diff --git a/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl b/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl index 3fdf2261..1845cac3 100644 --- a/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl +++ b/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl @@ -1,191 +1 @@ -MakeNXScript - -proc getVal {msg} { - return [string trim [lindex [split $msg =] 1 ] ] -} - -proc newFileName {} { - sicsdatanumber incr; - set idNum [SplitReply [sicsdatanumber]]; - set dataPath [SplitReply [sicsdatapath]]; - set prefix [SplitReply [sicsdataprefix]]; - set postfix [SplitReply [sicsdatapostfix]]; - set date_time_arr [split [sicstime] " "] - set isodate [lindex $date_time_arr 0]; - set isotime [string map {: -} [lindex $date_time_arr 1]]; - return [format "%s/%s_%sT%s_%05d%s" $dataPath $prefix $isodate $isotime $idNum $postfix]; -} - -proc nxcreatefile {{type nx.hdf}} { - global dataFileName nxFileOpen cfPath; - SicsDataPostFix .$type; - - array set nxmode [list nx.hdf create5 h5 create5 nx5 create5 xml createxml]; - set dataFileName [newFileName] - nxscript $nxmode($type) $dataFileName $cfPath(nexus)/nexus.dic; - nxscript updatedictvar entryName sics_release - nxscript puttext sics_release [SplitReply [sics_release]] - set nxFileOpen true -} - - -proc nxreopenfile {} { - global dataFileName nxFileOpen cfPath; - nxscript reopen $dataFileName $cfPath(nexus)/nexus.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 1.25 -# stthmin = (180 - (1.25*127))/2 -proc polar_angle {dradius det_angle active_length zi zj det_rot y_offset dim0 dim1} { - global tharr det_height - - set angsep [expr $det_angle / ($dim1-1)] - set ysep [expr $active_length/($dim0-1)] - set imid [expr ($dim0 -1 )/2.0] - set jmid [expr ($dim1 -1 )/2.0] - - for {set i 0} {$i < $dim0} {incr i} { - set height [expr $y_offset - ($i - $imid)*$ysep] - set det_height($i) $height - for {set j 0} {$j < $dim1} {incr j} { -# set alpha [expr $det_rot - ($j - $jmid)*$angsep] -# set pang [expr acos($dradius * cos($alpha)/sqrt($dradius*$dradius + $height*$height))] -# set tharr([expr $i*$dim1+$j]) $pang - set tharr([expr $i*$dim1+$j]) 0 - } - } -} - -proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} { - global dradius ndect angsep; - set dim0 [SplitReply [hmm configure dim0]] - set dim1 [SplitReply [hmm configure dim1]] -putcommon $nxobj $entryname $scanVariable -putcrystal $nxobj -putmonitor $nxobj -putsample $nxobj - set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]] - $nxobj putfloat $scanVariable $scanVar_value - $nxobj putfloat detangle_degrees [SplitReply [detector_angle_deg]] - $nxobj puttext estart $start_time - putpolar_angle $nxobj $dim0 $dim1 - $nxobj puttext dtype He-3 position sensitive detector - $nxobj puttext ddesc 8 curved multiwire segments. - $nxobj putfloat dradius [SplitReply [detector_radius_mm]] - $nxobj puttext dlayout area - $nxobj puthm dcounts hmm - $nxobj puthm deff hmm - $nxobj makelink scandata dcounts - $nxobj makelink scanvertaxis dvaxis - $nxobj makelink scandata dtheta - $nxobj makelink scanvar $scanVariable - $nxobj putfloat scanstep $scanVarStep - $nxobj puttext eend [sicstime]; -} - -proc bm_addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} { - 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 estart $start_time - $nxobj puttext dlayout point - $nxobj makelink scandata mdata - $nxobj makelink scanvar $scanVariable - $nxobj putfloat scanstep $scanVarStep - $nxobj puttext eend [sicstime]; -} - -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 [SplitReply [bmon_distance]] -} - -proc putpolar_angle {nxobj dim0 dim1} { - global tharr det_height - set det_radius_mm [SplitReply [detector_radius_mm]] - set det_angle_rad [SplitReply [detector_angle_rad]] - set det_active_ht_mm [SplitReply [detector_active_height_mm]] - set det_rot_rad [ expr [SplitReply [stth]]/[SplitReply [deg_per_rad]] ] - set det_zxp [ SplitReply [detector_zero_xpixel]] - set det_zyp [ SplitReply [detector_zero_ypixel]] - - polar_angle $det_radius_mm $det_angle_rad $det_active_ht_mm $det_zxp $det_zyp $det_rot_rad 0 $dim0 $dim1 - $nxobj updatedictvar padim0 $dim0 - $nxobj updatedictvar padim1 $dim1 - $nxobj putarray dvaxis det_height $dim0 - $nxobj putgenarray dtheta tharr [expr $dim0 * $dim1] -} - -proc putsample {nxobj} { - $nxobj puttext saname [getVal [Sample]] -} -proc putcrystal {nxobj} { - $nxobj puttext ctype [SplitReply [crystal_type]] - $nxobj putfloat clambda [SplitReply [crystal_wavelength_A]] -} -proc putcommon {nxobj entryName scanVariable} { - $nxobj updatedictvar entryName $entryName - $nxobj updatedictvar scan_variable $scanVariable - $nxobj puttext etitle [getVal [Title]] - $nxobj puttext iname [getVal [Instrument]] - $nxobj puttext username [SplitReply [user]] - $nxobj puttext useremail [SplitReply [email]] - $nxobj puttext userphone [SplitReply [phone]] - -# 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 nxcreatefile user -publish addnxentry user -publish bm_addnxentry user - +source $cfPath(nexus)/nxscripts_common_1.tcl diff --git a/site_ansto/instrument/hrpd/config/nexus/Makefile b/site_ansto/instrument/hrpd/config/nexus/Makefile new file mode 100644 index 00000000..f4962064 --- /dev/null +++ b/site_ansto/instrument/hrpd/config/nexus/Makefile @@ -0,0 +1,18 @@ +BMON_COMMON=nexus_in_common_1.dic nexus_in_bmon_common_1.dic nexus_in_scan_common_1.dic +HMM_COMMON=nexus_in_common_1.dic nexus_in_hmm_common_1.dic nexus_in_bmon_common_1.dic nexus_in_scan_common_1.dic + +all: nexus_bmonscan.dic nexus_hmscan.dic + rm -f $(BMON_COMMON) $(HMM_COMMON) + +%.dic: + cp ../../../config/nexus/$@ . + +nexus_bmonscan.dic: $(BMON_COMMON) nexus_in_motors.dic + cat $^ > $@ + +nexus_hmscan.dic: $(HMM_COMMON) nexus_in_motors.dic + cat $^ > $@ + +clean: + rm nexus_bmonscan.dic nexus_hmscan.dic + diff --git a/site_ansto/instrument/hrpd/config/nexus/nexus_in_motors.dic b/site_ansto/instrument/hrpd/config/nexus/nexus_in_motors.dic new file mode 100644 index 00000000..3fe2f24c --- /dev/null +++ b/site_ansto/instrument/hrpd/config/nexus/nexus_in_motors.dic @@ -0,0 +1,37 @@ + +#--------------- NXmonochromator +mom=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mom -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mom} +mchi=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mchi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mchi} +mphi=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mphi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mphi} +mx=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mx -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mx} +my=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS my -type NX_FLOAT32 -attr {units,degree} -attr {long_name,my} +mtth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mtth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mtth} +mth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mth} +pcr=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS pcr -type NX_FLOAT32 -attr {units,degree} -attr {long_name,primary_collimator_rotation} +pcx=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS pcx -type NX_FLOAT32 -attr {units,mm} -attr {long_name,primary_collimator_translation} + +#--------------- NXsample +som=/$(entryName),NXentry/sample,NXsample/SDS som -type NX_FLOAT32 -attr {units,degree} -attr {long_name,som} +schi=/$(entryName),NXentry/sample,NXsample/SDS schi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,schi} +sphi=/$(entryName),NXentry/sample,NXsample/SDS sphi -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sphi} +sx=/$(entryName),NXentry/sample,NXsample/SDS sx -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sx} +sy=/$(entryName),NXentry/sample,NXsample/SDS sy -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sy} +stth=/$(entryName),NXentry/sample,NXsample/SDS stth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,stth} +sth=/$(entryName),NXentry/sample,NXsample/SDS sth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sth} +# Slit motors +ss1u=/$(entryName),NXentry/slits,NXfilter/SDS ss1u -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1u} +ss1d=/$(entryName),NXentry/slits,NXfilter/SDS ss1d -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1d} +ss1l=/$(entryName),NXentry/slits,NXfilter/SDS ss1l -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1l} +ss1r=/$(entryName),NXentry/slits,NXfilter/SDS ss1r -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1r} +ss1vg=/$(entryName),NXentry/slits,NXfilter/SDS ss1vg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1vg} +ss1vo=/$(entryName),NXentry/slits,NXfilter/SDS ss1vo -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1vo} +ss1hg=/$(entryName),NXentry/slits,NXfilter/SDS ss1hg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1hg} +ss1ho=/$(entryName),NXentry/slits,NXfilter/SDS ss1ho -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1ho} +ss2u=/$(entryName),NXentry/slits,NXfilter/SDS ss2u -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2u} +ss2d=/$(entryName),NXentry/slits,NXfilter/SDS ss2d -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2d} +ss2l=/$(entryName),NXentry/slits,NXfilter/SDS ss2l -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2l} +ss2r=/$(entryName),NXentry/slits,NXfilter/SDS ss2r -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2r} +ss2vg=/$(entryName),NXentry/slits,NXfilter/SDS ss2vg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2vg} +ss2vo=/$(entryName),NXentry/slits,NXfilter/SDS ss2vo -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2vo} +ss2hg=/$(entryName),NXentry/slits,NXfilter/SDS ss2hg -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2hg} +ss2ho=/$(entryName),NXentry/slits,NXfilter/SDS ss2ho -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2ho} diff --git a/site_ansto/instrument/hrpd/config/nexus/nxscripts.tcl b/site_ansto/instrument/hrpd/config/nexus/nxscripts.tcl index 45c58f8a..1845cac3 100644 --- a/site_ansto/instrument/hrpd/config/nexus/nxscripts.tcl +++ b/site_ansto/instrument/hrpd/config/nexus/nxscripts.tcl @@ -1,191 +1 @@ -MakeNXScript - -proc getVal {msg} { - return [string trim [lindex [split $msg =] 1 ] ] -} - -proc newFileName {} { - sicsdatanumber incr; - set idNum [SplitReply [sicsdatanumber]]; - set dataPath [SplitReply [sicsdatapath]]; - set prefix [SplitReply [sicsdataprefix]]; - set postfix [SplitReply [sicsdatapostfix]]; - set date_time_arr [split [sicstime] " "] - set isodate [lindex $date_time_arr 0]; - set isotime [string map {: -} [lindex $date_time_arr 1]]; - return [format "%s/%s_%sT%s_%05d%s" $dataPath $prefix $isodate $isotime $idNum $postfix]; -} - -proc nxcreatefile {{type nx.hdf}} { - global dataFileName nxFileOpen cfPath; - SicsDataPostFix .$type; - - array set nxmode [list nx.hdf create5 h5 create5 nx5 create5 xml createxml]; - set dataFileName [newFileName] - nxscript $nxmode($type) $dataFileName $cfPath(nexus)/nexus.dic; - nxscript updatedictvar entryName sics_release - nxscript puttext sics_release [SplitReply [sics_release]] - set nxFileOpen true -} - - -proc nxreopenfile {} { - global dataFileName nxFileOpen cfPath; - nxscript reopen $dataFileName $cfPath(nexus)/nexus.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 1.25 -# stthmin = (180 - (1.25*127))/2 -proc polar_angle {dradius det_angle active_length zi zj det_rot y_offset dim0 dim1} { - global tharr det_height - - set angsep [expr $det_angle / ($dim1-1)] - set ysep [expr $active_length/($dim0-1)] - set imid [expr ($dim0 -1 )/2.0] - set jmid [expr ($dim1 -1 )/2.0] - - for {set i 0} {$i < $dim0} {incr i} { - set height [expr $y_offset - ($i - $imid)*$ysep] - set det_height($i) $height - for {set j 0} {$j < $dim1} {incr j} { -# set alpha [expr $det_rot - ($j - $jmid)*$angsep] -# set pang [expr acos($dradius * cos($alpha)/sqrt($dradius*$dradius + $height*$height))] -# set tharr([expr $i*$dim1+$j]) $pang - set tharr([expr $i*$dim1+$j]) 0 - } - } -} - -proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} { - global dradius ndect angsep; - set dim0 [SplitReply [hmm configure dim0]] - set dim1 [SplitReply [hmm configure dim1]] -putcommon $nxobj $entryname $scanVariable -putcrystal $nxobj -putmonitor $nxobj -putsample $nxobj - set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]] - $nxobj putfloat $scanVariable $scanVar_value - $nxobj putfloat detangle_degrees [SplitReply [detector_angle_deg]] - $nxobj puttext estart $start_time - putpolar_angle $nxobj $dim0 $dim1 - $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 [SplitReply [detector_radius_mm]] - $nxobj puttext dlayout area - $nxobj puthm dcounts hmm - $nxobj puthm deff hmm - $nxobj makelink scandata dcounts - $nxobj makelink scanvertaxis dvaxis - $nxobj makelink scandata dtheta - $nxobj makelink scanvar $scanVariable - $nxobj putfloat scanstep $scanVarStep - $nxobj puttext eend [sicstime]; -} - -proc bm_addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} { - 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 estart $start_time - $nxobj puttext dlayout point - $nxobj makelink scandata mdata - $nxobj makelink scanvar $scanVariable - $nxobj putfloat scanstep $scanVarStep - $nxobj puttext eend [sicstime]; -} - -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 [SplitReply [bmon_distance]] -} - -proc putpolar_angle {nxobj dim0 dim1} { - global tharr det_height - set det_radius_mm [SplitReply [detector_radius_mm]] - set det_angle_rad [SplitReply [detector_angle_rad]] - set det_active_ht_mm [SplitReply [detector_active_height_mm]] - set det_rot_rad [ expr [SplitReply [stth]]/[SplitReply [deg_per_rad]] ] - set det_zxp [ SplitReply [detector_zero_xpixel]] - set det_zyp [ SplitReply [detector_zero_ypixel]] - - polar_angle $det_radius_mm $det_angle_rad $det_active_ht_mm $det_zxp $det_zyp $det_rot_rad 0 $dim0 $dim1 - $nxobj updatedictvar padim0 $dim0 - $nxobj updatedictvar padim1 $dim1 - $nxobj putarray dvaxis det_height $dim0 - $nxobj putgenarray dtheta tharr [expr $dim0 * $dim1] -} - -proc putsample {nxobj} { - $nxobj puttext saname [getVal [Sample]] -} -proc putcrystal {nxobj} { - $nxobj puttext ctype [SplitReply [crystal_type]] - $nxobj putfloat clambda [SplitReply [crystal_wavelength_A]] -} -proc putcommon {nxobj entryName scanVariable} { - $nxobj updatedictvar entryName $entryName - $nxobj updatedictvar scan_variable $scanVariable - $nxobj puttext etitle [getVal [Title]] - $nxobj puttext iname [getVal [Instrument]] - $nxobj puttext username [SplitReply [user]] - $nxobj puttext useremail [SplitReply [email]] - $nxobj puttext userphone [SplitReply [phone]] - -# 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 pcr pcx} { - $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 nxcreatefile user -publish addnxentry user -publish bm_addnxentry user - +source $cfPath(nexus)/nxscripts_common_1.tcl