Warning: Trying to access array offset on value of type null in /home/site/wwwroot/lib/plugins/move/action/rename.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/lib/plugins/move/action/rename.php:42) in /home/site/wwwroot/inc/actions.php on line 38
outputting_publication_quality_plots_using_expgui [topas wiki]

User Tools

Site Tools


outputting_publication_quality_plots_using_expgui

Publication Quality Plots using Liveplot in EXPGUI

Following an update to Liveplot in EXPGUI by Brian Toby, you can now simply produce publication quality plots, with a Yobs, YCalc, Diff, Background, and reflection markers for each phase. The background output includes all objects in the background.

For problems with this, please ask on the forum of this site, rather than contacting Brian Toby.

For this to work with TOPAS, output of various parts of information must be combined in one file:

  • X, D, Observed, Calculated, Y_error
  • H, K, L, M, D, X, Phase_number
  • X, D, Background

Currently, The background has to be appended to the end of the file as it can not be output at the same time as the calculated pattern.

Two macros should be saved to the local.inc file:

macro OUT_Ycalc_and_Ticks(file)
   {
    xdd_out file load out_record out_fmt out_eqn
       {
           " %11.5f  " = X;
           " %11.5f  " = 0.5 Lam / Sin(X Pi/360);
           " %11.5f  " = Yobs;
           " %11.5f  " = Ycalc;
           " %11.5f\n" = SigmaYobs;
      }
 
      out file append
      Out_String("\tHKL reflection markers:\n")
 
      for strs {
        phase_out file append load out_record out_fmt out_eqn
        {
           " %3.0f" = H;
           " %3.0f" = K;
           " %3.0f" = L;
           " %3.0f" = M;
           " %11.5f"   = D_spacing;
           " %11.5f"   = 2 Rad Th;
           " %11.5f\n"   = phase_number;
        }
      }
   } 

and

macro OUT_BKG_Fit_Objs(file)
{
        iters 0
      out "liveplot_output.ascii" append
      Out_String("\tBackground fit:\n")
 
    xdd_out file append load out_record out_fmt out_eqn
       {
           " %11.5f  " = X;
           " %11.5f  " = 0.5 Lam / Sin(X Pi/360);
           " %11.5f\n" = Ycalc;
      }
   }

The following structure must be used in the relevant inp file to achieve the desired output:

/*
Normally have the "#define OUT_Ycalc_and_Ticks_" definition activated.
To output information (once happy with refinement),
          1. Uncomment the "#define OUT_PUT_RUN_" definition
          2. Run refinement - this will output X, D, Yobs, Ycalc, and sigYobs, as well as h, k, l, m, D,  X, and phase number.
          3. Comment out "#define OUT_Ycalc_and_Ticks_" and uncomment "'#define OUT_BKG_Fit_Objs_" definitions
          4. Run refinement - this will do zero iterations and append your calculated background to the previous file.
*/
 
'#define OUT_PUT_RUN_                      '' Comment out if no output required '
#define OUT_Ycalc_and_Ticks_               '  Normally active'
'#define OUT_BKG_Fit_Objs_                 '' Comment previous line, and uncomment here for background '
 
xdd yourdata.xye
 
...
...
fit_obj
...
...
 
 
#ifdef OUT_Ycalc_and_Ticks_                ' This line must be added before the first str section. '
 
str
...
local !phase_number 1                      ' define for each str section '
...
 
str
...
local !phase_number 2                      ' define for each str section '
...
 
/*
The following should be placed at the end of all your str parts.
There is no need to edit them.
*/
 
          #ifdef OUT_PUT_RUN_
                    OUT_Ycalc_and_Ticks(liveplot_output.ascii)
          #endif
          #else
          #ifdef OUT_BKG_Fit_Objs_
                    #ifdef OUT_PUT_RUN_
                    OUT_BKG_Fit_Objs(liveplot_output.ascii)
                    #endif
          #endif
#endif

The final output file should look something like this:

     5.20000       3.90334    1217.65630    1183.48083      18.30609
     5.20400       3.90034    1220.92890    1181.44247      18.23107
     5.20800       3.89734    1214.75860    1179.40464      18.27184
     ...
     ...
     ...
    29.99200       0.68431     234.54687     245.84482      11.28108
    29.99600       0.68422     264.23144     246.44503      11.88096
    30.00000       0.68413     245.36497     247.07693      12.07137
	HKL reflection markers:
   0   0   2   2     4.18267     4.85251     1.00000
   0   1   1   8     3.51523     5.77458     1.00000
   0   1   2   8     2.84214     7.14376     1.00000
   ...
   ...
   ...
   3   3   8   8     0.68777    29.83760     1.00000
   0   1  12   8     0.68609    29.91244     1.00000
   4   4   0   4     0.68481    29.96987     1.00000
   1   1   1   8     3.14438     6.45631     2.00000
   0   0   2   6     2.72312     7.45643     2.00000
   0   2   2  12     1.92553    10.55245     2.00000
   ...
   ...
   ...
	Background fit:
     5.20000       3.90334    1182.94026
     5.20400       3.90034    1180.89776
     5.20800       3.89734    1178.85567
     ...
     ...
     ...
    29.99200       0.68431     236.74789
    29.99600       0.68422     236.78480
    30.00000       0.68413     236.82286
outputting_publication_quality_plots_using_expgui.txt · Last modified: 2022/11/03 15:08 by 127.0.0.1