Changeset 2227
- Timestamp:
- Apr 26, 2016 8:36:05 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIIO.py
r2223 r2227 277 277 ImageTag (where there is more than one image in the file), if defined. 278 278 ''' 279 ImgNames = [] 280 if G2frame.PatternTree.GetCount(): # get a list of existing Image entries 281 item, cookie = G2frame.PatternTree.GetFirstChild(G2frame.root) 282 while item: 283 name = G2frame.PatternTree.GetItemText(item) 284 if name.startswith('IMG'): ImgNames.append(name) 285 item, cookie = G2frame.PatternTree.GetNextChild(G2frame.root, cookie) 279 ImgNames = G2gd.GetPatternTreeDataNames(G2frame,['IMG ',]) 286 280 TreeLbl = 'IMG '+os.path.basename(imagefile) 287 281 ImageTag = Data.get('ImageTag') -
trunk/GSASIIimgGUI.py
r2226 r2227 448 448 maxSizer.AddGrowableCol(1,1) 449 449 maxSizer.SetFlexibleDirection(wx.HORIZONTAL) 450 sqrtDeltZero = ma th.sqrt(data['range'][0][1]-max(0.0,data['range'][0][0]))451 DeltOne = data['range'][1][1]-max(0.0,data['range'][0][0])450 sqrtDeltZero = max(1.0,math.sqrt(data['range'][0][1]-max(0.0,data['range'][0][0]))) 451 DeltOne = max(1.0,data['range'][1][1]-max(0.0,data['range'][0][0])) 452 452 sqrtDeltOne = math.sqrt(DeltOne) 453 453 maxSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' Max intensity'),0,WACV) -
trunk/imports/G2img_GE.py
r2133 r2227 22 22 import GSASIIpath 23 23 GSASIIpath.SetVersionNumber("$Revision$") 24 class GE sum_ReaderClass(G2IO.ImportImage):24 class GE_ReaderClass(G2IO.ImportImage): 25 25 '''Routine to read a GE image, typically from APS Sector 1. 26 26 … … 47 47 def Reader(self,filename,filepointer, ParentFrame=None, **kwarg): 48 48 '''Read using GE file reader, :func:`GetGEsumData` 49 should this read all blocks & sum them if desired? 49 50 ''' 50 51 #rdbuffer = kwarg.get('buffer') 51 52 imagenum = kwarg.get('blocknum') 53 #sum = kwarg.get('sum') 52 54 if imagenum is None: imagenum = 1 53 55 self.Comments,self.Data,self.Npix,self.Image,more = GetGEsumData(filename,imagenum=imagenum) … … 59 61 return True 60 62 61 def GetGEsumData(filename,imagenum=1): 63 class GE_sumReaderClass(G2IO.ImportImage): 64 '''Routine to read multiple GE images & sum them, typically from APS Sector 1. 65 66 The image files may be of form .geX (where X is ' ', 1, 2, 3 or 4), 67 which is a raw image from the detector. These files may contain more 68 than one image and have a rudimentary header. 69 Files with extension .sum or .cor are 4 byte integers/pixel, one image/file. 70 Files with extension .avg are 2 byte integers/pixel, one image/file. 71 ''' 72 73 def __init__(self): 74 super(self.__class__,self).__init__( # fancy way to self-reference 75 extensionlist=('.ge1','.ge2','.ge3','.ge4'), 76 strictExtension=True, 77 formatName = 'GE multi-image summed', 78 longFormatName = 'sum of GE multi-image file' 79 ) 80 81 def ContentsValidator(self, filepointer): 82 '''no test at this time 83 ''' 84 return True 85 86 def Reader(self,filename,filepointer, ParentFrame=None, **kwarg): 87 '''Read using GE file reader, :func:`GetGEsumData` 88 should this read all blocks & sum them if desired? 89 ''' 90 #rdbuffer = kwarg.get('buffer') 91 imagenum = kwarg.get('blocknum') 92 if imagenum is None: imagenum = 1 93 self.Comments,self.Data,self.Npix,self.Image,more = GetGEsumData(filename,imagenum=imagenum,sum=True) 94 if self.Npix == 0 or not self.Comments: 95 return False 96 self.LoadImage(ParentFrame,filename,imagenum) 97 self.repeatcount = imagenum 98 self.repeat = more 99 return True 100 101 def GetGEsumData(filename,imagenum=1,sum=False): # 62 102 '''Read G.E. detector images from various files as produced at 1-ID and 63 with Detector Pool detector. 103 with Detector Pool detector. Also sums multiple image files if desired 64 104 ''' 65 105 import struct as st … … 100 140 return 0,0,0,0,False 101 141 head += ['file: '+filename+' image #'+str(imagenum),] 102 #while nframes > 1: 103 # print 'adding' 104 # image += np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32) 105 # nframes -= 1 142 if sum: #will ignore imagenum 143 while nframes > 1: #OK, this will sum the frames. 144 # print 'adding' 145 image += np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32) 146 nframes -= 1 147 more = False 106 148 image = np.reshape(image,(sizexy[1],sizexy[0])) 107 149 data = {'pixelSize':[200,200],'wavelength':0.15,'distance':250.0,'center':[204.8,204.8],'size':sizexy}
Note: See TracChangeset
for help on using the changeset viewer.