Create 2D polar angle grid.

r1555 | ffr | 2007-02-26 13:17:13 +1100 (Mon, 26 Feb 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-02-26 13:17:13 +11:00
committed by Douglas Clowes
parent 903c446391
commit 75711dde2a
2 changed files with 32 additions and 23 deletions

View File

@@ -39,8 +39,13 @@ sprobe=/$(entryName),NXentry/$(inst),NXinstrument/source,NXsource/SDS probe -typ
#------------- counter #------------- counter
#-------------- Detector #-------------- Detector
# histogram data # histogram data
dradius=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS distance -type NX_FLOAT32 dradius=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS distance -type NX_FLOAT32 -attr {units,mm}
dheight=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS detector_height -type NX_FLOAT32 -attr {units,mm} -attr {long_name, active height}
detangle=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS angular_coverage -type NX_FLOAT32 -attr {units,radians} -attr {long_name, range of angles covered by detector}
dtheta=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS polar_angle -type NX_FLOAT32 -LZW -rank 2 -dim {$(padim0),$(padim1)} -attr {units,radians} dtheta=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS polar_angle -type NX_FLOAT32 -LZW -rank 2 -dim {$(padim0),$(padim1)} -attr {units,radians}
dtheta=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS polar_angle -type NX_FLOAT32 -LZW -rank 2 -dim {$(padim0),$(padim1)} -attr {units,radians}
dtheta=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS polar_angle -type NX_FLOAT32 -LZW -rank 2 -dim {$(padim0),$(padim1)} -attr {units,radians}
dvaxis=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS vertical_axis -type NX_FLOAT32 -LZW -rank 1 -dim {$(padim0)} -attr {units,mm}
dcounts=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS \ dcounts=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS \
data -type NX_INT32 -LZW -rank 2 -dim {$(dim0),$(dim1)} \ data -type NX_INT32 -LZW -rank 2 -dim {$(dim0),$(dim1)} \
@@ -66,8 +71,7 @@ mtth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS m
mth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mth} mth=/$(entryName),NXentry/$(inst),NXinstrument/$(monochromator),NXcrystal/SDS mth -type NX_FLOAT32 -attr {units,degree} -attr {long_name,mth}
#--------------- NXsample #--------------- NXsample
saname=/$(entryName),NXentry/sample,NXsample/SDS name -type NX_CHAR 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/SDS rotation_angle -type NX_FLOAT32 -attr {units,degree}
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} 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} 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} sx=/$(entryName),NXentry/sample,NXsample/SDS sx -type NX_FLOAT32 -attr {units,degree} -attr {long_name,sx}

View File

@@ -48,25 +48,26 @@ set tubedia 0.0254
set pi 3.1415926 set pi 3.1415926
set angsep 1.25 set angsep 1.25
# stthmin = (180 - (1.25*127))/2 # stthmin = (180 - (1.25*127))/2
proc polar_angle {dradius det_angle active_length zi zj det_rot y_offset dim0 dim1} { proc polar_angle {dradius det_angle active_length zi zj det_rot dim0 dim1} {
global tharr global tharr det_height
set angsep [expr $det_angle / ($dim1-1)] set angsep [expr 1.0*$det_angle / ($dim1-1.0)]
set ysep [expr $active_length/($dim0-1)] set ysep [expr 1.0*$active_length/($dim0-1.0)]
set imid [expr ($dim0 -1 )/2.0] set izero [expr ($dim0 -1.0 )+$zi]
set jmid [expr ($dim1 -1 )/2.0] set jzero [expr ($dim1 -1.0 )/2.0+$zj]
for {set i 0} {$i < $dim0} {incr i} { for {set i 0} {$i < $dim0} {incr i} {
set height [expr $y_offset - ($i - $imid)*$ysep] set height [expr ($i - $izero)*$ysep]
set det_height($i) $height
for {set j 0} {$j < $dim1} {incr j} { for {set j 0} {$j < $dim1} {incr j} {
set alpha [expr $det_rot - ($j - $jmid)*$angsep] set alpha [expr $det_rot - ($j - $jzero)*$angsep]
set pang [expr acos($dradius * cos($alpha)/sqrt($dradius*$dradius + $height*$height))] 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]) $pang
} }
} }
} }
proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep} { proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} {
global dradius ndect angsep; global dradius ndect angsep;
set dim0 [SplitReply [hmm configure dim0]] set dim0 [SplitReply [hmm configure dim0]]
set dim1 [SplitReply [hmm configure dim1]] set dim1 [SplitReply [hmm configure dim1]]
@@ -76,10 +77,11 @@ putmonitor $nxobj
putsample $nxobj putsample $nxobj
set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]] set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]]
$nxobj putfloat $scanVariable $scanVar_value $nxobj putfloat $scanVariable $scanVar_value
$nxobj puttext estart $start_time
putpolar_angle $nxobj $dim0 $dim1 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 dtype He-3 position sensitive detector
$nxobj puttext ddesc 128 He-3 proportional counter detector tubes (GE Energy Reuter Stokes Inc. item=RS-P4-0814-217) $nxobj puttext ddesc 8 curved multiwire segments.
$nxobj putfloat dradius $dradius $nxobj putfloat dradius [SplitReply [detector_radius_mm]]
$nxobj puttext dlayout area $nxobj puttext dlayout area
$nxobj puthm dcounts hmm $nxobj puthm dcounts hmm
$nxobj puthm deff hmm $nxobj puthm deff hmm
@@ -90,7 +92,7 @@ putsample $nxobj
} }
proc bm_addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep} { proc bm_addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} {
global dradius ndect angsep; global dradius ndect angsep;
putcommon $nxobj $entryname $scanVariable putcommon $nxobj $entryname $scanVariable
putcrystal $nxobj putcrystal $nxobj
@@ -109,6 +111,7 @@ putsample $nxobj
# $nxobj puttext dtype He-3 position sensitive detector, tube active length=335+/-5mm, tube diameter=25.4 +/- 0.8mm # $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 puttext ddesc 128 He-3 proportional counter detector tubes (GE Energy Reuter Stokes Inc. item=RS-P4-0814-217)
# $nxobj putfloat dradius $dradius # $nxobj putfloat dradius $dradius
$nxobj puttext estart $start_time
$nxobj puttext dlayout point $nxobj puttext dlayout point
$nxobj makelink scandata mdata $nxobj makelink scandata mdata
$nxobj makelink scanvar $scanVariable $nxobj makelink scanvar $scanVariable
@@ -120,21 +123,22 @@ proc putmonitor {nxobj} {
$nxobj puttext mmode [string trim [lindex [split [bm getmode] =] 1]] $nxobj puttext mmode [string trim [lindex [split [bm getmode] =] 1]]
$nxobj putfloat mpreset [string trim [lindex [split [bm getpreset] =] 1]] $nxobj putfloat mpreset [string trim [lindex [split [bm getpreset] =] 1]]
$nxobj putint mdata [string trim [lindex [split [bm getcounts] =] 1]] $nxobj putint mdata [string trim [lindex [split [bm getcounts] =] 1]]
$nxobj putfloat mdistance [getVal [sics_bm_distance]] $nxobj putfloat mdistance [SplitReply [bmon_distance]]
} }
proc putpolar_angle {nxobj dim0 dim1} { proc putpolar_angle {nxobj dim0 dim1} {
global tharr global tharr det_height
set det_radius_mm [SplitReply [detector_radius_mm]] set det_radius_mm [SplitReply [detector_radius_mm]]
set det_angle_rad [SplitReply [detector_angle_rad]] set det_angle_rad [SplitReply [detector_angle_rad]]
set det_active_ht_mm [SplitReply [detector_active_height_mm]] set det_active_ht_mm [SplitReply [detector_active_height_mm]]
set det_rot_rad [ expr [SplitReply [stth]]/[SplitReply [deg_per_rad]] ] set det_rot_rad [ expr [SplitReply [stth]]/[SplitReply [deg_per_rad]] ]
set det_zxp [ SplitReply [detector_zero_xpixel]] set det_zxp [ SplitReply [detector_xpixel_zero_offset]]
set det_zyp [ SplitReply [detector_zero_ypixel]] set det_zyp [ SplitReply [detector_ypixel_zero_offset]]
polar_angle $det_radius_mm $det_angle_rad $det_active_ht_mm $det_zxp $det_zyp $det_rot_rad 0 $dim0 $dim1 polar_angle $det_radius_mm $det_angle_rad $det_active_ht_mm $det_zxp $det_zyp $det_rot_rad $dim0 $dim1
$nxobj updatedictvar padim0 $dim0 $nxobj updatedictvar padim0 $dim0
$nxobj updatedictvar padim1 $dim1 $nxobj updatedictvar padim1 $dim1
$nxobj putarray dvaxis det_height $dim0
$nxobj putgenarray dtheta tharr [expr $dim0 * $dim1] $nxobj putgenarray dtheta tharr [expr $dim0 * $dim1]
} }
@@ -142,10 +146,11 @@ proc putsample {nxobj} {
$nxobj puttext saname [getVal [Sample]] $nxobj puttext saname [getVal [Sample]]
} }
proc putcrystal {nxobj} { proc putcrystal {nxobj} {
$nxobj puttext ctype [sics_mono_crystal] $nxobj puttext ctype [SplitReply [crystal_type]]
$nxobj putfloat clambda [SplitReply [crystal_wavelength_A]]
} }
proc putcommon {nxobj entryName scanVariable} { proc putcommon {nxobj entryName scanVariable} {
$nxobj updatedictvar entryName $entryName $nxobj updatedictvar entryName $entryName
$nxobj updatedictvar scan_variable $scanVariable $nxobj updatedictvar scan_variable $scanVariable
$nxobj puttext etitle [getVal [Title]] $nxobj puttext etitle [getVal [Title]]
$nxobj puttext iname [getVal [Instrument]] $nxobj puttext iname [getVal [Instrument]]