diff --git a/site_ansto/instrument/hipd/config/nexus/nexus.dic b/site_ansto/instrument/hipd/config/nexus/nexus.dic index 9760d264..bc27b61b 100644 --- a/site_ansto/instrument/hipd/config/nexus/nexus.dic +++ b/site_ansto/instrument/hipd/config/nexus/nexus.dic @@ -18,6 +18,7 @@ scan_variable=scanvar samplemotor=samplemotor #---------- NXentry level etitle=/$(entryName),NXentry/SDS title -type NX_CHAR +sics_release=/$(entryName),NXentry/SDS release_tag -type NX_CHAR estart=/$(entryName),NXentry/SDS start_time -type NX_CHAR eend=/$(entryName),NXentry/SDS end_time -type NX_CHAR #----------------- NXinstrument @@ -25,6 +26,12 @@ iname=/$(entryName),NXentry/$(inst),NXinstrument/SDS name -type NX_CHAR \ -rank 1 -dim {132} +#----------------- NXuser +username=/$(entryName),NXentry/user,NXuser/SDS name -type NX_CHAR +userrole=/$(entryName),NXentry/user,NXuser/SDS role -type NX_CHAR +useraddress=/$(entryName),NXentry/user,NXuser/SDS address -type NX_CHAR +userphone=/$(entryName),NXentry/user,NXuser/SDS phone -type NX_CHAR +useremail=/$(entryName),NXentry/user,NXuser/SDS email -type NX_CHAR #----------------- NXmonitor mmode=/$(entryName),NXentry/monitor,NXmonitor/SDS mode -type NX_CHAR mpreset=/$(entryName),NXentry/monitor,NXmonitor/SDS preset -type NX_FLOAT32 @@ -41,9 +48,8 @@ sprobe=/$(entryName),NXentry/$(inst),NXinstrument/source,NXsource/SDS probe -typ # histogram data 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} +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} @@ -71,7 +77,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} #--------------- NXsample saname=/$(entryName),NXentry/sample,NXsample/SDS name -type NX_CHAR -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} 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} @@ -97,6 +103,7 @@ ss2hg=/$(entryName),NXentry/slits,NXfilter/SDS ss2hg -type NX_FLOAT32 -attr {un 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 +scanvertaxis=/$(entryName),NXentry/vertical_axis,NXdata/NXVGROUP scanvar=/$(entryName),NXentry/scan_variable,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/hipd/config/nexus/nxscripts.tcl b/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl index 2c434a42..3fdf2261 100644 --- a/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl +++ b/site_ansto/instrument/hipd/config/nexus/nxscripts.tcl @@ -10,8 +10,10 @@ proc newFileName {} { set dataPath [SplitReply [sicsdatapath]]; set prefix [SplitReply [sicsdataprefix]]; set postfix [SplitReply [sicsdatapostfix]]; - set isodate [lindex [split [sicstime] " "] 0]; - return [format "%s/%s_%s_%s%s" $dataPath $prefix $isodate $idNum $postfix]; + 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}} { @@ -21,6 +23,8 @@ proc nxcreatefile {{type nx.hdf}} { 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 } @@ -48,21 +52,22 @@ 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 dim0 dim1} { +proc polar_angle {dradius det_angle active_length zi zj det_rot y_offset dim0 dim1} { global tharr det_height - set angsep [expr 1.0*$det_angle / ($dim1-1.0)] - set ysep [expr 1.0*$active_length/($dim0-1.0)] - set izero [expr ($dim0 -1.0 )+$zi] - set jzero [expr ($dim1 -1.0 )/2.0+$zj] + 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 ($i - $izero)*$ysep] + 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 - $jzero)*$angsep] - set pang [expr acos($dradius * cos($alpha)/sqrt($dradius*$dradius + $height*$height))] - set tharr([expr $i*$dim1+$j]) $pang +# 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 } } } @@ -77,6 +82,7 @@ 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 @@ -86,23 +92,17 @@ putsample $nxobj $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 -# 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 putmonitor $nxobj putsample $nxobj set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]] @@ -116,7 +116,7 @@ putsample $nxobj $nxobj makelink scandata mdata $nxobj makelink scanvar $scanVariable $nxobj putfloat scanstep $scanVarStep - + $nxobj puttext eend [sicstime]; } proc putmonitor {nxobj} { @@ -132,10 +132,10 @@ proc putpolar_angle {nxobj dim0 dim1} { 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_xpixel_zero_offset]] - set det_zyp [ SplitReply [detector_ypixel_zero_offset]] + 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 $dim0 $dim1 + 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 @@ -154,6 +154,9 @@ proc putcommon {nxobj entryName scanVariable} { $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