source: trunk/dumpprof.tcl

Last change on this file was 1251, checked in by toby, 7 years ago

use svn ps svn:eol-style "native" * to change line ends

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Revision Id
File size: 2.7 KB
RevLine 
[689]1if {[llength $argv] != 1} {
2    wm withdraw .
3    tk_dialog .err {Wrong Args} \
4            "$argv0: argument should be a .EXP file name" \
5            error 0 Continue
6    exit
7}
8
[875]9package require Tk
10
[689]11set filename [lindex $argv 0]
12
13set expgui(font) 14
14set expgui(debug) 0
15
16pack [label .l -text "Reading $filename\nPlease wait"]
17update
18wm protocol . WM_DELETE_WINDOW {puts ""; exit}
19#=============================================================================
20#----------------------------------------------------------------
21# where are we?
22set expgui(script) [info script]
23# translate links -- go six levels deep
24foreach i {1 2 3 4 5 6} {
25    if {[file type $expgui(script)] == "link"} {
26        set link [file readlink $expgui(script)]
27        if { [file  pathtype  $link] == "absolute" } {
28            set expgui(script) $link
29        } {
30            set expgui(script) [file dirname $expgui(script)]/$link
31        }
32    } else {
33        break
34    }
35}
36# fixup relative paths
37if {[file pathtype $expgui(script)] == "relative"} {
38    set expgui(script) [file join [pwd] $expgui(script)]
39}
40set expgui(scriptdir) [file dirname $expgui(script) ]
41#----------------------------------------------------------------
42source [file join $expgui(scriptdir) opts.tcl]
43# fetch EXP file processing routines
44source [file join $expgui(scriptdir) readexp.tcl]
45# commands for running GSAS programs
46#source [file join $expgui(scriptdir) gsascmds.tcl]
47# override options with locally defined values
[697]48set filelist [file join $expgui(scriptdir) localconfig]
49if {$tcl_platform(platform) == "windows"} {
50    lappend filelist "c:/gsas.config"
51} else {
52    lappend filelist [file join ~ .gsas_config]
[689]53}
[697]54catch {
55    foreach file $filelist {
56        if [file exists $file] {source $file}
57    }
[689]58}
59SetTkDefaultOptions $expgui(font)
60
61if {![file exists $filename]} {
62    # read error
63    wm withdraw .
64    tk_dialog .err {Bad file} \
65            "$argv0: error\nfile $filename not found" \
66            error 0 Continue
67    exit
68}
69set fmt [expload $filename]
70if {$fmt < 0} {
71    # read error
72    wm withdraw .
73    tk_dialog .err {Bad file} \
74            "$argv0: error reading $filename\nThis is not a valid GSAS .EXP file" \
75            error 0 Continue
76    exit
77}
78mapexp
79set list1 {}
80foreach hist $expmap(powderlist) {
81    set list2 $hist
[875]82    set instcons {}
83    foreach item {difc difa zero ipola pola} {
84        lappend instcons [histinfo $hist $item] 
85    }
86    lappend list2 "$expmap(htype_$hist) [list $instcons]"
[689]87    foreach i $expmap(phaselist_$hist) {
[697]88        set list $i
89        lappend list [string trim [hapinfo $hist $i proftype]]
[689]90        lappend list [hapinfo $hist $i pcut]
91        set nterms [hapinfo $hist $i profterms]
92        for { set num 1 } { $num <= $nterms } { incr num } {
93            lappend list [hapinfo $hist $i pterm$num]
94        }
95        lappend list2 $list
96    }
97    lappend list1 $list2
98}
99puts $list1
100exit
Note: See TracBrowser for help on using the repository browser.