19. GSAS-II Independent Tools

The modules here are used for independent programs to be used as tools within the GSAS-II package and run independently of the main GSAS-II program.

Both are under development.

19.1. GSASIIIntPDFtool: autointegration routines

Independent-running GSAS-II based auto-integration program with minimal GUI, no visualization but intended to implement significant levels of parallelization.

class GSASIIIntPDFtool.AutoIntFrame(G2frame, PollTime=30.0)[source]

Creates a wx.Frame window for the Image AutoIntegration. The intent is that this will be used as a non-modal dialog window.

Implements a Start button that morphs into a pause and resume button. This button starts a processing loop that is repeated every PollTime() seconds.

Parameters:
  • G2frame (wx.Frame) – main GSAS-II frame
  • PollTime (float) – frequency in seconds to repeat calling the processing loop. (Default is 30.0 seconds.)
ArgGen(PDFobj, imgprms, mskprms, xydata)[source]

generator for arguments for integration/PDF calc

OnPause()[source]

Respond to Pause, changes text on button/Status line, if needed Stops timer self.Pause should already be True

OnTimerLoop(event)[source]

A method that is called every PollTime() seconds that is used to check for new files and process them. Integrates new images. Also optionally sets up and computes PDF. This is called only after the “Start” button is pressed (then its label reads “Pause”).

SetSourceDir(event)[source]

Use a dialog to get a directory for image files

ShowMatchingFiles(value, invalid=False, **kwargs)[source]

Find and image files matching the image file directory (self.params[‘readdir’]) and the image file filter (self.params[‘filter’]) and add this information to the GUI list box

StartLoop()[source]

Prepare to start autointegration timer loop. Save current Image params for use in future integrations also label the window so users understand what is being used

GSASIIIntPDFtool.LookupFromTable(dist, parmList)[source]

Interpolate image parameters for a supplied distance value

Parameters:dist (float) – distance to use for interpolation
Returns:a list with 2 items: * a dict with interpolated parameter values, * the closest imctrl
GSASIIIntPDFtool.MapCache = {'ThetaAzimMap': {}, 'distanceList': [], 'maskMap': {}}

caches for TA and Mask maps

GSASIIIntPDFtool.ProcessImage(newImage, imgprms, mskprms, xydata, PDFdict, InterpVals, calcModes, outputModes)[source]

Process one image that is read from file newImage and is integrated into one or more diffraction patterns and optionally each diffraction pattern can be transformed into a pair distribution function.

Parameters:
  • newImage (str) – file name (full path) for input image
  • imgprms (dict) – dict with some nested lists & dicts describing the image settings and integration parameters
  • mskprms (dict) – dict with areas of image to be masked
  • xydata (dict) – contains histogram information with about background contributions, used for PDF computation (used if ComputePDF is True)
  • PDFdict – contains PDF parameters (used if ComputePDF is True)
  • InterpVals – contains interpolation table (used if TableMode is True)
  • calcModes (tuple) – set of values for which computations are performed and how
  • outputModes (tuple) – determines which files are written and where
GSASIIIntPDFtool.SetupInterpolation(dlg)[source]

Creates an object for interpolating image parameters at a given distance value

19.2. G2compare: Tool for project comparison

class G2compare.MakeTopWindow(parent)[source]

Define the main frame and its associated menu items

LoadPhase(fil)[source]

Load Phase entries from a .GPX file to the tree. see GSASIIIO.ProjFileOpen()

LoadProject(fil)[source]

Load the Covariance entry from a .GPX file to the tree. see GSASIIIO.ProjFileOpen()

LoadPwdr(fil)[source]

Load PWDR entries from a .GPX file to the tree. see GSASIIIO.ProjFileOpen()

SelectGPX()[source]

Select a .GPX file to be read

SelectMultGPX()[source]

Select multiple .GPX files to be read

SetModeMenu()[source]

Create the mode-specific menu and its contents

getMode()[source]

returns the display mode (one of “Histogram”,”Phase”,”Project”). Could return ‘?’ in case of an error.

loadFile(fil)[source]

read or reread a file

onHistFilter(event)[source]

Load a filter string via a dialog in response to a menu event

onHistPrinceTest(event)[source]

Compare two histograms (selected here if more than two are present) using the statistical test proposed by Ted Prince in Acta Cryst. B35 1099-1100. (1982). Also see Int. Tables Vol. C (1st Ed.) chapter 8.4, 618-621 (1995).

onLoadGPX(event)[source]

Initial load of GPX file in response to a menu command

onLoadMultGPX(event)[source]

Initial load of multiple GPX files in response to a menu command

onLoadWildGPX(event, wildcard=None)[source]

Initial load of GPX file in response to a menu command

onProjFtest(event)[source]

Compare two projects (selected here if more than two are present) using the statistical F-test (aka Hamilton R-factor test), see:

  • Hamilton, R. W. (1965), Acta Crystallogr. 18, 502-510.
  • Prince, E., Mathematical Techniques in Crystallography and Materials Science, Second ed. (Springer-Verlag, New York, 1994).
onRefresh(event)[source]

reread all files, in response to a change in mode, etc.

G2compare.RC2Ftest(npts, RChiSq0, nvar0, RChiSq1, nvar1)[source]

Compute the F-test probability that a model expanded with added parameters (relaxed model) is statistically more likely than the constrained (base) model :param int npts: number of observed diffraction data points :param float RChiSq0: Reduced Chi**2 for the base model :param int nvar0: number of refined variables in the base model :param float RChiSq0: Reduced Chi**2 for the relaxed model :param int nvar1: number of refined variables in the relaxed model

G2compare.RwFtest(npts, Rwp0, nvar0, Rwp1, nvar1)[source]

Compute the F-test probability that a model expanded with added parameters (relaxed model) is statistically more likely than the constrained (base) model :param int npts: number of observed diffraction data points :param float Rwp0: Weighted profile R-factor or GOF for the base model :param int nvar0: number of refined variables in the base model :param float Rwp1: Weighted profile R-factor or GOF for the relaxed model :param int nvar1: number of refined variables in the relaxed model

G2compare.main(application)[source]

Start up the GSAS-II GUI