Changeset 4303 for trunk/GSASIIscriptable.py
- Timestamp:
- Feb 14, 2020 4:54:30 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIscriptable.py
r4301 r4303 1771 1771 if sumImg is None: 1772 1772 return [] 1773 sumImg = np.array(sumImg,dtype='int32') 1773 1774 darkImg = False 1774 1775 if 'dark image' in Controls: … … 1778 1779 formatName = dImgObj.data['Image Controls'].get('formatName','') 1779 1780 imagefile = dImgObj.data['data'][1] 1780 ImageTag = None # fix this for multiimage files 1781 if type(imagefile) is tuple: 1782 imagefile,ImageTag = imagefile 1781 1783 darkImage = G2fil.RereadImageData(ImageReaderlist,imagefile,ImageTag=ImageTag,FormatName=formatName) 1782 1784 if darkImg is None: … … 2889 2891 return G2obj.G2VarObj(phase, hist, varname, atomId) 2890 2892 2891 def add_image(self, imagefile, fmthint=None, defaultImage=None ):2893 def add_image(self, imagefile, fmthint=None, defaultImage=None, indexList=None): 2892 2894 """Load an image into a project 2893 2895 … … 2900 2902 :param str defaultImage: The name of an image to use as a default for 2901 2903 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) 2905 2910 """ 2906 2911 LoadG2fil() … … 2908 2913 readers = import_generic(imagefile, Readers['Image'], fmthint=fmthint) 2909 2914 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 2911 2919 if rd.SciPy: #was default read by scipy; needs 1 time fixes 2912 2920 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.