Changeset 1115 for branches/sandbox


Ignore:
Timestamp:
Feb 26, 2011 9:47:37 PM (10 years ago)
Author:
toby
Message:

scan .EXP files for GENLES blowups; update web pages

Location:
branches/sandbox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/doc/expgui.html

    r973 r1115  
    1616EXPGUI<BR>
    1717A Graphical User Interface for
    18 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">
     18<A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro">
    1919GSAS</A>
    2020<HR noshade width="75%" size="2" align="center">
     
    3434<P><P>
    3535EXPGUI is a graphical interface for the
    36 Los Alamos
    37 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">
    38 GSAS</A> package.
     36<A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro">GSAS</A>
     37package, developed at Los Alamos and maintained now at Argonne.
    3938EXPGUI does two things:
    4039it can be used to directly modify the GSAS
     
    117116A.C. Larson and R.B. Von Dreele, "General Structure Analysis System (GSAS)",
    118117Los Alamos National Laboratory Report LAUR 86-748 (2000).
    119 <A HREF="http://www.ccp14.ac.uk/ccp/ccp14/ftp-mirror/gsas/public/gsas/manual/GSASManual.pdf">
     118<A
     119  HREF="https://subversion.xor.aps.anl.gov/EXPGUI/gsas/all/GSAS%20Manual.pdf">
    120120[link to PDF copy of manual]
    121121</A>
     
    154154are used. The File/Save operation is done automatically before any GSAS
    155155programs, such as GENLES or EXPEDT, are run.
     156<P>
     157<A name="badexp">
     158The GSAS refinement program, GENLES, will sometimes "blow up", where the
     159  program changes varied parameters to values very far from their
     160  correct values. This occurs when parameters are highly correlated,
     161  are refining to values that are not allowed, or some of the refined parameters have
     162  very little impact on the quality of the fit. When this happens,
     163  invalid values are written to the GSAS experiment file that contain
     164  either asterisks (****) or the string "NAN" (not a number). Such
     165  files cannot be used for additional GENLES runs.
     166  <P>
     167  When EXPGUI reads a .EXP file it scans it for evidence of a previous
     168  failure of a GENLES refinement and warns if a problem is
     169  noted. Please note that this scan is not perfect and occasionally
     170  you may be warned in cases where the file is fine (if possible,
     171  please send such .EXP file to Brian Toby so this scan can be improved.)
     172  When such a "bad" .EXP file is located, one can "revert" to an
     173  archived copy of a previous experiment file (with suffix .Oxx). This
     174  can be done with the Revert menu item in the File menu. Note that
     175clicking on a file in the file selection window causes it to be
     176scanned and shows the status of that refinement. Also note that
     177usually the last good archived file has settings that will produce the same bad
     178refinement, so it is necessary to either revert further back, or to
     179change the refinement options before running GENLES.
    156180<P>
    157181
     
    681705<A name=tcltk>
    682706<H2>
    683 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">
     707<A Href="http://www.tcl.tk">
    684708Tcl/Tk</A></H2>
    685709The
    686 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">
     710<A Href="http://www.tcl.tk">
    687711Tcl/Tk program</A> is a platform-independent scripting language that is
    688712used to implement most of EXPGUI. This software is available for free
    689 and must be loaded in order to use EXPGUI. See the
    690 installation notes for
    691 <A HREF="expgui_Win_readme.html">Windows</A>,
    692 and for
    693 <A HREF="expgui_Unix_readme.html">UNIX</A> for information on how to do this.
     713and must be loaded in order to use EXPGUI. A somewhat out of date
     714version of Tcl/Tk (8.4) is distributed with EXPGUI (ncnrpack.exe, etc.) but
     715more recent versions can be used, but note that the BLT package (see
     716below) is needed for all features of EXPGUI.
    694717While learning Tcl/Tk is a great thing to do, it is not a requirement
    695718for using or installing EXPGUI.
    696 
    697 <A name=winexec>
    698 <H3>
    699 WINEXEC</H3>
    700 <UL>
    701 The WINEXEC package is needed under Windows-95 and its offspring
    702 (-98 and -ME). See the <A HREF="expgui_Win_readme.html">Windows installation
    703 notes</A> for more details.
    704 </UL>
    705719
    706720<A name=blt>
     
    715729If this is the case, a message,
    716730"BLT Setup Error: could not access a Blt_ routine...", will be displayed.
    717 This is most common in UNIX and is discussed further in the
    718 <A HREF="expgui_Unix_readme.html">UNIX installation notes</A>. Also see
    719 <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">
    720 http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html
    721 </A> for more information on installation of BLT.
     731Use of the ncnrpack file distributed with EXPGUI usually avoids this problem.
    722732</UL>
    723733
     
    727737<UL>
    728738The
    729 <A HREF="www.hume.com">Hume
     739<A HREF="http://www.hume.com">Hume
    730740</A>
    731741Linear Algebra Tcl Package,
    732 <A HREF="www.hume.com">
     742<A HREF="http://www.hume.com/la/la.html">
    733743La</A>,
    734744is used by the BKGEDIT
     
    739749should not happen, since the package is included with the EXPGUI files.
    740750So if get this error you probably have an incomplete installation.
    741 Note that the La package requires Tcl/Tk version 8.1 or higher, so that if
    742 you are using an older version of Tcl/Tk, you will need to upgrade.
    743 See the installation instructions for
    744 <A HREF="expgui_Win_readme.html">Windows</A>,
    745 and for
    746 <A HREF="expgui_Unix_readme.html">UNIX</A> for more information on Tcl/Tk.
     751</UL>
     752
     753<A name=winexec>
     754<H3>
     755WINEXEC</H3>
     756<UL>
     757The WINEXEC package was needed under Windows-95 and its offspring
     758(-98 and -ME). It was found in older versions of EXPGUI, but is no
     759  longer included.
    747760</UL>
    748761
     
    750763Acknowledgments</H2>
    751764Praise to Larson and
    752 Von Dreele for GSAS, <A HREF="http://www.scriptics.com/">Ousterhout</A>
     765Von Dreele for GSAS, <A HREF="http://home.pacbell.net/ouster/">John Ousterhout</A>
    753766for Tcl/Tk,
    754 Przemek Klosowski</A>
     767Przemek Klosowski
    755768for convincing me to learn Tcl/Tk
    756 and Jonathan Wasserman for helping get this project started.
    757 Thanks also to
     769and Jonathan Wasserman for helping me get this project started.
     770Thanks also to
     771Charles Lake of Indiana University of PA for working on many recent additions to EXPGUI, including the
     772bond-distance restraints module and the (soon to come) rigid body editor;
    758773Pamela Whitfield of the NRC (Canada) for writing large
    759774sections of the
     
    763778code and to John Cowgill for the "Export to GRACE" code.
    764779<P>
    765 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">
     780<A Href="https://subversion.xor.aps.anl.gov/trac/EXPGUI/wiki/GSASIntro">
    766781GSAS</A>
    767782is written by Allen C. Larson and Robert B. Von Dreele while at
     
    770785<A HREF="MAILTO:vondreele@anl.gov">vondreele@anl.gov</A>
    771786EXPGUI was written by Brian H. Toby while at the NIST Center for Neutron Research,
    772 <A HREF="MAILTO:Brian.Toby@ANL.GOV">Brian.Toby@ANL.GOV</A>
    773 with help from Jonathan Wasserman.
     787<A HREF="MAILTO:Brian.Toby@ANL.GOV">Brian.Toby@ANL.GOV</A>.
    774788
    775789<P><hr><blockquote>
     
    786800software.
    787801
    788 <P>The author of EXPGUI is a U.S. Government employee which means that
     802<P>EXPGUI was written by a U.S. Government employee, which means that
    789803EXPGUI is not subject to copyright. Have fun with it. Modify it. Please write
    790804new sections and make them available to the rest of the world.
     
    793807expressed or implied, or assumes any liability or responsibility
    794808for the use of this information or the software described
    795 here. Brand names cited herein are used for
    796 identification purposes and do not constitute an endorsement by NIST.
     809here.
    797810</blockquote>
    798811
  • branches/sandbox/doc/expgui_intro.html

    r971 r1115  
    7070Customization notes</A>
    7171<LI>
    72 <A HREF="tutorial3/index.html">
     72<A HREF="https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial3/index.html">
    7373A well-annotated CW neutron tutorial (Alumina).</A>
    7474<B><I>A very good place to start!</I></B>
    7575<LI>
    76 <A HREF="tutorial1/index.html">
     76<A HREF="https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial1/index.html">
    7777A TOF Tutorial Example (Nickel)</A>
    7878<LI>
    79 <A HREF="tutorial2/index.html">
     79<A HREF="https://subversion.xor.aps.anl.gov/EXPGUI/tutorials/tutorial2/index.html">
    8080A CW Neutron Tutorial Example (Garnet)</A>
    8181</UL>
     
    164164<p><br><B>Who is to blame for EXPGUI?</B>
    165165<blockquote>The initial version of the GUI part of EXPGUI was created by
    166 Jonathan Wasserman (thanks Jon!) <a href="http://www.ncnr.nist.gov/staff/toby/">Brian
     166Jonathan Wasserman (thanks Jon!) Brian
    167167Toby</a> is irresponsible for the rest.</blockquote>
    168168
     
    170170<blockquote>Gee, you want to add some features... Great! You have all the
    171171EXPGUI sources and
    172 <A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">Tcl/Tk</A>
    173 is free. Oh, you want me to do it. Well, please
     172Tcl/Tk is free. Oh, you want me to do it. Well, please
    174173ask and I will try. In particular, I am looking for good ideas on
    175174how to design GUI's for different aspects of experiment editing,
     
    177176
    178177<p><br><B>Mailing List</B>
    179 <blockquote>If you would like to get news about EXPGUI, please send
    180 <a href="mailto:brian.toby@anl.gov?subject=EXPGUI Mailing List">Brian.Toby@ANL.GOV</a> e-mail. The mailing list is not active at present, but
    181 I hope to use it again to provide
     178<blockquote>If you would like to get news about EXPGUI, please
     179<a href="http://www.aps.anl.gov/mailman/listinfo/expgui">see this
     180link</a>.
     181The mailing list is used only to provide
    182182information about updates and bug fixes.
    183183</blockquote>
  • branches/sandbox/expgui

    r1112 r1115  
    1 #!/bin/sh
     1#!/bin/sh 
    22# the next line restarts this script using wish found in the path\
    33exec wish "$0" "$@"
     
    157157# setup DISAGL viewer & editor
    158158source [file join $expgui(scriptdir) disagledit.tcl]
    159 source [file join $expgui(scriptdir) geo_viewer.tcl]
     159source [file join $expgui(scriptdir) Geo_Viewer.tcl]
    160160#---------------------------------------------------------------------------
    161161# override options with locally defined values
     
    406406    # start checking for external changes
    407407    afterawhile
     408    # check if the file seems corrupt
     409    set warnings [ScanEXPforError]
     410    if {$warnings != ""} {
     411        ExplainEXPerror . $warnings $expfile
     412    }
    408413}
    409414
     
    548553        set expgui(curhist) {}
    549554    }
    550     if {[CountHistory] > 100} {
    551         DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"
    552     }
     555#    if {[CountHistory] > 100} {
     556#       DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"
     557#    }
    553558}
    554559
     
    45194524update
    45204525SetStartPanel
    4521 if {[CountHistory] > 200} {
    4522     DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"
    4523 }
     4526#if {[CountHistory] > 200} {
     4527#    DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"
     4528#}
  • branches/sandbox/gsascmds.tcl

    r1036 r1115  
    10261026            }
    10271027        }
    1028         # so sorry, have to use Internet Explorer
     1028        # so sorry, have to use Safari, even if not default
    10291029        set url [file nativename $url]; # replace ~/ if present
    10301030        if {[file pathtype $url] == "relative"} {
    10311031            set url [file join [pwd] $url]
    10321032        }
    1033         exec osascript -e "tell application \"Internet Explorer\"\rGetURL \"file://$url\"\rend tell"
     1033        exec osascript -e "tell application \"Safari\" to open location \"file://$url\""
    10341034    } elseif {$tcl_platform(platform) == "unix"} {
    10351035        set browserlist {}
     
    26962696    return
    26972697}
     2698
     2699proc ScanEXPforError {"ns {}"} {
     2700    # record types to ignore
     2701    set ignorelist {DESCR HSTRY PNAM HNAM "REFN STATS"}
     2702    set warn {}
     2703    set badkeylist {}
     2704    # scan file for warnings
     2705    foreach key [array names ${ns}::exparray] {
     2706        if {[string first "***" [set ${ns}::exparray($key)]] != -1 ||
     2707            [string first "nan" [set ${ns}::exparray($key)]] != -1 ||
     2708            [string first "NAN" [set ${ns}::exparray($key)]] != -1
     2709        } {
     2710            #puts [set ${ns}::exparray($key)]
     2711            set OK 0
     2712            foreach i $ignorelist {
     2713                if {[string first $i $key] != -1} {
     2714                    set OK 1
     2715                    break
     2716                }
     2717            }
     2718            # ignore atom name section of Atom records
     2719            if {(! $OK) && [string match  "CRS*AT*A" $key]} {
     2720                foreach str [list [string range [set ${ns}::exparray($key)] 0 49]
     2721                             [string range [set ${ns}::exparray($key)] 58 end]] {
     2722                    if {[string first "***" $str] || [string first "nan" $str] || [string first "NAN" $str]} {
     2723                        append warn "  Record \"$key\": [set ${ns}::exparray($key)]\n"
     2724                        lappend badkeylist $key
     2725                        break
     2726                    }
     2727                }
     2728                continue
     2729            }
     2730            if {! $OK} {
     2731                append warn "  Record \"$key\": [set ${ns}::exparray($key)]\n"
     2732                lappend badkeylist $key
     2733            }
     2734        }
     2735    }
     2736    if {$warn == ""} return
     2737    set hint ""
     2738    set unknown ""
     2739    foreach key $badkeylist {
     2740        if {[string match  "CRS*AT*" $key]} {
     2741            if {[string first "atomic parameter" $hint] == -1} {
     2742                append hint "\t* An atomic parameter (coordinate, occupancy or U) appears out of range\n"
     2743            }
     2744        } elseif {[string match  "CRS*ABC*" $key] ||
     2745                  [string match  "CRS*ANGLES*" $key] ||
     2746                  [string match  "CRS*CELVOL*" $key]} {
     2747            if {[string first "cell parameter" $hint] == -1} {
     2748                append hint "\t* A unit cell parameter appears out of range\n"
     2749            }
     2750        } elseif {[string match  "CRS*ODF*" $key]} {
     2751            if {[string first "spherical harmonic" $hint] == -1} {
     2752                append hint "\t* A spherical harmonic (ODF) parameter appears out of range\n"
     2753            }
     2754        } elseif {[string match  "HST*ICONS" $key]} {
     2755            if {[string first "diffractometer constant" $hint] == -1} {
     2756                append hint "\t* A diffractometer constant (wave, DIFC,...) appears out of range\n"
     2757            }
     2758        } elseif {[string match  "HST*TRNGE" $key]} {
     2759            if {[string first "histogram data range" $hint] == -1} {
     2760                append hint "\t* A histogram data range value appears out of range\n"
     2761            }
     2762        } elseif {[string match "*GNLS  RUN*" $key] ||
     2763                  [string match "*GNLS SHFTS" $key] ||
     2764                  [string match "HST*RPOWD" $key] ||
     2765                  [string match " REFN RPOWD " $key] ||
     2766                  [string match " REFN GDNFT " $key]
     2767              } {
     2768            if {[string first "refinement statistics" $hint] == -1} {
     2769                append hint "\t* The refinement statistics imply the last refinement diverged\n"
     2770            }
     2771        } else {
     2772            lappend unknown $key
     2773        }
     2774    }
     2775    if {$unknown != ""} {
     2776        append hint "\t* The following less common problem record(s) appear out of range:\n\t\t"
     2777        foreach key $unknown {
     2778            append hint "\"" [string trim $key] "\" "
     2779        }
     2780    }
     2781    return "Likely error(s) noted:\n$hint\nDetails of problem(s):\n$warn"
     2782}
     2783
     2784proc ExplainEXPerror {parent message file} {
     2785    if {$parent == "."} {
     2786        set w .experr
     2787    } else {
     2788        set w $parent.experr
     2789    }
     2790    catch {destroy $w}
     2791    toplevel $w -class Dialog
     2792    wm title $w "Corrupt .EXP file"
     2793    wm iconname $w Dialog
     2794    wm protocol $w WM_DELETE_WINDOW { }
     2795    # Make the message box transient if the parent is viewable.
     2796    if {[winfo viewable [winfo toplevel $parent]] } {
     2797        wm transient $w $parent
     2798    }
     2799    frame $w.bot
     2800    pack $w.bot -side bottom -fill both
     2801    frame $w.top
     2802    pack $w.top -side top -fill both -expand 1
     2803    frame $w.msg
     2804    pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
     2805    set txt {Likely errors were noted when reading this file}
     2806    append txt " ([file tail $file]). "
     2807    append txt "These problems probably\narose from the last refinement, "
     2808    append txt "based on settings applied in the previous saved file.\n"
     2809    append txt "It is probably not possible to continue with this file.\n"
     2810    append txt "You likely need to revert at least two archived versions back."
     2811    grid [label $w.msg.s -text $txt -justify left] -row 0 -column 0 -sticky nws
     2812    grid [button $w.msg.1 -text Help -bg yellow \
     2813              -command "MakeWWWHelp expgui.html badexp"] -row 0 -column 1 -columnspan 2 -sticky ne
     2814    bind $w <Key-F1> "MakeWWWHelp expgui.html badexp"
     2815    set filelist [lsort -dictionary -decreasing \
     2816                      [glob -nocomplain \
     2817                           [file root $file.O* ]]]
     2818    grid [text  $w.msg.t -font {Times 12} \
     2819              -height 10 -width 90 -relief flat -wrap word \
     2820              -yscrollcommand "$w.msg.rscr set" \
     2821             ] -row 1 -column 0  -columnspan 2 -sticky news
     2822    grid [scrollbar $w.msg.rscr  -command "$w.msg.t yview" \
     2823             ] -row 1 -column 2 -sticky ns
     2824    # give extra space to the text box
     2825    grid columnconfigure $w.msg 0 -weight 1
     2826    grid rowconfigure $w.msg 1 -weight 1
     2827    $w.msg.t insert end $message
     2828    button $w.ok -command [list destroy $w] -text OK -default active
     2829    pack $w.ok -in $w.bot -side left -expand 1 -padx 3m -pady 2m
     2830    putontop $w
     2831    tkwait window $w
     2832    afterputontop
     2833}
     2834
    26982835proc UpdateInfoBox {} {
    26992836    global expgui
     
    27022839    set file [file join [set expgui(FileMenuDir)] $expgui(FileMenuEXPNAM)]
    27032840    if [file isdirectory $file] return
    2704     if [file exists $file] {
     2841    if [file exists $file] {   
    27052842        pack [label $expgui(FileInfoBox).1 -text $expgui(FileMenuEXPNAM)] \
    27062843                -side top
    27072844        catch {
     2845            # load the EXP file into a namespace & scan for errors
     2846            expload $file scan
     2847            set warnings [ScanEXPforError scan]
     2848            if {$warnings != ""} {
     2849                pack [frame $expgui(FileInfoBox).1a -bg yellow -padx 4 -pady 4] -side top
     2850                pack [label $expgui(FileInfoBox).1a.err -justify left \
     2851                          -text "WARNING: Likely corrupt" -bg yellow] \
     2852                    -side left -anchor w -fill both
     2853                pack [button $expgui(FileInfoBox).1a.show \
     2854                          -text "More..." -padx 0 \
     2855                          -command "ExplainEXPerror $expgui(FileInfoBox) [list $warnings] $file"\
     2856                         ] -side right -anchor w
     2857            }
    27082858            set fp [open $file r]
    27092859            global testline
     
    27162866                    -text "last GENLES run:\n  $last\n  total cycles: $cycles"] \
    27172867                -side top -anchor w
     2868            set chi2 ?
     2869            set vars ?
    27182870            regexp {REFN GDNFT.*= *([0-9]*\.[0-9]*) +for *([0-9]+) variables} \
    27192871                    $testline a chi2 vars
     
    27542906                    -text $lbl] \
    27552907                    -side top -anchor w     
    2756         }
     2908        } err
    27572909    }
    27582910}
     
    28643016        if {$expgui(expfile) == [file join $expgui(FileMenuDir) $file]} {
    28653017            $files selection set $i
     3018            set expgui(FileMenuEXPNAM) $file
     3019            UpdateInfoBox
    28663020        }
    28673021    }
  • branches/sandbox/readexp.tcl

    r1109 r1115  
    99# returns 1 if the file is 80 char/line + cr/lf
    1010# returns 2 if the file is sequential but not fixed-record length
    11 proc expload {expfile} {
    12     global exparray tcl_platform
    13     # $expfile is the path to the data file.
    14 
     11proc expload {expfile "ns {}"} {
     12    # expfile is the path to the data file.
     13    # ns is the namespace to place the output array (default is global)
     14    if {$ns != ""} {
     15        namespace eval $ns {}
     16    }
    1517    if [catch {set fil [open "$expfile" r]}] {
    1618        tk_dialog .expFileErrorMsg "File Open Error" \
     
    2729    }
    2830    catch {
    29         unset exparray
     31        unset ${ns}::exparray
    3032    }
    3133    if {$len > 160} {
     
    3941            incr i2 80
    4042            set key [string range $nline 0 11]
    41             set exparray($key) [string range $nline 12 end]
     43            set ${ns}::exparray($key) [string range $nline 12 end]
    4244        }
    4345    } else {
     
    4547        while {$len > 0} {
    4648            set key [string range $line 0 11]
    47             set exparray($key) [string range $line 12 79]
     49            set ${ns}::exparray($key) [string range $line 12 79]
    4850            if {$len != 81 || [string range $line end end] != "\r"} {set fmt 2}
    4951            set len [gets $fil line]
Note: See TracChangeset for help on using the changeset viewer.