Changeset 1157
- Timestamp:
- Jul 26, 2011 12:47:57 PM (10 years ago)
- Location:
- branches/sandbox
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sandbox/addcmds.tcl
r1150 r1157 709 709 # mode must be t-max or 2theta, at least for now 710 710 if {$newhist(LimitMode) != 1} return 711 # is a instrument parameter file loaded? If not, try again later712 if {[string trim $newhist(instfile)] == ""} return713 711 # get data bank number, test if valid 714 712 set num $newhist(banknum) 715 713 if {[catch {expr $num}]} {return} 716 714 if {$newhist(insttype) == "TOF"} { 715 # is a instrument parameter file loaded? If not, try again later 716 if {[string trim $newhist(instfile)] == ""} return 717 717 set newhist(2tLimit) [expr {$newhist(tmin$num) / 10.}] 718 718 # at Ashfia's request, override the bank header # with the -
branches/sandbox/doc/expgui.html
r1150 r1157 500 500 501 501 The INSTEDIT utility is used to edit or create an instrument parameter file. 502 At this time it can only be used to edit files for 503 constant-wavelength data. The utility can be started from the "Edit File" 504 button in the 502 The utility can be started from the "Edit File" button in the 505 503 <A HREF="expgui3.html#AddHist">"Add New Histogram"</A> dialog, or from the 506 the "instedit" option in the Powder menu. In the latter case, the user 507 is given the chance to select an input file. If no file is selected, 508 a new, empty, file is created. An example INSTEDIT window appears below. 504 the "instedit" option in the Powder menu. Alternately, to create a new 505 instrument parameter file, choose Powder menu option "New InstParm 506 file". (It is also possible 507 to create a new file using the standard instedit by selecting 508 "Cancel" when asked for an input file.) 509 An example INSTEDIT window appears below. 509 510 <P> 510 511 <img SRC="instedit1.gif" align=RIGHT alt="EXPGUI Screen snapshot"> … … 618 619 records can slow the GSAS programs 619 620 (this is less of a problem on faster computers). For these reasons, it may be 620 a good idea to prune the older history records from the file. If more than 100 621 history records are found in an experiment file, EXPGUI suggests that the 622 older history entries be deleted. Alternately the File/EraseHistory command 623 can be used to invoke the this option. 621 a good idea to prune the older history records from the file. 622 The File/EraseHistory command can be used to invoke the this option. 624 623 <P> 625 624 On the dialog the number of history records to be retained is specified. -
branches/sandbox/doc/expguic.html
r971 r1157 49 49 experiment file from scratch. 50 50 <DT>expnam<DD> 51 Equivalent to Open , included since this is the command used in other52 GSAS shells to select GSAS experiments. 51 Equivalent to Open (included for historical reasons.) 52 53 53 <DT>Save<DD>Saves modifications to the current experiment file to disk (shortcut Alt-S). 54 54 <DT>Save As<DD>Saves modifications to the current experiment file to disk … … 60 60 offers the program user the option to update these files. The update 61 61 will fail if the user does not have permission to change the EXPGUI 62 or GSAS files. In this case, a system administrator may be needed. 62 or GSAS files. In this case, a system administrator may be needed. 63 <DT>revert<DD>Used to load an <a href="#archive">archived</A> 64 (backup) version of the current .EXP file. 63 65 <DT>EraseHistory<DD>Deletes old history records to speed reading of the .EXP file. 64 <DT>convert<DD>Convert a standard ASCII file to the direct access format used by GSAS (and for UNIX, the reverse) 66 <DT>convert<DD>Convert a standard ASCII file to the direct access 67 format used by GSAS (and for UNIX, the reverse) -- this is not 68 likely to be needed, as GSAS now does most conversions automatically. 65 69 <DT>exit<DD>Exit EXPGUI (shortcut Alt-X or ^C) 66 70 </DL> … … 99 103 revised .EXP file, which means that you reject the last set of changes. 100 104 This is useful if 101 GENLES blows up or you have done something wrong. The advantage102 ofturning "autoload EXP" on is105 GENLES blows up or you have done something wrong. The reason to 106 turning "autoload EXP" on is 103 107 that there is one less thing to do when running GSAS programs. 104 108 Note that it is still possible to reverse changes, if 105 <a href="#archive">archive files</A>, but this may require more effort.106 109 <a href="#archive">archive files</A>, but this may require more 110 effort. See the File/revert menu entry. 107 111 <a name="execprompt"></a> 108 112 <DT>Prompt after GSAS run<DD> … … 121 125 screen cluttered with EXPGUI when it can't be used, 122 126 but this is an option so that the mode can be turned off by those people 123 who find this behavior annoying. 127 who find this behavior annoying. It appears this option causes 128 problems on Windows 7. 124 129 125 130 <a name="AutostartGRWND"></a> … … 225 230 <DT>rawplot<DD>Plot powder data 226 231 <DT>fitspec<DD>Fit a TOF vanadium scattering spectrum 227 <DT>tofnorm<DD>Normalize a TOF spectrum228 232 <DT><a HREF="liveplot.html#bkgedit">bkgedit</a> 229 233 <DD>Invokes the <a HREF="liveplot.html#bkgedit">BKGEDIT</a> program … … 233 237 to set the upper and lower limits for a histogram, as well as 234 238 edit excluded regions. 239 <DT>seqgsas<DD>Invokes the sequential GSAS refinement program to run 240 GENLES on a set of very similar data files. 241 <DT>mustrplot<DD>Plot microstrain results 242 <DT><a HREF="expgui.html#INSTEDIT">instedit</A><DD>Invokes the <a HREF="expgui.html#INSTEDIT">instedit</A> 243 to edit an instrument parameter file. 244 <DT>New InstParm file<DD>Creates a new instrument parameter file using 245 <a HREF="expgui.html#INSTEDIT">instedit</A>. 246 247 235 248 </DL> 236 249 <img SRC="m3.gif" BORDER=3 alt="EXPGUI Screen snapshot"> … … 238 251 239 252 <a name="4"></a> 240 <h3>C.4 Single CrystalMenu</h3>253 <h3>C.4 Xtal (Single Crystal) Menu</h3> 241 254 <BLOCKQUOTE> 242 255 This menu contains links to GSAS programs used for … … 268 281 <DT>fourier<DD>Generate Fourier map 269 282 <DT>forsrh<DD>Search Fourier map for peaks 283 <DT>gsas2map<DD>Exports a Fourier map in formats used by other 284 programs (for example Fox and DRAWxtl). 270 285 <DT><a HREF="liveplot.html#liveplot">liveplot</a> 271 286 <DD>Invokes the <a HREF="liveplot.html#liveplot">LIVEPLOT</a> program … … 274 289 <DT>vrstplot<DD>Create a VRML 3-D file for viewing with 3rd party software 275 290 <DT>widplt<DD>Displays the FWHM as a function of Q, 2Theta,... for UVWXY values input or read from an EXP file 291 <DT><a HREF="expgui.html#ABSPLT">absplt</A> 292 <DD>The <a HREF="expgui.html#ABSPLT">absplt</A> program displays the 293 absorption/reflectivity correction curve for values used in a histogram. 294 <DT>mustrplot<DD>Plot microstrain results 295 <DT>seqplot<DD>Plot results from seqgsas 276 296 </DL> 277 297 <img SRC="m5.gif" BORDER=3 alt="EXPGUI Screen snapshot"> … … 287 307 <DT>bijcalc<DD>Thermal parameter analysis 288 308 <DT>disagl<DD>Distance/angle calculations 309 <DT>disaglviewer<DD>Display results from distance/angle calculations 310 in a graphical browser. 289 311 <DT>reflist<DD>List reflection data 290 312 <DT>geometry<DD>Molecular geometry calculations … … 297 319 <DT>ramafit<DD>Fits torsion angle distributions, particularly in peptide 298 320 chains, for use in restraints. 321 <DT>seqplot<DD>Plot results from seqgsas 299 322 </DL> 300 323 <img SRC="m6.gif" BORDER=3 alt="EXPGUI Screen snapshot"> … … 307 330 <DL> 308 331 <DT>cllchg<DD>Transform unit cell 309 <DT>fprime<DD>Compute f, f', f'' and mu/rho for an element for a range of x-ray wavelengths 332 <DT>composition<DD>Computes the chemical composition of a unit cell 333 accounting for site multiplicies and occupancies 310 334 <DT>rducll<DD>Unit cell reduction 311 335 <DT>spcgroup<DD>Space group symbol interpreter 336 <DT>seqgsas<DD>Invokes the sequential GSAS refinement program to run 337 GENLES on a set of very similar data files. 338 <DT>seqplot<DD>Plot results from seqgsas 312 339 <DT>unimol<DD>Unique molecule assembler 313 340 </DL> … … 315 342 </BLOCKQUOTE> 316 343 317 <a name="8"></a>318 <h3>C.8 Import/Export Menu</h3>319 <BLOCKQUOTE>320 This menu contains utilities for importing information into GSAS and321 exporting.322 <DL>323 <DT>exp2xtl<DD>Prepare a .XTL format file of atomic positions. This324 file is used in MSI software such as Cerius and InsightII.325 <DT>gsas2cif<DD>Prepare IUCr crystallographic information (CIF) file326 <DT>hklsort<DD>Prepare HKL tables327 <DT>pubtable<DD>Prepare atom parameter tables328 <DT>convert<DD>Convert a standard ASCII file to the direct access format used by GSAS (and for UNIX, the reverse)329 <DT>cad4rd<DD>Prepare CAD4 single crystal data330 <DT>dbwscnv<DD>Convert a powder diffraction data file from DBWS format331 <DT>x17bcnv<DD>Convert an energy dispersive diffractogram data file from NSLS X17b332 <DT>p3r3data<DD>Prepare Siemens/Brucker P3R3 single crystal data333 <DT>sxtldata<DD>Prepare generic single crystal data334 <DT>gsas2pdb<DD>335 Import (using GSAS2PDB & EXPEDT) and export coordinates (for336 macromolecular phases) to/from Protein Data Base files337 <DT>ref2asc<DD>338 Exports a GSAS reflection file to ASCII for use in non-GSAS programs339 <DT>ref2bin<DD>340 Imports an ASCII reflection file to the GSAS binary format341 </DL>342 <img SRC="m8.gif" BORDER=3 alt="EXPGUI Screen snapshot">343 </BLOCKQUOTE>344 345 344 <a name="9"></a> 346 <h3>C. 9Macro Menu345 <h3>C.8 Macro Menu 347 346 <IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!"> 348 347 </h3> … … 402 401 </DL> 403 402 </BLOCKQUOTE> 403 404 <a name="8"></a> 405 <h3>C.9 Import/Export Menu</h3> 406 <BLOCKQUOTE> 407 This menu contains utilities for importing information into GSAS and 408 exporting it to other programs. 409 <DL> 410 <DT>Coord Export<DD>This provides a series of routines that are used 411 to write coordinates and possibly other information to files:<P> 412 <DL> 413 <DT>gsas2cif<DD>Prepares IUCr crystallographic information (CIF) file 414 that documents the current refinement. The CIF contains the 415 coordinates for all phases as well as the observed and computed 416 diffraction patterns. The templates used by GSAS2CIF can be customized 417 to provide a detailed description of the experimental measurements and 418 results for use in documenting analysis for publication or 419 deposition. 420 <DT>coords-only CIF<DD>For export of intermediate results to another 421 program, CIF can be a useful exchange format. This routine provides a 422 CIF with the current coordinates from one phase and not much else. 423 <DT>export to DRAWxtl<DD>This writes a .STR file used in the DRAWxtl 424 program and optionally launches DRAWxtl. 425 <DT>export to SHELX<DD>This writes coordinates for a selected phase in 426 the .INS format used by SHELX and several other programs. 427 <DT>export to PLATON<DD>This writes coordinates for a selected phase in 428 the .SPF format used by PLATON 429 <DT>export test format<DD>This demonstrates how a coordinate export 430 routine can be added to EXPGUI. See the <A 431 HREF="expgui_cfg.html#export">documentation on this</A> for further 432 information. 433 <DT>export to FOX<DD>This prepares a XML file with coordinates for use 434 in the FOX program 435 <DT>MSI .xtl<DD>Prepare a .XTL format file of atomic positions. This 436 file is used in older Accelrys software such as Cerius and 437 Insight-II. It may no longer be of value. 438 </DL> 439 440 <DT>CIF Export<DD>This provides a series of routines that are used 441 to prepare CIF files:<P> 442 <DL> 443 <DT>gsas2cif<DD>Prepares IUCr crystallographic information (CIF) file 444 that documents the current refinement. The CIF contains the 445 coordinates for all phases as well as the observed and computed 446 diffraction patterns. The templates used by GSAS2CIF can be customized 447 to provide a detailed description of the experimental measurements and 448 results for use in documenting analysis for publication or 449 deposition. 450 <DT>FillTemplate<DD>Used to edit the CIF template files used in GSAS2CIF 451 <DT>CIFselect<DD>Used to select interatomic distances and angles to be 452 included in the CIF created by GSAS2CIF. 453 </DL> 454 455 <DT>hklsort<DD>Prepare HKL tables 456 <DT>pubtable<DD>Prepare atom parameter tables 457 <DT>convert<DD>Convert a standard ASCII file to the direct access format used by GSAS (and for UNIX, the reverse) 458 <DT>cad4rd<DD>Prepare CAD4 single crystal data 459 <DT>dbwscnv<DD>Convert a powder diffraction data file from DBWS format 460 <DT>x17bcnv<DD>Convert an energy dispersive diffractogram data file from NSLS X17b 461 <DT>p3r3data<DD>Prepare Siemens/Brucker P3R3 single crystal data 462 <DT>sxtldata<DD>Prepare generic single crystal data 463 <DT>gsas2pdb<DD> 464 Import (using GSAS2PDB & EXPEDT) and export coordinates (for 465 macromolecular phases) to/from Protein Data Base files 466 <DT>ref2asc<DD> 467 Exports a GSAS reflection file to ASCII for use in non-GSAS programs 468 <DT>ref2bin<DD> 469 Imports an ASCII reflection file to the GSAS binary format 470 <DT>gsas2map<DD>Exports a Fourier map in formats used by other 471 programs (for example Fox and DRAWxtl). 472 </DL> 473 <img SRC="m8.gif" BORDER=3 alt="EXPGUI Screen snapshot"> 474 </BLOCKQUOTE> 475 404 476 <hr> 405 477 <TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT> -
branches/sandbox/doc/liveplot.html
r1150 r1157 40 40 <P> 41 41 Both LIVEPLOT and BKGEDIT get the current diffraction information 42 by running the GSAS TCLDUMP program, if installed, or 43 the GSAS HSTDUMP otherwise. The TCLDUMP program has been optimized for use 44 with LIVEPLOT and allows LIVEPLOT to offer a number of extra 45 options that are not available when HSTDUMP is used. Since TCLDUMP has been 46 included in GSAS since April of 2000, the following documentation assumes 47 that TCLDUMP is installed. 42 by running the GSAS TCLDUMP program. (In GSAS/EXPGUI before 2001, the 43 GSAS HSTDUMP program was used, which was less powerful. This code has 44 not been removed, but will not be used if TCLDUMP is present.) 48 45 49 46 <a name="liveplot"></a> … … 54 51 Some of the features available in LIVEPLOT are: 55 52 <UL> 56 <LI>The plot is updated automatically after each refinement run 53 <LI><IMG SRC="new.gif" alt="New!"> 54 Regions of the plot can be magnified to show more detail, for example 55 in regions at high Q. 56 <LI><IMG SRC="new.gif" alt="New!"> 57 Plots can be <a href="#export">exported to obtain publication-quality 58 graphics </a> -- <B><I>now on all platforms</I></B>. 59 <LI><IMG SRC="new.gif" alt="New!"> Intensity can be displayed as I/sigma(I) 60 <LI>The plot is updated automatically after each refinement run 57 61 <LI>The plot can be "zoomed-in", by clicking on the corners of the 58 62 area to be magnified and "zoomed-out" using the … … 61 65 The units used for plotting histograms can be selected. Choices are: 62 66 native units (2Theta/TOF/KeV); d-space (A) or Q (A<sup>-1</sup>) 63 <LI><IMG SRC="new.gif" alt="New!"> 64 Regions of the plot can be magnified to show more detail, for example 65 in regions at high Q. 66 <LI> 67 The background (fixed plus fitted) can be plotted or can be subtracted. 67 <LI> 68 The background (fixed plus fitted) can be plotted or can be subtracted. 68 69 <LI> 69 70 Reflection tickmarks can be displayed in a variety of formats … … 79 80 <LI> 80 81 The cursor position can be displayed 81 <LI>82 Plots can be <a href="#export">exported to obtain publication-quality83 graphics.</a>84 82 </UL> 85 83 … … 393 391 <B>Export plot options</B> 394 392 <UL><LI> 395 The plot can be exported to 393 <IMG SRC="new.gif" alt="New!"> 394 The LIVEPLOT program can export plots to to a <I>high quality</I> PDF 395 file for presentations or publications using <A 396 HREF="http://www.gnuplot.info/">gnuplot</A>. 397 The PDF will match what is is shown on fairly 398 closely with respect to colors, <A href="#plotfont">font sizes</a> 399 and <a href="#zoom">zoom</a>. The new <A href="#magnification">plot magnification</a> to show detail in 400 the fit and for publication increase the 401 <A href="#plotfont">plot font</a> so that the figure size can be 402 reduced to the standard Rietveld postage stamp, required by so many 403 Journals -- allowing the text to be discerned, even if the problems in the 404 fit cannot. 405 <P>Starting August 406 2011, windows and Mac versions of gnuplot are included with the GSAS 407 binaries; gnuplot is easily 408 installed on Linux with standard tools such as yum (Redhat), 409 apt-get (ubuntu) or zypper (openSuse). 410 411 <P><LI> The plot can be exported to 396 412 <A HREF="http://plasma-gate.weizmann.ac.il/Grace/">Grace</A>, WYSIWYG 2D plotting tool for X-Windows 397 that produces publication-quality graphics . Many UNIX users know398 this program under a previous name, xmgr. 399 The export is implemented 400 by producing an ASCII file with instructions that 401 creates a plot with similar formatting to what appears on the402 screen in LIVEPLOT/BKGEDIT. However, the output quality from 403 Grace is much higher quality. Further, Grace 404 can be used to enhanced and annotate the plot further.405 <LI>413 that produces publication-quality graphics that appear very similar to 414 what is seen in LIVEPLOT/BKGEDIT. Further, Grace 415 can be used to enhance the plot, for example by editing captions, 416 figure display options and even annotate the plot. 417 Grace runs well on Linux and Mac computers; Many UNIX users know 418 this program under a previous name, xmgr. 419 For Windows, 420 installation of <A HREF="http://cygwin.com/">Cygwin</A> is required. 421 <P><LI> 406 422 For use in many other graphics programs, LIVEPLOT will produce a 407 423 "comma separated variable" data file with the data displayed on the screen. … … 409 425 set line styles and scaling, etc., but this does provide an option for 410 426 generating high-quality graphics for presentations and publications. 411 < LI>LIVEPLOT will produce PostScript versions of the plot on the screen,427 <P><LI>LIVEPLOT will produce PostScript versions of the plot on the screen, 412 428 but the quality is rather low (this is a limitation of the BLT graphics 413 429 package). 430 <P><LI>LIVEPLOT/BKGFIT can also be used to prepare input for FOX (Free 431 Objects for Xtallography). 432 414 433 </UL> 415 434 … … 468 487 <DT>Export Plot 469 488 <DD>This offers options for exporting the plot in multiple formats. 470 I am hoping to add more export formats eventually. 471 <DL><DL> 489 <DL><DL> 490 <DT>to PDF 491 <IMG SRC="new.gif" alt="New!"> 492 <DD>Creates a <I>high quality</I> PDF file that may be useful for 493 presentations or publications. Note that you may wish to use 494 <A href="#magnification">plot magnification</a> to show detail in 495 the fit and for publication increase the 496 <A href="#plotfont">plot font</a> so that the figure size can be 497 reduced. 498 472 499 <DT>to PostScript 473 500 <DD>Creates a <I>low quality</I> PostScript file containing the LIVEPLOT … … 476 503 On Windows, a program such ghostview may be needed to translate the 477 504 PostScript to a format that can be viewed or printed. 478 <A name="grace"> 505 506 <A name="grace"> 479 507 <DT>to Grace 480 508 <IMG SRC="note.gif" alt="Note!"> … … 484 512 After the plot is exported, it can be further 485 513 enhanced and annotated in grace. 514 515 <DT>to .csv file 516 <DD>Creates a "comma separated variable" file. This contains all the 517 diffraction data shown in the plot. It can be used to produce a plot 518 in some other graphics program. 519 <DT>Fox XML 520 <DD>The Fox program provides structure solution capabilities. This 521 option can be used to write data in the XML format that Fox uses. 486 522 </DL></DL> 487 523 <DT>Quit … … 535 571 <DT>Y units 536 572 <DD>The intensity values can be normalized by the incident spectrum 537 (for energy dispersive methods). 573 (for energy dispersive methods) or 574 <IMG SRC="new.gif" alt="New!"> can be displayed as a ratio with the 575 experimental uncertainty [I<sub>obs</sub>/sigma(I<sub>obs</sub>), 576 I<sub>calc</sub>/sigma(I<sub>obs</sub>) and their difference]. 538 577 </DL></DL> 539 578 <br clear=all> … … 565 604 <DT>Set screen font 566 605 <DD>This option is used to control the font used for menus, graphics and 567 other aspects of windows. 606 other aspects of windows. This value can be saved as a default value. 607 <A name="plotfont"> 608 <DT>Set plot font 609 <DD>This option is used to change the font used in the plot 610 window. This has a similar effect to changing the screen font, but 611 can be changed over a wider range and only affects the 612 graph. Changing the font size either way will change the font used 613 in the exported .PDF. 568 614 <DT>Raise on update 569 615 <DD>This causes the plot to be placed on top of other windows, if partially -
branches/sandbox/expgui
r1152 r1157 4448 4448 } 4449 4449 } 4450 $expgui(fm).powder.menu add command -label "New InstParm file" -command {EditInstFile (new)} 4450 4451 4451 4452 # Macro menu -
branches/sandbox/gsasmenu.tcl
r1036 r1157 26 26 bkgedit 27 27 excledt 28 instedit29 28 seqgsas 30 29 mustrplot 30 instedit 31 31 } 32 32 xtal { … … 58 58 cllchg 59 59 composition 60 fprime61 60 hklgen 62 61 rducll … … 311 310 } 312 311 313 fprime {{runGSASprog $cmd} {314 Compute f, f', f'' and mu/rho for an element for a range of x-ray wavelengths}315 }316 317 312 dbwscnv {{runGSASprog $cmd} { 318 313 Convert a powder diffraction data file from DBWS format} … … 368 363 instedit {{EditInstFile} { 369 364 Edit an instrument parameter file} 365 } 366 {New InstParm file} {- { 367 Create a new instrument parameter file} 370 368 } 371 369 -
branches/sandbox/instedit.tcl
r991 r1157 78 78 # loop over banks 79 79 set msg {} 80 for {set i 1} {$i <= $instdat(lastbank)} {incr i} { 81 instbankinfo rad $i set $instdat(rad$i) 82 instbankinfo head $i set $instdat(head$i) 83 if {[string trim $instdat(name$i)] == ""} { 84 append msg "\n The instrument name may not be blank" 85 } 86 instbankinfo name $i set $instdat(name$i) 87 set l {} 88 foreach var {difc difa zero pola ipola kratio} { 89 lappend l $instdat(${var}$i) 90 } 91 if {[instbankinfo icons $i set $l] != 1} { 92 append msg "\n There is an error in values for:\n the wavelength, zero or polarization" 93 } 94 # loop over the profile terms 95 96 for {set j 1} {$j <= $instparms(proftypes${i})} {incr j} { 97 set l {} 98 for {set k 1} {$k <= $instparms(profterms${i}_$j)} {incr k} { 99 lappend l $instdat(prof${i}_${j}_$k) 100 } 101 if {[instprofinfo $i $j set [list \ 102 $instdat(proftype${i}_$j) $instdat(profcut${i}_$j) $l]\ 103 ] != 1} { 104 append msg "\n There is an error in the values for profile set $j." 105 } 106 } 107 if {$msg != ""} { 108 MyMessageBox -parent . -title "No save" \ 80 if {[catch { 81 for {set i 1} {$i <= $instdat(lastbank)} {incr i} { 82 instbankinfo rad $i set $instdat(rad$i) 83 instbankinfo head $i set $instdat(head$i) 84 if {[string trim $instdat(name$i)] == ""} { 85 append msg "\n The instrument name may not be blank" 86 } 87 instbankinfo name $i set $instdat(name$i) 88 set l {} 89 foreach var {difc difa zero pola ipola kratio} { 90 lappend l $instdat(${var}$i) 91 } 92 if {[instbankinfo icons $i set $l] != 1} { 93 append msg "\n There is an error in values for:\n the wavelength, zero or polarization" 94 } 95 # loop over the profile terms 96 97 for {set j 1} {$j <= $instparms(proftypes${i})} {incr j} { 98 set l {} 99 for {set k 1} {$k <= $instparms(profterms${i}_$j)} {incr k} { 100 lappend l $instdat(prof${i}_${j}_$k) 101 } 102 if {[instprofinfo $i $j set [list \ 103 $instdat(proftype${i}_$j) $instdat(profcut${i}_$j) $l]\ 104 ] != 1} { 105 append msg "\n There is an error in the values for profile set $j." 106 } 107 } 108 if {$msg != ""} { 109 MyMessageBox -parent . -title "No save" \ 109 110 -message "Error in input for bank $i:$msg" -icon warning \ 110 111 -type Sorry -default sorry 111 return 112 } 112 return 113 } 114 } 115 } errmsg]} { 116 if {$errmsg == ""} return 117 MyMessageBox -parent . -title "No save" \ 118 -message "Error in input (did you define data type, profile type, etc?):\n$errmsg" -icon warning \ 119 -type Sorry -default sorry 120 return 113 121 } 114 122 if {$filename == ""} { … … 150 158 proc instShowBank {box} { 151 159 global instdat instparms 160 set instparms(profileframe) {} 161 152 162 set topfr $box.a 153 163 if {$instparms(bank) == 0} return … … 159 169 } 160 170 if {$instparms(banklabel) == ""} { 161 puts starting162 171 return 163 172 } … … 562 571 proc AddInstProfile {box b} { 563 572 global instparms instdat 564 set frame $instparms(profileframe)565 573 incr instparms(proftypes${b}) 566 574 instShowBank $box … … 759 767 -parent $instparms(top) -defaultextension .ins \ 760 768 -filetypes {{"Instrument parameters file" ".ins .inst .prm"} {All *.*}}] 769 } elseif {$filename == "(new)"} { 770 set instparms(filename) "" 761 771 } else { 762 772 set instparms(filename) $filename -
branches/sandbox/liveplot
r1144 r1157 14 14 # process command line arguments 15 15 set exitstat 0 16 set expnam [ lindex $argv 0]16 set expnam [file root [lindex $argv 0]] 17 17 if {$expnam == ""} {catch {puts "error -- no experiment name"}; set exitstat 1} 18 18 if $exitstat { … … 20 20 exit 21 21 } 22 22 # work in .EXP directory (in case files will be exported). 23 catch { 24 cd [file dirname $expnam] 25 } 23 26 # get name of script 24 27 set expgui(script) [info script] … … 42 45 set graph(legend) [lindex $argv 2] 43 46 } 47 set plot_title "(None)" 44 48 45 49 set graph(backsub) 0 … … 79 83 set expgui(fadetime) 10 80 84 set expgui(hklbox) 1 81 set expgui(autotick) 085 set expgui(autotick) 1 82 86 set expgui(phaselabel) 0 83 87 set expgui(pixelregion) 5 … … 358 362 } 359 363 ApplyMag 360 set maxdiff [set diffvec(max)]361 set cmin [set calcvec(min)]362 set omin [set obsvec(min)]363 set cmax [set calcvec(max)]364 set omax [set obsvec(max)]365 set expgui(min) [expr {$omin < $cmin ? $omin : $cmin}]366 set expgui(max) [expr {$omax > $cmax ? $omax : $cmax}]367 set ymin1 [expr {$cmin - 1.1*$maxdiff}]368 set ymin2 [expr {$omin - 1.1*$maxdiff}]369 if {$ymin1 < $ymin2} {370 diffvec set [diffvec + $ymin1]371 } {372 diffvec set [diffvec + $ymin2]373 }374 364 plotdata 375 365 } … … 454 444 } 455 445 ApplyMag 456 global obsvec calcvec diffvec 457 set maxdiff [set diffvec(max)] 458 set cmin [set calcvec(min)] 459 set omin [set obsvec(min)] 460 set cmax [set calcvec(max)] 461 set omax [set obsvec(max)] 462 set expgui(min) [expr {$omin < $cmin ? $omin : $cmin}] 463 set expgui(max) [expr {$omax > $cmax ? $omax : $cmax}] 464 set ymin1 [expr {$cmin - 1.1*$maxdiff}] 465 set ymin2 [expr {$omin - 1.1*$maxdiff}] 466 if {$ymin1 < $ymin2} { 467 diffvec set [diffvec + $ymin1] 468 } { 469 diffvec set [diffvec + $ymin2] 470 } 471 446 plotdata 447 } 448 449 proc SetTitle {} { 450 set bx .title 451 toplevel $bx 452 wm title $bx "Edit plot title" 453 wm iconname $bx "Edit plot title" 454 grid [label $bx.txt -text "Enter plot title below"] -row 1 -column 1 455 grid [entry $bx.title -width 70] -row 2 -column 1 456 grid [frame $bx.a] -row 3 -column 1 457 grid [button $bx.a.save -text "Save" \ 458 -command "set plot_title \"\[$bx.title get\]\"; destroy $bx" \ 459 ] -row 1 -column 1 460 grid [button $bx.a.quit -text "Quit" \ 461 -command "destroy $bx" \ 462 ] -row 1 -column 2 463 putontop $bx 464 tkwait window $bx 465 afterputontop 472 466 plotdata 473 467 } … … 575 569 global expnam hst peakinfo xunits yunits cycle reflns modtime 576 570 global lasthst graph expgui box 571 global obsvec calcvec diffvec 572 573 if {$graph(yunits) == 2} { 574 set yunits {Intensity/sigma(I)} 575 wifdvec set $::weightlist 576 wifdvec expr sqrt(wifdvec) 577 obsvec set [obsvec * wifdvec] 578 calcvec set [calcvec * wifdvec] 579 bckvec set {} 580 diffvec set [obsvec - calcvec] 581 wifdvec set {} 582 $box element config 1 -label {} -line 0 -hide 1 583 } else { 584 $box element config 1 -label bckgr -line 1 -hide 0 585 } 586 587 set cmin [set calcvec(min)] 588 set omin [set obsvec(min)] 589 set cmax [set calcvec(max)] 590 set omax [set obsvec(max)] 591 set expgui(min) [expr {$omin < $cmin ? $omin : $cmin}] 592 set expgui(max) [expr {$omax > $cmax ? $omax : $cmax}] 577 593 578 594 foreach p $::expmap(phaselist) { … … 595 611 return 596 612 } 597 $box config -title "$expnam cycle $cycle Hist $hst" 613 if {$::plot_title == "(None)"} { 614 $box config -title "$expnam cycle $cycle Hist $hst" 615 } else { 616 $box config -title $::plot_title 617 } 598 618 $box xaxis config -title $xunits 599 619 $box yaxis config -title $yunits … … 625 645 calcvec notify now 626 646 bckvec notify now 627 diffvec notify now628 647 wifdvec notify now 629 648 # now deal with peaks 630 for {set i 1} {$i < 10} {incr i} { 631 if {$expgui(autotick)} { 632 set div [expr {( $expgui(max) - $expgui(min) )/40.}] 633 set ymin [expr {$expgui(min) - ($i+1) * $div}] 634 set ymax [expr {$expgui(min) - $i * $div}] 635 } else { 636 set ymin $peakinfo(min$i) 637 set ymax $peakinfo(max$i) 638 } 639 set j 0 640 if [set peakinfo(flag$i)] { 641 foreach X $reflns($i) { 642 incr j 643 catch { 644 $box marker create line -name peaks${i}_$j 645 } 646 $box marker config peaks${i}_$j -under 1 \ 647 -coords "$X $ymin $X $ymax" 648 catch { 649 $box marker config peaks${i}_$j \ 650 $graph(MarkerColorOpt) [list $peakinfo(color$i)] 651 if {$peakinfo(dashes$i) && ! $expgui(autotick)} { 652 $box marker config peaks${i}_$j -dashes "5 5" 653 } 654 } 649 #for {set i 1} {$i < 10} {incr i} 650 set k 0 651 set cmin $expgui(min) 652 foreach i $::expmap(phaselist) { 653 if {[set peakinfo(flag$i)]} { 654 incr k 655 if {$expgui(autotick)} { 656 set div [expr {( $expgui(max) - $expgui(min) )/40.}] 657 set ymin [expr {$expgui(min) - ($k+1) * $div}] 658 set ymax [expr {$expgui(min) - $k * $div}] 659 if {$cmin > $ymin} {set cmin $ymin} 660 } else { 661 set ymin $peakinfo(min$i) 662 set ymax $peakinfo(max$i) 663 } 664 set j 0 665 foreach X $reflns($i) { 666 incr j 667 catch { 668 $box marker create line -name peaks${i}_$j 669 } 670 $box marker config peaks${i}_$j -under 1 \ 671 -coords "$X $ymin $X $ymax" 672 catch { 673 $box marker config peaks${i}_$j \ 674 $graph(MarkerColorOpt) [list $peakinfo(color$i)] 675 if {$peakinfo(dashes$i) && ! $expgui(autotick)} { 676 $box marker config peaks${i}_$j -dashes "5 5" 677 } 678 } 655 679 } 656 680 catch {$box element create phase$i} 657 681 catch { 658 682 $box element config phase$i -color $peakinfo(color$i) \ 659 683 -label $graph(label$i) 660 684 } 661 685 } else { … … 664 688 } 665 689 } 690 # offset the difference pattern 691 set maxdiff [set diffvec(max)] 692 if {$expgui(autotick)} { 693 diffvec set [diffvec + [expr {$cmin - $maxdiff}]] 694 } else { 695 diffvec set [diffvec + [expr {$cmin - 1.1*$maxdiff}]] 696 } 697 diffvec notify now 698 666 699 # force an update of the plot as BLT may not 667 700 $box config -title [$box cget -title] … … 1125 1158 eval $box y2axis config $graph(ElementHideOption) 1126 1159 $box element config 0 -label "" 1160 # clear the vector 1161 wifdvec set {} 1162 wifdvec notify now 1127 1163 } 1128 1164 } … … 2049 2085 setlegend $box $graph(legend) 2050 2086 2087 set ps2pdfcmd {} 2088 set gnuplotpath {} 2089 # find gnuplot 2090 if {$::tcl_platform(platform) == "windows"} { 2091 set gnuplotpath [file join $::expgui(gsasexe) "gnuplot/gnuplot.exe"] 2092 if {![file exists $gnuplotpath]} { 2093 set gnuplotpath [auto_execok gnuplot.exe] 2094 } 2095 } else { 2096 set ::env(PATH) "${::expgui(gsasexe)}:${::env(PATH)}" 2097 auto_reset 2098 set gnuplotpath [auto_execok gnuplot] 2099 } 2100 # find postscript conversion routine 2101 if {$::tcl_platform(platform) == "windows"} { 2102 set gspath [file join $command(exedir) "gs/bin/gswin32c.exe"] 2103 if {![file exists $gspath]} { 2104 set gspath [auto_execok gswin32c.exe] 2105 } 2106 if {[file exists $gspath]} { 2107 set ps2pdfcmd "$gspath -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\"\$pdfoutname\" -c save pop -f \"\$psoutname\"" 2108 } 2109 } else { 2110 # look for ghostscript 2111 set gspath [auto_execok gs] 2112 if {[file exists $gspath]} { 2113 set ps2pdfcmd "$gspath -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\$pdfoutname -c save pop -f \$psoutname" 2114 } else { 2115 set gspath [auto_execok pstopdf]; # this is on Mac only 2116 if {[file exists $gspath]} { 2117 set ps2pdfcmd "$gspath \$psoutname -o \$pdfoutname" 2118 } 2119 } 2120 } 2121 set gnuplotexport {} 2122 catch { 2123 source [file join $expgui(scriptdir) gnuplot.tcl] 2124 } 2125 2126 #====================================================================== 2127 # make menus 2051 2128 frame .a -bd 3 -relief groove 2052 2129 pack [menubutton .a.file -text File -underline 0 -menu .a.file.menu] -side left … … 2057 2134 .a.file.menu add command -label "Update Plot" \ 2058 2135 -command {set cycle [getcycle];readdata .g} 2136 .a.file.menu add command -label "Set Plot Title" \ 2137 -command SetTitle 2059 2138 .a.file.menu add cascade -label "Export plot" -menu .a.file.menu.export 2060 2139 menu .a.file.menu.export … … 2065 2144 .a.file.menu.export add command -label "to Grace" -command exportgrace 2066 2145 } 2146 if {$gnuplotpath == {}} { 2147 .a.file.menu.export add cascade -label "gnuplot program not found" 2148 } elseif {$gnuplotexport == ""} { 2149 .a.file.menu.export add cascade -label "file gnuplot.tcl not found" 2150 } elseif {$ps2pdfcmd == ""} { 2151 .a.file.menu.export add cascade -label "gs or pstopdf program not found" 2152 } else { 2153 .a.file.menu.export add command -label "to PDF" -command ExportPDF 2154 } 2155 2067 2156 .a.file.menu add command -label Quit -command "destroy ." 2068 2157 .a.file.menu.export add command -label "as .csv file" \ … … 2097 2186 set maglist {} 2098 2187 set mag0 1.0 2099 # display magnification routines -- not currently in use2188 # display magnification routines 2100 2189 proc ShowMag {} { 2101 2190 global blt_version tcl_platform peakinfo expgui … … 2280 2369 } 2281 2370 2371 # create a PDF using GNUPLOT & GhostScript 2372 proc ExportPDF {} { 2373 set msg {} 2374 if {$::gnuplotpath == {}} { 2375 append msg "\n\tThe gnuplot program was not found" 2376 } 2377 if {$::gnuplotexport == ""} { 2378 append msg "\n\tfile gnuplot.tcl not found in $::expgui(scriptdir)" 2379 } 2380 if {$::ps2pdfcmd == ""} { 2381 append msg "\n\tNo PDF conversion routine (ghostscript or pstopdf on Mac was found" 2382 } 2383 if {$msg != ""} { 2384 MyMessageBox -parent . -title "Gnuplot/GS Error" \ 2385 -message $msg \ 2386 -icon error -type OK -default OK 2387 return 0 2388 } 2389 2390 set pdfoutname [tk_getSaveFile -title "Select output file" -parent . \ 2391 -defaultextension ".pdf" \ 2392 -initialdir [pwd] \ 2393 -initialfile "[file rootname $::expnam].pdf"] 2394 if { $pdfoutname == "" } { return } 2395 set rootname [file root $pdfoutname] 2396 set csvoutname "$rootname.csv" 2397 set gplotname "$rootname.gplot" 2398 set psoutname "$rootname.ps" 2399 foreach filename [list $pdfoutname $csvoutname $gplotname $psoutname] { 2400 catch {file -force delete $filename} 2401 } 2402 waitmsg "running gnuplot, Please wait" 2403 Graph2Gnuplot .g $gplotname $psoutname $csvoutname 2404 if {![file exists $gplotname]} { 2405 set msg "\n Output file for gnuplot not created! ($gplotname)" 2406 } 2407 if {![file exists $csvoutname]} { 2408 append msg "\n Output file for gnuplot not created! ($csvoutname)" 2409 } 2410 if {$msg == ""} { 2411 if {[catch { exec $::gnuplotpath $gplotname } err]} { 2412 append msg "Error in running gnuplot: $err" 2413 } 2414 if {![file exists $psoutname]} { 2415 append msg "\n Output file from gnuplot not created! ($psoutname)" 2416 } 2417 } 2418 if {$msg == ""} { 2419 if {[catch { eval exec [subst $::ps2pdfcmd]} err]} { 2420 append msg "Error in PDF conversion: $err" 2421 } 2422 if {![file exists $pdfoutname]} { 2423 append msg "\n PDF file not created! ($pdfoutname)" 2424 } 2425 } 2426 donewaitmsg 2427 if {$msg == ""} { 2428 # clean up 2429 foreach filename [list $csvoutname $gplotname $psoutname] { 2430 catch {file -force delete $filename} 2431 } 2432 MyMessageBox -parent . -title "PDF created" \ 2433 -message "Success: PDF file created ($pdfoutname)" \ 2434 -type OK -default OK 2435 return 1 2436 } else { 2437 # something failed 2438 MyMessageBox -parent . -title "Gnuplot/GS Error" \ 2439 -message "Error: $msg" \ 2440 -icon error -type OK -default OK 2441 return 0 2442 } 2443 } 2444 2445 # resize graph font only 2446 proc ResizeGraphFont {graph font} { 2447 foreach w {legend xaxis yaxis xaxis yaxis \ 2448 x2axis y2axis x2axis y2axis} \ 2449 o {-font -tickfont -tickfont -titlefont -titlefont \ 2450 -tickfont -tickfont -titlefont -titlefont} { 2451 catch { 2452 $graph $w configure $o $font 2453 } 2454 } 2455 catch { 2456 set curfont [$graph cget -font] 2457 if {[string tolower [lindex $curfont 0]] == "symbol"} { 2458 $graph configure -font "Symbol [lrange $font 1 end]" 2459 } else { 2460 $graph configure -font $font 2461 } 2462 } 2463 } 2464 2282 2465 if {$program == "liveplot"} { 2283 2466 .a.mag.menu add command -label "Add region" -command "AddMag" … … 2330 2513 -variable graph(yunits) -value 1 \ 2331 2514 -command {set cycle [getcycle];readdata .g} 2515 .a.options.menu.yunits add radiobutton -label "I/Sigma(I)" \ 2516 -variable graph(yunits) -value 2 \ 2517 -command {set cycle [getcycle];readdata .g} 2332 2518 .a.options.menu add command -label "HKL labeling" -command setlblopts 2333 2519 .a.options.menu add checkbutton -label "Subtract background" \ … … 2354 2540 } 2355 2541 if {$program == "liveplot"} { 2542 .a.options.menu add cascade -menu .a.options.menu.gfont \ 2543 -label "Graph font" 2544 menu .a.options.menu.gfont 2545 foreach f {12 14 16 18 20 22 24 26 28 32 36 40} { 2546 .a.options.menu.gfont add radiobutton \ 2547 -command "ResizeGraphFont .g \[list Helvetica -$f\]" \ 2548 -label $f -font "Helvetica -$f" 2549 } 2356 2550 .a.options.menu add checkbutton -label "Raise on update" \ 2357 2551 -variable graph(autoraise) … … 2513 2707 expload $expnam.EXP 2514 2708 mapexp 2515 2709 if {$expgui(autotick)} { 2710 foreach i $::expmap(phaselist) { 2711 set peakinfo(flag$i) 1 2712 } 2713 } 2714 2516 2715 # fill the histogram menu 2517 2716 if {[llength $expmap(powderlist)] > 15} {
Note: See TracChangeset
for help on using the changeset viewer.