Link scanvariable to scan dataset and set axes attribute on data.
r1759 | ffr | 2007-03-31 14:49:10 +1000 (Sat, 31 Mar 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
c49619026b
commit
8d6b79db3a
@@ -2,6 +2,6 @@
|
|||||||
mmode=/$(entryName),NXentry/monitor,NXmonitor/SDS mode -type NX_CHAR
|
mmode=/$(entryName),NXentry/monitor,NXmonitor/SDS mode -type NX_CHAR
|
||||||
mpreset=/$(entryName),NXentry/monitor,NXmonitor/SDS preset -type NX_FLOAT32
|
mpreset=/$(entryName),NXentry/monitor,NXmonitor/SDS preset -type NX_FLOAT32
|
||||||
bmcounts=/$(entryName),NXentry/monitor,NXmonitor/SDS \
|
bmcounts=/$(entryName),NXentry/monitor,NXmonitor/SDS \
|
||||||
data -type NX_FLOAT32 -LZW -rank 1 -dim {-1} -attr {signal,1}
|
data -type NX_FLOAT32 -LZW -rank 1 -dim {-1}
|
||||||
mdistance=/$(entryName),NXentry/monitor,NXmonitor/SDS distance -type NX_FLOAT32 -attr {units,metre}
|
mdistance=/$(entryName),NXentry/monitor,NXmonitor/SDS distance -type NX_FLOAT32 -attr {units,metre}
|
||||||
dlayout=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS layout -type NX_CHAR
|
dlayout=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS layout -type NX_CHAR
|
||||||
|
|||||||
@@ -12,14 +12,13 @@ monochromator=monochromator
|
|||||||
detector=detector
|
detector=detector
|
||||||
padim0=512
|
padim0=512
|
||||||
padim1=128
|
padim1=128
|
||||||
scan_variable=scanvar
|
|
||||||
|
|
||||||
#---------- NXentry level
|
#---------- NXentry level
|
||||||
etitle=/$(entryName),NXentry/SDS title -type NX_CHAR
|
etitle=/$(entryName),NXentry/SDS title -type NX_CHAR
|
||||||
sics_release=/version,NXentry/SDS sics_release_tag -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
|
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_release=/version,NXentry/SDS nx_content_release_tag -type NX_CHAR -attr {schema_release,""}
|
||||||
nx_content_revision=/version,NXentry/SDS nx_content_revision_num -type NX_CHAR -attr {schema_revision,"$Revision: 1.4 $"}
|
nx_content_revision=/version,NXentry/SDS nx_content_revision_num -type NX_CHAR -attr {schema_revision,"1.4"}
|
||||||
|
|
||||||
estart=/$(entryName),NXentry/SDS start_time -type NX_CHAR
|
estart=/$(entryName),NXentry/SDS start_time -type NX_CHAR
|
||||||
eend=/$(entryName),NXentry/SDS end_time -type NX_CHAR
|
eend=/$(entryName),NXentry/SDS end_time -type NX_CHAR
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dvaxis=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS ver
|
|||||||
|
|
||||||
|
|
||||||
hmcounts=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS \
|
hmcounts=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/SDS \
|
||||||
data -type NX_INT32 -LZW -rank 3 -dim {-1,$(padim0),$(padim1)} -attr {signal,1}
|
data -type NX_INT32 -LZW -rank 3 -dim {-1,$(padim0),$(padim1)}
|
||||||
|
|
||||||
deff=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/calibration,NXdata/SDS efficiency -type NX_INT32 -LZW -rank 2 -dim {$(dim0),$(dim1)}
|
deff=/$(entryName),NXentry/$(inst),NXinstrument/$(detector),NXdetector/calibration,NXdata/SDS efficiency -type NX_INT32 -LZW -rank 2 -dim {$(dim0),$(dim1)}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
scanvar_name=xxx
|
scanvar_name=variable
|
||||||
scanvar_units=xxx
|
scanvar_units=xxx
|
||||||
scanvar_longname=xxx
|
scanvar_longname=xxx
|
||||||
|
|
||||||
#----------------NXdata ------------------------------------------------
|
#----------------NXdata ------------------------------------------------
|
||||||
|
|
||||||
|
#TODO replace scandata with generic name
|
||||||
scandata=/$(entryName),NXentry/data,NXdata/NXVGROUP
|
scandata=/$(entryName),NXentry/data,NXdata/NXVGROUP
|
||||||
scanvertaxis=/$(entryName),NXentry/vertical_axis,NXdata/NXVGROUP
|
scanvertaxis=/$(entryName),NXentry/vertical_axis,NXdata/NXVGROUP
|
||||||
scanvar=/$(entryName),NXentry/data,NXdata/SDS $(scanvar_name) -type NX_FLOAT32 -attr {units,$(scanvar_units)} -attr {long_name,$(scanvar_longname)} -rank 1 -dim {-1} -attr {axis,1}
|
scanvar=/$(entryName),NXentry/data,NXdata/NXVGROUP
|
||||||
scanstep=/$(entryName),NXentry/scan_step,NXdata/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,stepsize}
|
scanstep=/$(entryName),NXentry/scan_step,NXdata/SDS value -type NX_FLOAT32 -attr {units,degree} -attr {long_name,stepsize}
|
||||||
#histogram=/$(entryName),NXentry/histogram,NXdata/NXVGROUP
|
#histogram=/$(entryName),NXentry/histogram,NXdata/NXVGROUP
|
||||||
#scanvar=/$(entryName),NXentry/$(scan_variable),NXdata/NXVGROUP
|
#scanvar=/$(entryName),NXentry/$(scan_variable),NXdata/NXVGROUP
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
# TODO Return filename from nxcreatefile and call nxreopen nxclose etc
|
# TODO Return filename from nxcreatefile and call nxreopen nxclose etc
|
||||||
# with filename
|
# TODO Make an nxscript namespace for all this.
|
||||||
set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}]
|
|
||||||
|
# dictalias is a global hash which records the alias which the value of
|
||||||
|
# a sics object (eg motors) is written to. The has is indexed by the
|
||||||
|
# objects name. It is useful for making links to datasets.
|
||||||
|
|
||||||
|
set tmpstr [string map {"$" ""} {}]
|
||||||
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||||
set tmpstr [string map {"$" ""} {$Revision: 1.13 $}]
|
set tmpstr [string map {"$" ""} {1.13}]
|
||||||
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||||
|
|
||||||
MakeNXScript
|
MakeNXScript
|
||||||
@@ -75,7 +80,8 @@ proc det_height_arr {active_height_mm row_zero dim0} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc hmm_save {nxobj entryname point} {
|
proc hmm_save {nxobj entryname point} {
|
||||||
global dradius ndect angsep;
|
global dradius ndect angsep dictalias;
|
||||||
|
set dictalias(hmm) hmcounts
|
||||||
set dim0 [SplitReply [hmm configure dim0]];
|
set dim0 [SplitReply [hmm configure dim0]];
|
||||||
set dim1 [SplitReply [hmm configure dim1]];
|
set dim1 [SplitReply [hmm configure dim1]];
|
||||||
putcommon $nxobj $entryname $point;
|
putcommon $nxobj $entryname $point;
|
||||||
@@ -93,26 +99,22 @@ proc hmm_save {nxobj entryname point} {
|
|||||||
set histo_length [SplitReply [hmm_length]]
|
set histo_length [SplitReply [hmm_length]]
|
||||||
$nxobj updatedictvar padim0 $dim0
|
$nxobj updatedictvar padim0 $dim0
|
||||||
$nxobj updatedictvar padim1 $dim1
|
$nxobj updatedictvar padim1 $dim1
|
||||||
$nxobj putslab hmcounts [list $point 0 0] [list 1 $dim0 $dim1 ] hmm [SplitReply [hmm_start]] $histo_length [SplitReply [hmm_bank]]
|
$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 scandata hmcounts
|
||||||
$nxobj makelink scanvertaxis dvaxis
|
$nxobj makelink scanvertaxis dvaxis
|
||||||
}
|
}
|
||||||
|
|
||||||
proc hmm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarStep start_time} {
|
proc hmm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarStep start_time} {
|
||||||
$nxobj puttext estart $start_time
|
global dictalias;
|
||||||
$nxobj updatedictvar scan_variable $scanVariable
|
|
||||||
|
|
||||||
set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]]
|
|
||||||
$nxobj updatedictvar scanvar_name $scanVariable
|
|
||||||
#TODO $nxobj updatedictvar scanvar_units [SplitReply [$scanVariable units]]
|
|
||||||
$nxobj updatedictvar scanvar_units "unknown"
|
|
||||||
$nxobj updatedictvar scanvar_longname $scanVariable
|
|
||||||
nxscript_data clear
|
|
||||||
nxscript_data putfloat 0 $scanVar_value
|
|
||||||
$nxobj putslab scanvar [list $point] [list 1] nxscript_data
|
|
||||||
# $nxobj putfloat scanstep $scanVarStep
|
|
||||||
|
|
||||||
|
$nxobj puttext estart $start_time;
|
||||||
hmm_save $nxobj $entryname $point;
|
hmm_save $nxobj $entryname $point;
|
||||||
|
fillPath $nxobj $scanVariable;
|
||||||
|
$nxobj makelink scanvar $dictalias($scanVariable);
|
||||||
|
$nxobj putattribute scanvar axis 1;
|
||||||
|
$nxobj putattribute hmcounts signal 1;
|
||||||
|
$nxobj putattribute hmcounts axes $scanVariable;
|
||||||
$nxobj puttext eend [sicstime];
|
$nxobj puttext eend [sicstime];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,28 +126,21 @@ proc bm_save {nxobj entryname point} {
|
|||||||
putmonitor $nxobj $point
|
putmonitor $nxobj $point
|
||||||
putsample $nxobj
|
putsample $nxobj
|
||||||
$nxobj puttext dlayout point
|
$nxobj puttext dlayout point
|
||||||
|
#TODO replace scandata with generic name
|
||||||
$nxobj makelink scandata bmcounts
|
$nxobj makelink scandata bmcounts
|
||||||
}
|
}
|
||||||
|
|
||||||
#TODO Refactor: Add bm_save command and use it here.
|
|
||||||
proc bm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarStep start_time} {
|
proc bm_addnxscanentry {nxobj entryname point scanVariable scanVarPos scanVarStep start_time} {
|
||||||
$nxobj puttext estart $start_time
|
global dictalias;
|
||||||
|
|
||||||
set scanVar_value [string trim [lindex [split [$scanVariable] =] 1]]
|
$nxobj puttext estart $start_time;
|
||||||
$nxobj updatedictvar scanvar_name $scanVariable
|
bm_save $nxobj $entryname $point;
|
||||||
#TODO $nxobj updatedictvar scanvar_units [SplitReply [$scanVariable units]]
|
fillPath $nxobj $scanVariable;
|
||||||
$nxobj updatedictvar scanvar_units "unknown"
|
$nxobj makelink scanvar $dictalias($scanVariable);
|
||||||
$nxobj updatedictvar scanvar_longname $scanVariable
|
$nxobj putattribute scanvar axis 1;
|
||||||
nxscript_data clear
|
$nxobj putattribute bmcounts signal 1;
|
||||||
nxscript_data putfloat 0 $scanVar_value
|
$nxobj putattribute bmcounts axes $scanVariable;
|
||||||
$nxobj putslab scanvar [list $point] [list 1] nxscript_data
|
#TODO add dtype ddesc
|
||||||
bm_save $nxobj $entryname $point
|
|
||||||
# $nxobj putfloat scanstep $scanVarStep
|
|
||||||
# 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
|
|
||||||
#TODO add dtype ddesc
|
|
||||||
$nxobj puttext eend [sicstime];
|
$nxobj puttext eend [sicstime];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,49 +202,70 @@ proc putcommon {nxobj entryName point} {
|
|||||||
putmonomotors $nxobj $point
|
putmonomotors $nxobj $point
|
||||||
}
|
}
|
||||||
|
|
||||||
proc putsamplemotors {nxobj point} {
|
# This should be called before making a link to a dataset
|
||||||
foreach motor { som schi sphi sx sy stth } {
|
# via a value in the dictalias hash.
|
||||||
|
proc fillPath {nxobj sobj} {
|
||||||
|
set otype [SplitReply [sicslist $sobj type]];
|
||||||
|
if {$otype == "Motor"} {
|
||||||
|
fillMotPath $nxobj $sobj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc fillMotPath {nxobj motor} {
|
||||||
$nxobj updatedictvar mot_name $motor;
|
$nxobj updatedictvar mot_name $motor;
|
||||||
$nxobj updatedictvar mot_long_name $motor;
|
$nxobj updatedictvar mot_long_name $motor;
|
||||||
$nxobj updatedictvar mot_units [SplitReply [$motor units]];
|
$nxobj updatedictvar mot_units [SplitReply [$motor units]];
|
||||||
nxscript_data clear
|
}
|
||||||
nxscript_data putfloat 0 [getVal [$motor] ]
|
|
||||||
$nxobj putslab nxsample_mot [list $point] [list 1] nxscript_data;
|
proc putsamplemotors {nxobj point} {
|
||||||
|
global dictalias;
|
||||||
|
|
||||||
|
foreach motor { som schi sphi sx sy stth } {
|
||||||
|
fillMotPath $nxobj $motor;
|
||||||
|
set dictalias($motor) nxsample_mot
|
||||||
|
nxscript_data clear;
|
||||||
|
nxscript_data putfloat 0 [getVal [$motor] ];
|
||||||
|
$nxobj putslab $dictalias($motor) [list $point] [list 1] nxscript_data;
|
||||||
}
|
}
|
||||||
# sth is a virtual motor
|
# sth is a virtual motor
|
||||||
nxscript_data clear
|
nxscript_data clear
|
||||||
nxscript_data putfloat 0 [getVal [sth ]]
|
nxscript_data putfloat 0 [getVal [sth ]]
|
||||||
$nxobj putslab sth [list $point] [list 1] nxscript_data;
|
set dictalias(sth) sth
|
||||||
|
$nxobj putslab $dictalias(sth) [list $point] [list 1] nxscript_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc putmonomotors {nxobj point} {
|
proc putmonomotors {nxobj point} {
|
||||||
|
global dictalias;
|
||||||
|
|
||||||
foreach motor { mom mchi mphi mx my mtth } {
|
foreach motor { mom mchi mphi mx my mtth } {
|
||||||
$nxobj updatedictvar mot_name $motor;
|
fillMotPath $nxobj $motor;
|
||||||
$nxobj updatedictvar mot_long_name $motor;
|
set dictalias($motor) nxcrystal_mot
|
||||||
$nxobj updatedictvar mot_units [SplitReply [$motor units]];
|
|
||||||
nxscript_data clear
|
nxscript_data clear
|
||||||
nxscript_data putfloat 0 [getVal [$motor] ]
|
nxscript_data putfloat 0 [getVal [$motor] ]
|
||||||
$nxobj putslab nxcrystal_mot [list $point] [list 1] nxscript_data;
|
$nxobj putslab $dictalias($motor) [list $point] [list 1] nxscript_data;
|
||||||
}
|
}
|
||||||
# mth is a virtual motor
|
# mth is a virtual motor
|
||||||
nxscript_data clear
|
nxscript_data clear
|
||||||
nxscript_data putfloat 0 [getVal [mth ]]
|
nxscript_data putfloat 0 [getVal [mth ]]
|
||||||
$nxobj putslab mth [list $point] [list 1] nxscript_data;
|
set dictalias(mth) mth
|
||||||
|
$nxobj putslab $dictalias(mth) [list $point] [list 1] nxscript_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc putslitmotors {nxobj point} {
|
proc putslitmotors {nxobj point} {
|
||||||
|
global dictalias;
|
||||||
|
|
||||||
foreach motor {ss1u ss1d ss1l ss1r ss2u ss2d ss2l ss2r } {
|
foreach motor {ss1u ss1d ss1l ss1r ss2u ss2d ss2l ss2r } {
|
||||||
$nxobj updatedictvar mot_name $motor;
|
fillMotPath $nxobj $motor;
|
||||||
$nxobj updatedictvar mot_long_name $motor;
|
set dictalias($motor) nxfilter_mot
|
||||||
$nxobj updatedictvar mot_units [SplitReply [$motor units]];
|
|
||||||
nxscript_data clear
|
nxscript_data clear
|
||||||
nxscript_data putfloat 0 [getVal [$motor] ]
|
nxscript_data putfloat 0 [getVal [$motor] ]
|
||||||
$nxobj putslab nxfilter_mot [list $point] [list 1] nxscript_data;
|
$nxobj putslab $dictalias($motor) [list $point] [list 1] nxscript_data;
|
||||||
}
|
}
|
||||||
foreach motor {ss1vg ss1vo ss1hg ss1ho ss2vg ss2vo ss2hg ss2ho } {
|
foreach motor {ss1vg ss1vo ss1hg ss1ho ss2vg ss2vo ss2hg ss2ho } {
|
||||||
|
set dictalias($motor) $motor
|
||||||
nxscript_data clear
|
nxscript_data clear
|
||||||
nxscript_data putfloat 0 [getVal [$motor] ]
|
nxscript_data putfloat 0 [getVal [$motor] ]
|
||||||
$nxobj putslab $motor [list $point] [list 1] nxscript_data;
|
$nxobj putslab $dictalias($motor) [list $point] [list 1] nxscript_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user