Use dataFileName SICS variable.

Refactoring:
Renamed addnxentry functions to addnxscanentry functions in preparation for code which will compose nxentries from primitives.

r1625 | ffr | 2007-03-12 08:45:50 +1100 (Mon, 12 Mar 2007) | 4 lines
This commit is contained in:
Ferdi Franceschini
2007-03-12 08:45:50 +11:00
committed by Douglas Clowes
parent 962dfd484b
commit 4037d5ca4d

View File

@@ -20,13 +20,13 @@ proc newFileName {} {
}
proc nxcreatefile {nxdic {type nx.hdf}} {
global dataFileName nxFileOpen cfPath nexusdic;
global nxFileOpen cfPath nexusdic;
SicsDataPostFix .$type;
set nexusdic $nxdic
array set nxmode [list nx.hdf create5 h5 create5 nx5 create5 xml createxml];
set dataFileName [newFileName]
nxscript $nxmode($type) $dataFileName $cfPath(nexus)/$nexusdic;
dataFileName [newFileName]
nxscript $nxmode($type) [SplitReply [dataFileName]] $cfPath(nexus)/$nexusdic;
nxscript updatedictvar entryName sics_release
nxscript puttext sics_release [SplitReply [sics_release]]
set nxFileOpen true
@@ -34,17 +34,17 @@ proc nxcreatefile {nxdic {type nx.hdf}} {
proc nxreopenfile {} {
global dataFileName nxFileOpen cfPath nexusdic;
nxscript reopen $dataFileName $cfPath(nexus)/$nexusdic;
global nxFileOpen cfPath nexusdic;
nxscript reopen [SplitReply [dataFileName]] $cfPath(nexus)/$nexusdic;
set nxFileOpen true;
}
proc nxclosefile {} {
global dataFileName nxFileOpen;
global nxFileOpen;
if {$nxFileOpen == true} {
nxscript close;
set nxFileOpen false;
set flist [split $dataFileName "/"];
set flist [split [SplitReply [dataFileName]] "/"];
set fname [lindex $flist [expr [llength $flist] - 1] ];
clientput "$fname updated" "event";
}
@@ -56,27 +56,18 @@ 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 y_offset dim0 dim1} {
global tharr det_height
proc det_height_arr {active_height_mm row_zero dim0} {
global det_height
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]
set hsep [expr $active_height_mm/($dim0-1)]
for {set i 0} {$i < $dim0} {incr i} {
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 - $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
}
}
for {set i 0} {$i < $dim0} {incr i} {
set height [expr ($row_zero - $i) *$hsep]
set det_height($i) $height
}
}
proc addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} {
proc addnxscanentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} {
global dradius ndect angsep;
set dim0 [SplitReply [hmm configure dim0]]
set dim1 [SplitReply [hmm configure dim1]]
@@ -103,7 +94,7 @@ putsample $nxobj
$nxobj puttext eend [sicstime];
}
proc bm_addnxentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} {
proc bm_addnxscanentry {nxobj entryname scanVariable scanVarPos scanVarStep start_time} {
global dradius ndect angsep;
putcommon $nxobj $entryname $scanVariable
putcrystal $nxobj
@@ -131,19 +122,22 @@ proc putmonitor {nxobj} {
}
proc putpolar_angle {nxobj dim0 dim1} {
global tharr det_height
global det_height
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]]
set row_zero [ SplitReply [detector_zero_row]]
set row_offset [ SplitReply [detector_ROI_row_offset]]
set col_zero [ SplitReply [detector_zero_col]]
set col_offset [ SplitReply [detector_ROI_col_offset]]
polar_angle $det_radius_mm $det_angle_rad $det_active_ht_mm $det_zxp $det_zyp $det_rot_rad 0 $dim0 $dim1
det_height_arr $det_active_ht_mm $row_zero $dim0
$nxobj updatedictvar padim0 $dim0
$nxobj updatedictvar padim1 $dim1
$nxobj putarray dvaxis det_height $dim0
$nxobj putgenarray dtheta tharr [expr $dim0 * $dim1]
set angsep [expr $det_angle_rad / ($dim1-1)]
$nxobj putpolararray dtheta $det_radius_mm $angsep $det_active_ht_mm $det_rot_rad $row_zero $row_offset $col_zero $col_offset $dim0 $dim1
}
proc putsample {nxobj} {
@@ -190,6 +184,6 @@ proc putslitmotors {nxobj} {
}
publish nxcreatefile user
publish addnxentry user
publish bm_addnxentry user
publish addnxscanentry user
publish bm_addnxscanentry user