SICS-354 nxscripts_common_1.tcl
Now using a nexus dictionary variable to set the entry name in data files to prevent duplicate or wrong entry names. Make sure that the isNewFile flag is reset on the first "save" call to prevent file number being incremented multiple times SICS-394 sans commands.tcl Added "selbs", "selbsn", and "selbsxz" commands to select and position a beamstop in a safe manner. SICS-394 sans motor_configuration.tcl Added new beamstop motor drivers. SICS-394 sans parameters.tcl Added BeamStop parameter to record which beamstop has been selected. r2832 | ffr | 2009-12-03 13:04:57 +1100 (Thu, 03 Dec 2009) | 13 lines
This commit is contained in:
committed by
Douglas Clowes
parent
2ec6505ef8
commit
746f495d69
@@ -155,6 +155,10 @@ proc newFileName {idNum postfix} {
|
||||
proc ::nexus::ic_initialize {} {
|
||||
}
|
||||
|
||||
proc getBaseName {fileName} {
|
||||
set baseName [lindex [split [file tail $fileName] "."] 0]
|
||||
return $baseName
|
||||
}
|
||||
##
|
||||
# @brief Create a nexus file
|
||||
# This first generates a nexus dictionary file from the hdb tree and then creates a new
|
||||
@@ -175,8 +179,7 @@ proc newFileName {idNum postfix} {
|
||||
}
|
||||
}
|
||||
|
||||
set baseName [lindex [split [file tail $FileName] "."] 0]
|
||||
set nxdict_path [::nexus::gen_nxdict $baseName $nexusdic]
|
||||
set nxdict_path [::nexus::gen_nxdict $nexusdic]
|
||||
if {$state(file,incr_datnum) == true} {
|
||||
sicsdatanumber incr
|
||||
}
|
||||
@@ -399,6 +402,7 @@ proc ::nexus::save {{point 0}} {
|
||||
set valid_options [list "-index" "-label"]
|
||||
set required_options [list "-index"]
|
||||
if [ catch {
|
||||
set caught_exception false
|
||||
::utility::check_valid_options $args $valid_options
|
||||
::utility::check_required_options $args $required_options
|
||||
array set param $args
|
||||
@@ -424,6 +428,7 @@ proc ::nexus::save {{point 0}} {
|
||||
set data_label @singlefile
|
||||
}
|
||||
if {$isNewFile($data_label)} {
|
||||
set isNewFile($data_label) "false"
|
||||
::nexus::createfile $currFilename($data_label)
|
||||
dataFileName $currFilename($data_label)
|
||||
estart [sicstime]
|
||||
@@ -435,13 +440,10 @@ proc ::nexus::save {{point 0}} {
|
||||
file_status $file_states(O)
|
||||
::nexus::nxreopenfile $currFilename($data_label)
|
||||
file_status $file_states(S)
|
||||
set baseName [getBaseName $currFilename($data_label)]
|
||||
set entryName [gen_NXentry_name $baseName]
|
||||
nxscript updatedictvar pa_entryName $entryName
|
||||
::nexus::save_data $point newfile
|
||||
::nexus::nxclosefile $currFilename($data_label)
|
||||
file_status $file_states(C)
|
||||
incr save_count_arr($data_label)
|
||||
save_count $save_count_arr($data_label)
|
||||
currpoint $point
|
||||
set isNewFile($data_label) "false"
|
||||
} else {
|
||||
eend [sicstime]
|
||||
# timestamp [expr {[clock seconds] - $start_seconds_array($data_label)}]
|
||||
@@ -450,20 +452,28 @@ proc ::nexus::save {{point 0}} {
|
||||
file_status $file_states(O)
|
||||
::nexus::nxreopenfile $currFilename($data_label)
|
||||
file_status $file_states(S)
|
||||
set baseName [getBaseName $currFilename($data_label)]
|
||||
set entryName [gen_NXentry_name $baseName]
|
||||
nxscript updatedictvar pa_entryName $entryName
|
||||
::nexus::save_data $point oldfile
|
||||
::nexus::nxclosefile $currFilename($data_label)
|
||||
file_status $file_states(C)
|
||||
incr save_count_arr($data_label)
|
||||
currpoint $point
|
||||
save_count $save_count_arr($data_label)
|
||||
}
|
||||
} message ] {
|
||||
if {[info exists data_label] && [info exists currFilename($data_label)]} {
|
||||
::nexus::nxclosefile $currFilename($data_label)
|
||||
}
|
||||
return -code error "([info level 0]) $message"
|
||||
set caught_exception true
|
||||
}
|
||||
return
|
||||
if {[info exists data_label] && [info exists currFilename($data_label)]} {
|
||||
::nexus::nxclosefile $currFilename($data_label)
|
||||
file_status $file_states(C)
|
||||
incr save_count_arr($data_label)
|
||||
save_count $save_count_arr($data_label)
|
||||
currpoint $point
|
||||
} else {
|
||||
set message "$message !! FAILED ASSERTION: data_lable and/or currFilename undefined !!"
|
||||
}
|
||||
if {$caught_exception} {
|
||||
return -code error "([info level 0]) $message"
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
##
|
||||
@@ -746,10 +756,10 @@ proc ::nexus::gen_NXentry_name {baseName} {
|
||||
set nm_conv $NXentry_nm_convention([instname])
|
||||
switch $nm_conv {
|
||||
"simple" {
|
||||
return "/entry1"
|
||||
return "entry1"
|
||||
}
|
||||
"fname" {
|
||||
return "/${baseName}"
|
||||
return "${baseName}"
|
||||
}
|
||||
default {
|
||||
return -code error "ERROR: Unknown NXentry naming convention $nm_conv"
|
||||
@@ -765,21 +775,21 @@ proc ::nexus::gen_NXentry_name {baseName} {
|
||||
# @param baseName The base name of the file without suffix
|
||||
# @param nexusdic Name of the nexus dictionary that will be created.
|
||||
# @return Full path to the nexus dictionary.
|
||||
proc ::nexus::gen_nxdict {baseName nexusdic} {
|
||||
proc ::nexus::gen_nxdict {nexusdic} {
|
||||
global cfPath
|
||||
variable nxdictionary
|
||||
if [ catch {
|
||||
set nxdict_path $cfPath(nexus)/$nexusdic
|
||||
array unset nxdictionary
|
||||
set entryName [gen_NXentry_name $baseName]
|
||||
foreach hp [hlist /] {
|
||||
if {[hgetpropval /$hp data] == true} {
|
||||
set nxclass [hgetpropval /$hp klass]
|
||||
::nexus::_gen_nxdict $hp $entryName,NXentry $hp $nxclass
|
||||
::nexus::_gen_nxdict $hp /\$(pa_entryName),NXentry $hp $nxclass
|
||||
}
|
||||
}
|
||||
set fh [open $nxdict_path w]
|
||||
puts $fh "##NXDICT-1.0"
|
||||
puts $fh pa_entryName=entry1
|
||||
puts $fh pa_hmmdimstr=-1,0
|
||||
puts $fh pa_hmmrank=1
|
||||
puts $fh pa_hmmdatname=hmm
|
||||
@@ -1310,7 +1320,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.48 $}]
|
||||
set tmpstr [string map {"$" ""} {$Revision: 1.49 $}]
|
||||
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
|
||||
#namespace eval data {
|
||||
|
||||
Reference in New Issue
Block a user