Changeset 1359
- Timestamp:
- May 21, 2014 12:59:59 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r1355 r1359 705 705 reqrdr = self.ImportMenuId.get(event.GetId()) 706 706 rdlist = self.OnImportGeneric(reqrdr,self.ImportSfactReaderlist, 707 'Structure Factor' )707 'Structure Factor',multiple=True) 708 708 if len(rdlist) == 0: return 709 709 self.CheckNotebook() … … 1022 1022 s = Iparm['INS 1IECOF'+str(i+1)].split() 1023 1023 Iesd += [float(S) for S in s] 1024 NT = 10 1024 1025 for i in range(8): 1025 s = Iparm['INS 1IECOR'+str(i+1)].split() 1026 Icovar += [float(S) for S in s] 1026 s = Iparm['INS 1IECOR'+str(i+1)] 1027 if i == 7: 1028 NT = 8 1029 Icovar += [float(s[6*j:6*j+6]) for j in range(NT)] 1027 1030 Inst2['Icoeff'] = Icoeff 1028 1031 Inst2['Iesd'] = Iesd -
trunk/GSASIIIO.py
r1355 r1359 306 306 lines = head.split('\n') 307 307 sizexy = [0,0] 308 pixSize = [ 0,0]308 pixSize = [154,154] #Pixium4700? 309 309 cent = [0,0] 310 wave = 1.54187 #default <CuKa> 311 dist = 1000. 310 312 head = ['European detector data',] 311 313 for line in lines: 314 line = line.replace(';',' ').strip() 312 315 fields = line.split() 313 316 if 'Dim_1' in line: … … 317 320 elif 'DataType' in line: 318 321 dType = fields[2] 319 elif ' refined_wavelength' in line:322 elif 'wavelength' in line: 320 323 wave = float(fields[2]) 321 324 elif 'Size' in line: … … 335 338 if line: 336 339 head.append(line) 340 else: #blank line at end of header 341 break 337 342 File.seek(fileSize-imSize) 338 343 if dType == 'UnsignedShort': 339 344 image = np.array(ar.array('H',File.read(imSize)),dtype=np.int32) 340 345 elif dType == 'UnsignedInt': 346 image = np.array(ar.array('L',File.read(imSize)),dtype=np.int32) 347 elif dType == 'UnsignedLong': 341 348 image = np.array(ar.array('L',File.read(imSize)),dtype=np.int32) 342 349 image = np.reshape(image,(sizexy[1],sizexy[0])) … … 1410 1417 # more than one data block 1411 1418 self.repeat = False 1419 self.selections = [] 1412 1420 self.repeatcount = 0 1413 1421 self.readfilename = '?' -
trunk/GSASIIconstrGUI.py
r1247 r1359 205 205 ################################################### 206 206 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() 207 G2obj.IndexAllIds(Histograms,Phases) 207 208 ################################################################################## 208 209 # patch: convert old-style (str) variables in constraints to G2VarObj objects -
trunk/GSASIIobj.py
r1340 r1359 946 946 element each atom record. 947 947 948 This is called in t woplaces (only) :func:`GSASIIstrIO.GetUsedHistogramsAndPhases`949 (which loads the histograms and phases from a GPX file) and948 This is called in three places (only) :func:`GSASIIstrIO.GetUsedHistogramsAndPhases` 949 (which loads the histograms and phases from a GPX file), 950 950 :meth:`GSASII.GSASII.GetUsedHistogramsAndPhasesfromTree` 951 (which loads the histograms and phases from the data tree.) 951 (which loads the histograms and phases from the data tree.) and 952 :meth:`GSASII.GSASIIconstrGUI.UpdateConstraints 953 (which displays & edits the constraints in a GUI) 952 954 953 955 TODO: do we need a lookup for rigid body variables? -
trunk/GSASIIphsGUI.py
r1283 r1359 495 495 except ValueError: 496 496 pass 497 pawlVal.SetValue("%. 3f"%(generalData['Pawley dmin'])) #reset in case of error497 pawlVal.SetValue("%.5f"%(generalData['Pawley dmin'])) #reset in case of error 498 498 499 499 def OnPawleyNegWt(event): … … 513 513 pawleySizer.Add(pawlRef,0,WACV) 514 514 pawleySizer.Add(wx.StaticText(General,label=' Pawley dmin: '),0,WACV) 515 pawlVal = wx.TextCtrl(General,value='%. 3f'%(generalData['Pawley dmin']),style=wx.TE_PROCESS_ENTER)515 pawlVal = wx.TextCtrl(General,value='%.5f'%(generalData['Pawley dmin']),style=wx.TE_PROCESS_ENTER) 516 516 pawlVal.Bind(wx.EVT_TEXT_ENTER,OnPawleyVal) 517 517 pawlVal.Bind(wx.EVT_KILL_FOCUS,OnPawleyVal) -
trunk/GSASIIstrMath.py
r1335 r1359 2116 2116 pSum = np.sum(pWt*pVals**2) 2117 2117 for name in pWsum: 2118 print ' Penalty function for %8s = % .3f'%(name,pWsum[name])2119 print 'Total penalty function: % .3fon %d terms'%(pSum,len(pVals))2118 print ' Penalty function for %8s = %12.5g'%(name,pWsum[name]) 2119 print 'Total penalty function: %12.5g on %d terms'%(pSum,len(pVals)) 2120 2120 Nobs += len(pVals) 2121 2121 M = np.concatenate((M,np.sqrt(pWt)*pVals)) -
trunk/imports/G2pwd_fxye.py
r1259 r1359 210 210 title = '' 211 211 comments = None 212 selections = None212 # selections = None 213 213 214 214 # reload previously saved values … … 216 216 Banks = rdbuffer.get('Banks') 217 217 Pos = rdbuffer.get('Pos') 218 sel ections = rdbuffer.get('selections')218 self.selections = rdbuffer.get('selections') 219 219 comments = rdbuffer.get('comments') 220 220 … … 240 240 # 2nd line is instrument parameter file (optional) 241 241 self.errors = 'Error reading instrument parameter filename' 242 self.instparm = S.split(':')[1].strip( )242 self.instparm = S.split(':')[1].strip('[]').strip() 243 243 continue 244 244 if S[0] == '#': # allow comments anywhere in the file … … 273 273 elif len(Banks) == 1: # only one Bank, don't ask 274 274 selblk = 0 275 elif self.repeat and sel ections is not None:275 elif self.repeat and self.selections is not None: 276 276 # we were called to repeat the read 277 #print 'debug: repeat #',self.repeatcount,'selection',sel ections[self.repeatcount]278 selblk = sel ections[self.repeatcount]277 #print 'debug: repeat #',self.repeatcount,'selection',self.selections[self.repeatcount] 278 selblk = self.selections[self.repeatcount] 279 279 self.repeatcount += 1 280 if self.repeatcount >= len(sel ections): self.repeat = False280 if self.repeatcount >= len(self.selections): self.repeat = False 281 281 else: # choose from options 282 selections = self.MultipleBlockSelector( 283 Banks, 284 ParentFrame=ParentFrame, 285 title='Select Bank(s) to read from the list below', 286 size=(600,100), 287 header='Dataset Selector') 288 if len(selections) == 0: return False 289 selblk = selections[0] # select first in list 290 if len(selections) > 1: # prepare to loop through again 282 if not len(self.selections): #use previous selection, otherwise... 283 self.selections = self.MultipleBlockSelector( 284 Banks, 285 ParentFrame=ParentFrame, 286 title='Select Bank(s) to read from the list below', 287 size=(600,100), 288 header='Dataset Selector') 289 if len(self.selections) == 0: return False 290 selblk = self.selections[0] # select first in list 291 if len(self.selections) > 1: # prepare to loop through again 291 292 self.repeat = True 292 293 self.repeatcount = 1 … … 294 295 rdbuffer['Banks'] = Banks 295 296 rdbuffer['Pos'] = Pos 296 rdbuffer['selections'] = sel ections297 rdbuffer['selections'] = self.selections 297 298 rdbuffer['comments'] = comments 298 299 … … 343 344 except: 344 345 pass 346 elif 'Omega' in S.split('=')[0] or 'Theta' in S.split('=')[0]: #HIPD weirdness 347 try: 348 self.Sample['Omega'] = float(S.split('=')[1]) 349 except: 350 pass 351 elif 'Chi' in S.split('=')[0]: 352 try: 353 self.Sample['Chi'] = float(S.split('=')[1]) 354 except: 355 pass 356 elif 'Phi' in S.split('=')[0]: 357 try: 358 self.Sample['Phi'] = float(S.split('=')[1]) 359 except: 360 pass 345 361 self.Sample['Temperature'] = Temperature 346 362 return True -
trunk/imports/G2sfact.py
r1168 r1359 49 49 extensionlist=('.hkl','.HKL'), 50 50 strictExtension=False, 51 formatName = ' F containing HKL',51 formatName = 'HKL containing F', 52 52 longFormatName = 'Simple [hkl, Fo, sig(Fo)] Structure factor text file' 53 53 ) … … 90 90 extensionlist=('.hkl','.HKL'), 91 91 strictExtension=False, 92 formatName = u' F\u00b2 containing HKL',92 formatName = u'HKL containing F\u00b2', 93 93 longFormatName = u'Simple [hkl, Fo\u00b2, sig(Fo\u00b2)] Structure factor text file' 94 94 ) … … 125 125 return False 126 126 127 class NT_HKLF2_ReaderClass(G2IO.ImportStructFactor): 128 'Routines to import neutron TOF F**2, sig(F**2) reflections from a HKLF file' 129 def __init__(self): 130 super(self.__class__,self).__init__( # fancy way to self-reference 131 extensionlist=('.hkl','.HKL'), 132 strictExtension=False, 133 formatName = u'Neutron TOF HKL containing F\u00b2', 134 longFormatName = u'Neutron TOF [hkl, Fo\u00b2, sig(Fo\u00b2),...] Structure factor text file' 135 ) 136 137 def ContentsValidator(self, filepointer): 138 'Make sure file contains the expected columns on numbers' 139 return ColumnValidator(self, filepointer) 140 141 def Reader(self,filename,filepointer, ParentFrame=None, **unused): 142 'Read the file' 143 try: 144 oldNo = -1 145 Banks = [] 146 for line,S in enumerate(filepointer): 147 if S[0] == '#': continue #ignore comments, if any 148 bankNo = S.split()[5] 149 if bankNo != oldNo: 150 Banks.append([]) 151 152 for line,S in enumerate(filepointer): 153 self.errors = ' Error reading line '+str(line+1) 154 if S[0] == '#': continue #ignore comments, if any 155 h,k,l,Fo,sigFo = S.split() 156 h,k,l = [int(h),int(k),int(l)] 157 if not any([h,k,l]): 158 break 159 Fo = float(Fo) 160 sigFo = float(sigFo) 161 # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,... 162 self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0]) 163 self.errors = 'Error after reading reflections (unexpected!)' 164 self.RefDict['RefList'] = np.array(self.RefDict['RefList']) 165 self.UpdateControls(Type='Fosq',FcalcPresent=False) # set Fobs type & if Fcalc values are loaded 166 self.UpdateParameters(Type='SNT',Wave=None) # histogram type 167 return True 168 except Exception as detail: 169 self.errors += '\n '+str(detail) 170 print '\n\n'+self.formatName+' read error: '+str(detail) # for testing 171 import traceback 172 traceback.print_exc(file=sys.stdout) 173 return False 174
Note: See TracChangeset
for help on using the changeset viewer.