From 2d7cf89385a3cea807426f9f675eb4b2bdad902c Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Sun, 1 Apr 2007 14:36:09 +1000 Subject: [PATCH] Set x and y pixel offsets and run number. The run number is used as the first dimension axis for simple count and save operations. r1770 | ffr | 2007-04-01 14:36:09 +1000 (Sun, 01 Apr 2007) | 4 lines --- .../config/hmm/hmm_configuration_common_1.tcl | 8 ++- .../config/nexus/nexus_in_common_1.dic | 3 +- .../config/nexus/nexus_in_hmm_common_1.dic | 4 +- .../config/nexus/nexus_in_scan_common_1.dic | 3 +- .../config/nexus/nxscripts_common_1.tcl | 57 ++++++++++++++----- 5 files changed, 55 insertions(+), 20 deletions(-) diff --git a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl index f273ffcd..01d0d005 100644 --- a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl +++ b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.6 $ -# $Date: 2007-03-31 01:27:52 $ +# $Revision: 1.7 $ +# $Date: 2007-04-01 04:36:09 $ # Author: Mark Lesha (mle@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -405,6 +405,10 @@ proc count_withbm {mode preset} { proc save {} { nxcreatefile nexus_hmscan.dic; hmm_save nxscript entry1 0; + $nxobj makelink scanvar erun; + $nxobj putattribute erun axis 1; + $nxobj putattribute hmcounts signal 1; + $nxobj putattribute hmcounts axes run_number:x_pixel_offset:y_pixel_offset; nxclosefile; } } diff --git a/site_ansto/instrument/config/nexus/nexus_in_common_1.dic b/site_ansto/instrument/config/nexus/nexus_in_common_1.dic index 22a5f293..a624ebd3 100644 --- a/site_ansto/instrument/config/nexus/nexus_in_common_1.dic +++ b/site_ansto/instrument/config/nexus/nexus_in_common_1.dic @@ -18,8 +18,9 @@ etitle=/$(entryName),NXentry/SDS title -type NX_CHAR sics_release=/version,NXentry/SDS sics_release_tag -type NX_CHAR sics_revision=/version,NXentry/SDS sics_revision_num -type NX_CHAR nx_content_release=/version,NXentry/SDS nx_content_release_tag -type NX_CHAR -attr {schema_release,$Name: not supported by cvs2svn $} -nx_content_revision=/version,NXentry/SDS nx_content_revision_num -type NX_CHAR -attr {schema_revision,$Revision: 1.8 $} +nx_content_revision=/version,NXentry/SDS nx_content_revision_num -type NX_CHAR -attr {schema_revision,$Revision: 1.9 $} +erun=/$(entryName),NXentry/SDS run_number -type NX_INT32 -rank1 -dim {-1} estart=/$(entryName),NXentry/SDS start_time -type NX_CHAR eend=/$(entryName),NXentry/SDS end_time -type NX_CHAR diff --git a/site_ansto/instrument/config/nexus/nexus_in_hmm_common_1.dic b/site_ansto/instrument/config/nexus/nexus_in_hmm_common_1.dic index 184ca2fd..64fa341b 100644 --- a/site_ansto/instrument/config/nexus/nexus_in_hmm_common_1.dic +++ b/site_ansto/instrument/config/nexus/nexus_in_hmm_common_1.dic @@ -7,8 +7,8 @@ dheight=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS de detangle_rad=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS angular_coverage -type NX_FLOAT32 -attr {units,radians} detangle_degrees=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS angular_coverage -type NX_FLOAT32 -attr {units,degrees} 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} - +dvaxis=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS y_pixel_offset -type NX_FLOAT32 -LZW -rank 1 -dim {$(padim0)} -attr {units,mm} +dhaxis=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS x_pixel_offset -type NX_FLOAT32 -LZW -rank 1 -dim {$(padim1)} -attr {units,mm} hmcounts=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS \ data -type NX_INT32 -LZW -rank 3 -dim {-1,$(padim0),$(padim1)} diff --git a/site_ansto/instrument/config/nexus/nexus_in_scan_common_1.dic b/site_ansto/instrument/config/nexus/nexus_in_scan_common_1.dic index 6cc214b0..d3a3ec02 100644 --- a/site_ansto/instrument/config/nexus/nexus_in_scan_common_1.dic +++ b/site_ansto/instrument/config/nexus/nexus_in_scan_common_1.dic @@ -6,7 +6,8 @@ scanvar_longname=xxx #TODO replace scandata with generic name scandata=/$(entryName),NXentry/data,NXdata/NXVGROUP -scanvertaxis=/$(entryName),NXentry/vertical_axis,NXdata/NXVGROUP +scanhoraxis=/$(entryName),NXentry/data,NXdata/NXVGROUP +scanvertaxis=/$(entryName),NXentry/data,NXdata/NXVGROUP scanvar=/$(entryName),NXentry/data,NXdata/NXVGROUP scanstep=/$(entryName),NXentry/scan_step,NXdata/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,stepsize} #histogram=/$(entryName),NXentry/histogram,NXdata/NXVGROUP diff --git a/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl b/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl index 046ca6ca..42e84157 100644 --- a/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl +++ b/site_ansto/instrument/config/nexus/nxscripts_common_1.tcl @@ -7,7 +7,7 @@ set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}] set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]] -set tmpstr [string map {"$" ""} {$Revision: 1.16 $}] +set tmpstr [string map {"$" ""} {$Revision: 1.17 $}] set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]] MakeNXScript @@ -68,12 +68,12 @@ set tubedia 0.0254 set pi 3.1415926 set angsep 1.25 # stthmin = (180 - (1.25*127))/2 -proc det_height_arr {active_height_mm row_zero dim0} { +proc det_height_arr {active_height_mm row_zero dim1} { global det_height - set hsep [expr $active_height_mm/($dim0-1)] + set hsep [expr $active_height_mm/($dim1-1)] - for {set i 0} {$i < $dim0} {incr i} { + for {set i 0} {$i < $dim1} {incr i} { set height [expr ($row_zero - $i) *$hsep] set det_height($i) $height } @@ -90,8 +90,9 @@ proc hmm_save {nxobj entryname point} { putsample $nxobj; $nxobj putfloat detangle_degrees [SplitReply [detector_angle_deg]] -# putpolar_angle $nxobj $dim0 $dim1 - put_det_height_arr $nxobj $dim0 +# put1Dpolar_angle $nxobj $dim0; + put_det_haxis_arr $nxobj $dim0; + put_det_vaxis_arr $nxobj $dim1; $nxobj puttext dtype [SplitReply [detector_type]] $nxobj puttext ddesc [SplitReply [detector_description]] $nxobj putfloat dradius [SplitReply [detector_radius_mm]] @@ -102,7 +103,8 @@ proc hmm_save {nxobj entryname point} { $nxobj putslab $dictalias(hmm) [list $point 0 0] [list 1 $dim0 $dim1 ] hmm [SplitReply [hmm_start]] $histo_length [SplitReply [hmm_bank]] #TODO replace scandata with generic name $nxobj makelink scandata hmcounts - $nxobj makelink scanvertaxis dvaxis + $nxobj makelink scanhoraxis x_pixel_offset + $nxobj makelink scanvertaxis y_pixel_offset } proc hmm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarStep start_time} { @@ -112,9 +114,9 @@ proc hmm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarSt hmm_save $nxobj $entryname $point; fillPath $nxobj $scanVariable; $nxobj makelink scanvar $dictalias($scanVariable); - $nxobj putattribute scanvar axis 1; + $nxobj putattribute $dictalias($scanVariable) axis 1; $nxobj putattribute hmcounts signal 1; - $nxobj putattribute hmcounts axes $scanVariable; + $nxobj putattribute hmcounts axes $scanVariable:x_pixel_offset:y_pixel_offset; $nxobj puttext eend [sicstime]; } @@ -137,7 +139,7 @@ proc bm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarSte bm_save $nxobj $entryname $point; fillPath $nxobj $scanVariable; $nxobj makelink scanvar $dictalias($scanVariable); - $nxobj putattribute scanvar axis 1; + $nxobj putattribute $dictalias($scanVariable) axis 1; $nxobj putattribute bmcounts signal 1; $nxobj putattribute bmcounts axes $scanVariable; #TODO add dtype ddesc @@ -154,16 +156,40 @@ proc putmonitor {nxobj point} { $nxobj putfloat mdistance [SplitReply [bmon_distance]] } -proc put_det_height_arr {nxobj dim0} { +proc put_det_haxis_arr {nxobj dim0} { + set det_radius_mm [SplitReply [detector_radius_mm]] + set angsep [expr $det_angle_rad / ($dim0-1)] + + for {set i 0} {$i < $dim0} {incr i} { + set x_arr($i) [expr ($dim0 - 1 - $i)*$angsep*$detector_radius_mm] + } + $nxobj putarray x_pixel_offset x_arr $dim0; +} + +proc put_det_vaxis_arr {nxobj dim1} { global det_height set det_active_ht_mm [SplitReply [detector_active_height_mm]] set row_zero [ SplitReply [detector_zero_row]] - det_height_arr $det_active_ht_mm $row_zero $dim0 - $nxobj putarray dvaxis det_height $dim0 + det_height_arr $det_active_ht_mm $row_zero $dim1 + $nxobj putarray dvaxis det_height $dim1 + $nxobj putattribute dvaxis axis 3; } -proc putpolar_angle {nxobj dim0 dim1} { +proc put1Dpolar_angle {nxobj dim0} { + set det_angle_rad [SplitReply [detector_angle_rad]] + set col_zero [ SplitReply [detector_zero_col]] + set col_offset [ SplitReply [detector_ROI_col_offset]] + set det_rot_rad [ expr [SplitReply [stth]]/[SplitReply [deg_per_rad]] ] + + set angsep [expr $det_angle_rad / ($dim0-1)] + for {set i 0} {$i < $dim0} {incr i} { + set polar_array($i) [expr $det_rot_rad+(($dim0 - 1 - $i) + $col_zero + $col_offset)*$angsep] + } + $nxobj putarray polar_angle polar_array $dim0; +} + +proc put2Dpolar_angle {nxobj dim0 dim1} { global det_height set det_radius_mm [SplitReply [detector_radius_mm]] set det_angle_rad [SplitReply [detector_angle_rad]] @@ -187,6 +213,9 @@ proc putcrystal {nxobj} { } proc putcommon {nxobj entryName point} { $nxobj updatedictvar entryName $entryName + nxscript_data clear; + nxscript_data putint 0 $point; + $nxobj putslab erun [list $point] [list 1] nxscript_data; $nxobj puttext etitle [getVal [Title]] $nxobj puttext iname [getVal [Instrument]] $nxobj puttext username [SplitReply [user]]