Changeset 128
- Timestamp:
- Dec 4, 2009 5:00:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/readexp.tcl
- Property rcs:date changed from 2000/02/02 17:42:20 to 2000/05/16 21:48:45
- Property rcs:lines changed from +12 -3 to +23 -13
- Property rcs:rev changed from 1.12 to 1.13
r124 r128 6 6 # ... reading an EXP file into an array 7 7 proc expload {expfile} { 8 global exparray tcl_platform8 global exparray 9 9 # $expfile is the path to the data file. 10 10 if [catch {set fil [open "$expfile" r]}] { 11 11 tk_dialog .expFileErrorMsg "File Open Error" \ 12 "Unable to open file $expfile" error 0 "Exit" ; return 112 "Unable to open file $expfile" error 0 "Exit" ; return -1 13 13 } 14 14 set len [gets $fil line] … … 17 17 "You are using an old version of Tcl/Tk and your .EXP file has binary characters; run convstod or upgrade" \ 18 18 error 0 "Exit" 19 exit 19 return -1 20 } 21 catch { 22 unset exparray 20 23 } 21 24 if {$len > 160} { 25 set fmt 0 22 26 # a UNIX-type file 23 27 set i1 0 … … 31 35 } 32 36 } else { 37 set fmt 1 33 38 while {$len > 0} { 34 39 set key [string range $line 0 11] … … 38 43 } 39 44 close $fil 40 return 045 return $fmt 41 46 } 42 47 … … 58 63 # creates the following entries in global array expmap 59 64 # expmap(phaselist) gives a list of defined phases 65 # expmap(phasetype) gives the phase type for each defined phase 66 # =1 nuclear; 2 mag+nuc; 3 mag; 4 macro 60 67 # expmap(atomlist_$p) gives a list of defined atoms in phase $p 61 68 # expmap(htype_$n) gives the GSAS histogram type for histogram … … 73 80 # } 74 81 set expmap(phaselist) {} 82 set expmap(phasetype) {} 75 83 # loop over phases 76 84 foreach iph {1 2 3 4 5 6 7 8 9} { … … 79 87 set flag [string trim [string range $line $i5s $i5e]] 80 88 if {$flag == ""} {set flag 0} 81 if $flag {lappend expmap(phaselist) $iph} 89 if $flag { 90 lappend expmap(phaselist) $iph 91 lappend expmap(phasetype) $flag 92 } 82 93 } 83 94 # get the list of defined atoms for each phase … … 116 127 set expmap(htype_$ihist) [lindex $line $j] 117 128 # at least for now, ignore non-powder histograms 118 if {[string range $expmap(htype_$ihist) 0 0] == "P"} { 129 if {[string range $expmap(htype_$ihist) 0 0] == "P" && \ 130 [string range $expmap(htype_$ihist) 3 3] != "*"} { 119 131 lappend expmap(powderlist) $ihist 120 132 } … … 206 218 } 207 219 208 # delete an exp record e220 # delete an exp record 209 221 # returns 1 if OK; 0 if not found 210 222 proc delexp {key} { … … 284 296 } 285 297 title-set { 286 setexp " DESCR" " $value" 168298 setexp " DESCR" " $value" 2 68 287 299 } 288 300 … … 386 398 387 399 name-set { 388 setexp "CRS$phase PNAM" " $value" 168400 setexp "CRS$phase PNAM" " $value" 2 68 389 401 } 390 402 … … 1176 1188 return [llength [array names exparray { HSTRY*}]] 1177 1189 } 1178 1179
Note: See TracChangeset
for help on using the changeset viewer.