Now supports adding toplevel entries to an NXentry.

Added start_time and end_time.

r2249 | ffr | 2007-11-08 17:04:07 +1100 (Thu, 08 Nov 2007) | 3 lines
This commit is contained in:
Ferdi Franceschini
2007-11-08 17:04:07 +11:00
committed by Douglas Clowes
parent a9617da982
commit 643b2bad1b

View File

@@ -5,7 +5,10 @@
MakeNXScript
sicsdatafactory new nxscript_data
::utility::mkVar estart Text user start_time true entry false true
::utility::mkVar eend Text user end_time true entry false true
namespace eval nexus {
variable data_gp_path "/data"
set exports [list newfile closefile save data]
eval namespace export $exports
if 0 {datafilename}
@@ -183,6 +186,7 @@ proc newFileName {postfix} {
global cfPath
variable nexusdic
variable state
variable data_gp_path
if {$state(file,open) == "true"} {
error_msg "Can't create a new file because the current file is still open"
} elseif {$state(file,new) == "false"} {
@@ -198,7 +202,7 @@ proc newFileName {postfix} {
sicsdatanumber incr
dataFileName [newFileName $file_format]
}
hsetprop /data currentfiletype [::utility::hgetplainprop /data datatype]
hsetprop $data_gp_path currentfiletype [::utility::hgetplainprop $data_gp_path datatype]
nxscript $nxmode($file_format) [SplitReply [dataFileName]] $nxdict_path
set state(file,open) false
set state(file,new) false
@@ -231,15 +235,16 @@ proc ::nexus::isValidFileType {type} {
proc ::nexus::newfile {type {namestyle data}} {
variable filetype_spec
variable state
variable data_gp_path
set state(file,namestyle) $namestyle
set state(file,new) true
hsetprop /data currentfiletype UNKNOWN
hsetprop $data_gp_path currentfiletype UNKNOWN
if {$type == "clear"} {
::nexus::data clear
::hdb::set_save / false
hsetprop /data currentfiletype UNKNOWN
hsetprop /data datatype UNKNOWN
hsetprop $data_gp_path currentfiletype UNKNOWN
hsetprop $data_gp_path datatype UNKNOWN
} else {
::nexus::process_filetype_policy $type filetype_spec
}
@@ -275,6 +280,7 @@ proc ::nexus::newfile {type {namestyle data}} {
# if the current data type doesn't match the current file type.
proc ::nexus::save {{point 0}} {
variable state
variable data_gp_path
if {[string is integer $point] == 0} {
error_msg "save index must be an integer"
@@ -285,8 +291,8 @@ proc ::nexus::newfile {type {namestyle data}} {
::data::gumtree_save -set run_number $point
set isNewFile [expr {$state(file,new) == "true"}]
set currFileType [::utility::hgetplainprop /data currentfiletype]
set currDataType [::utility::hgetplainprop /data datatype]
set currFileType [::utility::hgetplainprop $data_gp_path currentfiletype]
set currDataType [::utility::hgetplainprop $data_gp_path datatype]
set dataTypeChanged [expr {$currFileType != $currDataType}]
if {$currDataType == "UNKNOWN"} {
error_msg "You must set the file type, eg 'newfile BEAM_MONITOR' or 'newfile BEAM_MONITOR scratch' "
@@ -295,9 +301,12 @@ proc ::nexus::newfile {type {namestyle data}} {
if {$isNewFile || $dataTypeChanged} {
set state(file,new) true
::nexus::createfile
estart [lindex [sicstime] 1]
eend [lindex [sicstime] 1]
::nexus::save_data $point
::nexus::linkdata
} else {
eend [lindex [sicstime] 1]
::nexus::save_data $point
}
@@ -351,13 +360,15 @@ proc ::nexus::newfile {type {namestyle data}} {
# data alias <name> <target>, set <name> as an alias for <target> unless it has already been defined.
proc ::nexus::data {args} {
variable state
variable data_gp_path
if {[llength $args] == 1} {
set arguments [lindex $args 0]
} else {
set arguments $args
}
set dpath /data
set dpath $data_gp_path
set opt [lindex $arguments 0]
set arglist [lrange $arguments 1 end]
@@ -435,8 +446,10 @@ proc ::nexus::newfile {type {namestyle data}} {
# Sets the "signal" and "axes" attributes on the plottable data
# Also sets the "axis" attribute for each of the axes.
proc ::nexus::linkdata {} {
variable data_gp_path
array unset axes
set hpath /data
set hpath $data_gp_path
::nexus::nxreopenfile
foreach child [hlist $hpath] {
array set p_arr [::utility::hlistplainprop $hpath/$child]
@@ -520,7 +533,9 @@ proc ::nexus::newfile {type {namestyle data}} {
foreach child [hlist /$hpath] {
if {[::utility::hgetplainprop /$hpath/$child data] == true} {
set nxclass [::utility::hgetplainprop /$hpath/$child klass]
if {[string range $nxc 0 1] == "NX"} {
if {$nxc == "NXentry"} {
::nexus::_gen_nxdict $hpath/$child $dictPath $child $nxclass
} elseif {[string range $nxc 0 1] == "NX"} {
::nexus::_gen_nxdict $hpath/$child $dictPath/$name,$nxc $child $nxclass
} else {
::nexus::_gen_nxdict $hpath/$child $dictPath ${name}_$child $nxclass
@@ -835,7 +850,7 @@ foreach expt $::nexus::exports {
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.34 $}]
set tmpstr [string map {"$" ""} {$Revision: 1.35 $}]
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
namespace eval data {