@@ -443,6 +443,7 @@ method Use
443443:meth: `~GSASIIscriptable.G2Image.setControls ` Updates the Image Controls dict for the current image with specified key/value pairs.
444444:meth: `~GSASIIscriptable.G2Image.getMasks ` Returns the Masks dict for the current image.
445445:meth: `~GSASIIscriptable.G2Image.setMasks ` Updates the Masks dict for the current image with specified key/value pairs.
446+ :meth: `~GSASIIscriptable.G2Image.getImage ` Returns the image array for the current image.
446447:meth: `~GSASIIscriptable.G2Image.IntThetaAzMap ` Computes the set of 2theta-azimuth mapping matrices to integrate the current image.
447448:meth: `~GSASIIscriptable.G2Image.IntMaskMap ` Computes the masking map for the current image for integration.
448449:meth: `~GSASIIscriptable.G2Image.MaskThetaMap ` Computes the 2theta mapping matrix to determine a pixel mask.
@@ -1605,6 +1606,39 @@ six-fold speedup has been seen with 16 cores.
16051606 if nodes > 0 : pool.close()
16061607 print (f ' Total elapsed time= { time.time()- scriptstart:.3f } sec ' )
16071608
1609+
1610+ .. _PixelMask_Example :
1611+
1612+ Access the Image Pixel-Mask
1613+ ------------------------------
1614+
1615+ In this example, a pixel mask has already been computed and has been
1616+ saved with the image in a .gpx file. This example then reads the .gpx file,
1617+ locates an image and then pulls the spot mask (an array of True and
1618+ False values for every pixel) from the data structure. As an extra
1619+ check (and demo) the image is reread and the dimensions of the image
1620+ are confirmed to match those of the image. Note that the
1621+ :meth: `~GSASIIscriptable.G2Image.GeneratePixelMask ` routine could also
1622+ have been used to compute the mask.
1623+
1624+ This also provides an example showing how a result that is not made
1625+ directly available from the GSASIIscriptable API can still be accessed
1626+ from the GSAS-II data structures, but this requires some care to
1627+ determine where values are stored.
1628+
1629+ .. code-block :: python
1630+
1631+ import os
1632+ import G2script as G2sc
1633+ datadir = os.path.expanduser(" ~/Scratch/MPE_H5" )
1634+ PathWrap = lambda fil : os.path.join(datadir,fil)
1635+ gpx = G2sc.G2Project(PathWrap(' pixelMask.gpx' ))
1636+ img0 = gpx.image(0 ) # access 1st image
1637+ spotMask = img0.data[' Masks' ][' SpotMask' ].get(' spotMask' )
1638+ if spotMask is not None :
1639+ assert spotMask.shape == img0.getImage().shape # diagnostic to confirm sizes match
1640+
1641+
16081642 .. _HistExport :
16091643
16101644Histogram Export
0 commit comments