9. GSASIIimage: Image calc module

Ellipse fitting & image integration

GSASIIimage.DoPolaCalib(ImageZ, imageData, arcTth)[source]

Determine image polarization by successive integrations with & without preset arc mask. After initial search, does a set of five with offset azimuth to get mean(std) result.

GSASIIimage.EdgeFinder(image, data)[source]

this makes list of all x,y where I>edgeMin suitable for an ellipse search? Not currently used but might be useful in future?

GSASIIimage.Fill2ThetaAzimuthMap(masks, TA, tam, image)[source]

Needs a doc string

GSASIIimage.FitDetector(rings, varyList, parmDict, Print=True, covar=False)[source]

Fit detector calibration parameters

Parameters:
  • rings (np.array) – vector of ring positions
  • varyList (list) – calibration parameters to be refined
  • parmDict (dict) – all calibration parameters
  • Print (bool) – set to True (default) to print the results
  • covar (bool) – set to True to return the covariance matrix (default is False)
Returns:

[chisq,vals,sigList] unless covar is True, then [chisq,vals,sigList,coVarMatrix] is returned

GSASIIimage.FitMultiDist(rings, varyList, parmDict, Print=True, covar=False)[source]

Fit detector calibration parameters with multi-distance data

Parameters:
  • rings (np.array) – vector of ring positions (x,y,dist,d-space)
  • varyList (list) – calibration parameters to be refined
  • parmDict (dict) – calibration parameters
  • Print (bool) – set to True (default) to print the results
  • covar (bool) – set to True to return the covariance matrix (default is False)
Returns:

[chisq,vals,sigDict] unless covar is True, then [chisq,vals,sigDict,coVarMatrix] is returned

GSASIIimage.FitStrSta(Image, StrSta, Controls)[source]

Needs a doc string

GSASIIimage.FitStrain(rings, p0, dset, wave, phi, StaType)[source]

Needs a doc string

GSASIIimage.GetAzm(x, y, data)[source]

Give azimuth value for detector x,y position; calibration info in data

GSASIIimage.GetDetXYfromThAzm(Th, Azm, data)[source]

Computes a detector position from a 2theta angle and an azimultal angle (both in degrees) - apparently not used!

GSASIIimage.GetDetectorXY(dsp, azm, data)[source]

Get detector x,y position from d-spacing (dsp), azimuth (azm,deg) & image controls dictionary (data) - new version it seems to be only used in plotting

GSASIIimage.GetDetectorXY2(dsp, azm, data)[source]

Get detector x,y position from d-spacing (dsp), azimuth (azm,deg) & image controls dictionary (data) it seems to be only used in plotting

GSASIIimage.GetDsp(x, y, data)[source]

Give d-spacing value for detector x,y position; calibration info in data

GSASIIimage.GetEllipse(dsp, data)[source]

uses Dandelin spheres to find ellipse or hyperbola parameters from detector geometry as given in image controls dictionary (data) and a d-spacing (dsp)

GSASIIimage.GetEllipse2(tth, dxy, dist, cent, tilt, phi)[source]

uses Dandelin spheres to find ellipse or hyperbola parameters from detector geometry on output radii[0] (b-minor axis) set < 0. for hyperbola

GSASIIimage.GetTth(x, y, data)[source]

Give 2-theta value for detector x,y position; calibration info in data

GSASIIimage.GetTthAzm(x, y, data)[source]

Give 2-theta, azimuth values for detector x,y position; calibration info in data

GSASIIimage.GetTthAzmDsp2(x, y, data)[source]

Computes a 2theta, etc. from a detector position and calibration constants - checked OK for ellipses & hyperbola.

Returns:np.array(tth,azm,G,dsp) where tth is 2theta, azm is the azimutal angle, G is ? and dsp is the d-space
GSASIIimage.GetTthAzmG(x, y, data)[source]

Give 2-theta, azimuth & geometric corr. values for detector x,y position; calibration info in data - only used in integration checked OK for ellipses & hyperbola This is the slow step in image integration

GSASIIimage.GetTthAzmG2(x, y, data)[source]

Give 2-theta, azimuth & geometric corr. values for detector x,y position; calibration info in data - only used in integration - old version

GSASIIimage.ImageCalibrate(G2frame, data)[source]

Called to perform an initial image calibration after points have been selected for the inner ring.

GSASIIimage.ImageCompress(image, scale)[source]

Reduces size of image by selecting every n’th point param: image array: original image param: scale int: intervsl between selected points returns: array: reduced size image

GSASIIimage.ImageIntegrate(image, data, masks, blkSize=128, returnN=False, useTA=None, useMask=None)[source]

Integrate an image; called from OnIntegrateAll and OnIntegrate in G2imgGUI

GSASIIimage.ImageLocalMax(image, w, Xpix, Ypix)[source]

Needs a doc string

GSASIIimage.ImageRecalibrate(G2frame, ImageZ, data, masks, getRingsOnly=False)[source]

Called to repeat the calibration on an image, usually called after calibration is done initially to improve the fit.

Parameters:
  • G2frame – The top-level GSAS-II frame or None, to skip plotting
  • ImageZ (np.Array) – the image to calibrate
  • data (dict) – the Controls dict for the image
  • masks (dict) – a dict with masks
Returns:

a list containing vals,varyList,sigList,parmDict,covar or rings (with an array of x, y, and d-space values) if getRingsOnly is True or an empty list, in case of an error

GSASIIimage.Make2ThetaAzimuthMap(data, iLim, jLim)[source]

Needs a doc string

GSASIIimage.calcFij(omg, phi, azm, th)[source]

Uses parameters as defined by Bob He & Kingsley Smith, Adv. in X-Ray Anal. 41, 501 (1997)

Parameters:
  • omg – his omega = sample omega rotation; 0 when incident beam || sample surface, 90 when perp. to sample surface
  • phi – his phi = sample phi rotation; usually = 0, axis rotates with omg.
  • azm – his chi = azimuth around incident beam
  • th – his theta = theta
GSASIIimage.checkEllipse(Zsum, distSum, xSum, ySum, dist, x, y)[source]

Needs a doc string

GSASIIimage.makeMat(Angle, Axis)[source]

Make rotation matrix from Angle and Axis

Parameters:
  • Angle (float) – in degrees
  • Axis (int) – 0 for rotation about x, 1 for about y, etc.
GSASIIimage.makeRing(dsp, ellipse, pix, reject, scalex, scaley, image, mul=1)[source]

Needs a doc string

GSASIIimage.peneCorr(tth, dep, dist)[source]

Needs a doc string

GSASIIimage.pointInPolygon(pXY, xy)[source]

Needs a doc string