Changeset 4303


Ignore:
Timestamp:
Feb 14, 2020 4:54:30 PM (21 months ago)
Author:
toby
Message:

fix scriptable for multiple image files and xfer correction in @4286

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimgGUI.py

    r4302 r4303  
    7272
    7373def GetImageZ(G2frame,data,newRange=False):
    74     '''Gets image & applies dark, background & flat background corrections
     74    '''Gets image & applies dark, background & flat background corrections.
     75
    7576    :param wx.Frame G2frame: main GSAS-II frame
    76     param: dict data: Image Controls dictionary
    77     return: array sumImg: corrected image for background/dark/flat back
     77    :param: dict data: Image Controls dictionary
     78
     79    :returns: array sumImg: corrected image for background/dark/flat back
    7880    '''
     81    # Note that routine GSASIIscriptable._getCorrImage is based on this
     82    # so changes made here should be repeated there.
    7983   
    8084    Npix,imagefile,imagetag = G2IO.GetCheckImageFile(G2frame,G2frame.Image)
  • trunk/GSASIIobj.py

    r4198 r4303  
    652652 11          intensity correction for reflection, this times
    653653             :math:`F_{obs}^2` or :math:`F_{calc}^2` gives Iobs or Icalc
     654 12          Prfo
     655 13          Trans
     656 14          ExtP 
    654657==========  ====================================================
    655658
  • trunk/GSASIIscriptable.py

    r4301 r4303  
    17711771    if sumImg is None:
    17721772        return []
     1773    sumImg = np.array(sumImg,dtype='int32')
    17731774    darkImg = False
    17741775    if 'dark image' in Controls:
     
    17781779            formatName = dImgObj.data['Image Controls'].get('formatName','')
    17791780            imagefile = dImgObj.data['data'][1]
    1780             ImageTag = None # fix this for multiimage files
     1781            if type(imagefile) is tuple:
     1782                imagefile,ImageTag  = imagefile
    17811783            darkImage = G2fil.RereadImageData(ImageReaderlist,imagefile,ImageTag=ImageTag,FormatName=formatName)
    17821784            if darkImg is None:
     
    28892891        return G2obj.G2VarObj(phase, hist, varname, atomId)
    28902892
    2891     def add_image(self, imagefile, fmthint=None, defaultImage=None):
     2893    def add_image(self, imagefile, fmthint=None, defaultImage=None, indexList=None):
    28922894        """Load an image into a project
    28932895
     
    29002902        :param str defaultImage: The name of an image to use as a default for
    29012903          setting parameters for the image file to read.
    2902 
    2903         :returns: a list of G2Image object for the added image(s) [this routine
    2904           has not yet been tested with files with multiple images...]
     2904        :param list indexList: specifies the image numbers (counting from zero)
     2905          to be used from the file when a file has multiple images. A value of
     2906          ``[0,2,3]`` will cause the only first, third and fourth images in the file
     2907          to be included in the project.
     2908
     2909        :returns: a list of :class:`G2Image` object(s) for the added image(s)
    29052910        """
    29062911        LoadG2fil()
     
    29082913        readers = import_generic(imagefile, Readers['Image'], fmthint=fmthint)
    29092914        objlist = []
    2910         for rd in readers:
     2915        for i,rd in enumerate(readers):
     2916            if indexList is not None and i not in indexList:
     2917                G2fil.G2Print("Image {} skipped".format(i))
     2918                continue
    29112919            if rd.SciPy:        #was default read by scipy; needs 1 time fixes
    29122920                G2fil.G2Print('Warning: Image {} read by generic SciPy import. Image parameters likely wrong'.format(imagefile))
Note: See TracChangeset for help on using the changeset viewer.