Structural mods to nexus.dic following Mark Koenneckes review.
Added support to write 2D polar angle array. r1540 | ffr | 2007-02-22 16:11:55 +1100 (Thu, 22 Feb 2007) | 3 lines
This commit is contained in:
committed by
Douglas Clowes
parent
d2450cde32
commit
b9da38d603
@@ -12,7 +12,8 @@ dataName=histogram
|
||||
inst=instrument
|
||||
detector=detector
|
||||
monochromator=monochromator
|
||||
thetadim=128
|
||||
padim0=512
|
||||
padim1=128
|
||||
scan_variable=scanvar
|
||||
samplemotor=samplemotor
|
||||
#---------- NXentry level
|
||||
@@ -35,14 +36,11 @@ sname=/$(entryName),NXentry/$(inst),NXinstrument/source,NXsource/SDS name \
|
||||
-type NX_CHAR -rank 1
|
||||
stype=/$(entryName),NXentry/$(inst),NXinstrument/source,NXsource/SDS type -type NX_CHAR -rank 1
|
||||
sprobe=/$(entryName),NXentry/$(inst),NXinstrument/source,NXsource/SDS probe -type NX_CHAR -rank 1
|
||||
#----------------- NXcrystal
|
||||
clambda=/$(entryName),NXentry/$(inst),NXinstrument/monochromator_crystal,NXcrystal/SDS wavelength -type NX_FLOAT32 -attr {units,Angstrom}
|
||||
ctype=/$(entryName),NXentry/$(inst),NXinstrument/monochromator_crystal,NXcrystal/SDS type -type NX_CHAR
|
||||
#------------- counter
|
||||
#-------------- Detector
|
||||
# histogram data
|
||||
dradius=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS distance -type NX_FLOAT32
|
||||
dtheta=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS polar_angle -type NX_FLOAT32 -LZW -rank 1 -dim {$(thetadim)} -attr {units,degree}
|
||||
dtheta=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS polar_angle -type NX_FLOAT32 -LZW -rank 2 -dim {$(padim0),$(padim1)} -attr {units,radians}
|
||||
|
||||
dcounts=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS \
|
||||
data -type NX_INT32 -LZW -rank 2 -dim {$(dim0),$(dim1)} \
|
||||
@@ -55,41 +53,44 @@ ddesc=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS des
|
||||
dtype=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS type -type NX_CHAR
|
||||
|
||||
dlayout=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS layout -type NX_CHAR
|
||||
#----------------- NXcrystal
|
||||
clambda=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS wavelength -type NX_FLOAT32 -attr {units,Angstrom}
|
||||
ctype=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS type -type NX_CHAR
|
||||
#--------------- NXmonochromator
|
||||
mom=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/mom,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mom}
|
||||
mchi=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/mchi,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mchi}
|
||||
mphi=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/mphi,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mphi}
|
||||
mx=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/mx,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mx}
|
||||
my=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/my,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,my}
|
||||
mtth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/mtth,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mtth}
|
||||
mth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXmonochromator/mth,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mth}
|
||||
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
|
||||
saname=/$(entryName),NXentry/sample,NXsample/SDS name -type NX_CHAR
|
||||
sarot=/$(entryName),NXentry/sample,NXsample/SDS rotation_angle -type NX_FLOAT32 -attr {units,degree}
|
||||
som=/$(entryName),NXentry/sample,NXsample/som,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,som}
|
||||
schi=/$(entryName),NXentry/sample,NXsample/schi,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,schi}
|
||||
sphi=/$(entryName),NXentry/sample,NXsample/sphi,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sphi}
|
||||
sx=/$(entryName),NXentry/sample,NXsample/sx,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sx}
|
||||
sy=/$(entryName),NXentry/sample,NXsample/sy,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sy}
|
||||
stth=/$(entryName),NXentry/sample,NXsample/stth,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,stth}
|
||||
sth=/$(entryName),NXentry/sample,NXsample/sth,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sth}
|
||||
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/sample,NXsample/ss1u,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1u}
|
||||
ss1d=/$(entryName),NXentry/sample,NXsample/ss1d,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1d}
|
||||
ss1l=/$(entryName),NXentry/sample,NXsample/ss1l,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1l}
|
||||
ss1r=/$(entryName),NXentry/sample,NXsample/ss1r,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1r}
|
||||
ss1vg=/$(entryName),NXentry/sample,NXsample/ss1vg,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1vg}
|
||||
ss1vo=/$(entryName),NXentry/sample,NXsample/ss1vo,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1vo}
|
||||
ss1hg=/$(entryName),NXentry/sample,NXsample/ss1hg,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1hg}
|
||||
ss1ho=/$(entryName),NXentry/sample,NXsample/ss1ho,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss1ho}
|
||||
ss2u=/$(entryName),NXentry/sample,NXsample/ss2u,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2u}
|
||||
ss2d=/$(entryName),NXentry/sample,NXsample/ss2d,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2d}
|
||||
ss2l=/$(entryName),NXentry/sample,NXsample/ss2l,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2l}
|
||||
ss2r=/$(entryName),NXentry/sample,NXsample/ss2r,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2r}
|
||||
ss2vg=/$(entryName),NXentry/sample,NXsample/ss2vg,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2vg}
|
||||
ss2vo=/$(entryName),NXentry/sample,NXsample/ss2vo,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2vo}
|
||||
ss2hg=/$(entryName),NXentry/sample,NXsample/ss2hg,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2hg}
|
||||
ss2ho=/$(entryName),NXentry/sample,NXsample/ss2ho,NXpositioner/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,ss2ho}
|
||||
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}
|
||||
#----------------NXdata ------------------------------------------------
|
||||
scandata=/$(entryName),NXentry/scan_data,NXdata/NXVGROUP
|
||||
scanvar=/$(entryName),NXentry/scan_variable,NXdata/NXVGROUP
|
||||
|
||||
@@ -46,11 +46,30 @@ 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 polar_angle {dradius det_angle active_length zi zj det_rot y_offset dim0 dim1} {
|
||||
global tharr
|
||||
|
||||
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]
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep} {
|
||||
global dradius ndect angsep;
|
||||
set dim0 [SplitReply [hmm configure dim0]]
|
||||
set dim1 [SplitReply [hmm configure dim1]]
|
||||
putcommon $nxobj $entryname $scanVariable
|
||||
putcrystal $nxobj
|
||||
putmonitor $nxobj
|
||||
@@ -58,12 +77,13 @@ 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
|
||||
# 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
|
||||
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 $dradius
|
||||
@@ -103,6 +123,21 @@ proc putmonitor {nxobj} {
|
||||
$nxobj putfloat mdistance [getVal [sics_bm_distance]]
|
||||
}
|
||||
|
||||
proc putpolar_angle {nxobj dim0 dim1} {
|
||||
global tharr
|
||||
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 putgenarray dtheta tharr [expr $dim0 * $dim1]
|
||||
}
|
||||
|
||||
proc putsample {nxobj} {
|
||||
$nxobj puttext saname [getVal [Sample]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user