Changeset 3439
- Timestamp:
- Jun 19, 2018 11:35:53 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpwdGUI.py
r3435 r3439 162 162 163 163 def IsHistogramInAnyPhase(G2frame,histoName): 164 'Needs a doc string' 164 '''Tests a Histogram to see if it is linked to any phases. 165 Returns the name of the first phase where the histogram is used. 166 ''' 165 167 phases = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Phases') 166 168 if phases: -
trunk/GSASIIscriptable.py
r3438 r3439 2390 2390 False,controls,None)[0] 2391 2391 2392 def SaveProfile(self,filename): 2393 '''Writes a GSAS-II (new style) .instprm file 2394 ''' 2395 data,Parms2 = self.data['Instrument Parameters'] 2396 filename = os.path.splitext(filename)[0]+'.instprm' # make sure extension is .instprm 2397 File = open(filename,'w') 2398 File.write("#GSAS-II instrument parameter file; do not add/delete items!\n") 2399 for item in data: 2400 File.write(item+':'+str(data[item][1])+'\n') 2401 File.close() 2402 print ('Instrument parameters saved to: '+filename) 2403 2404 def LoadProfile(self,filename): 2405 '''Reads a GSAS-II (new style) .instprm file and overwrites the current parameters 2406 ''' 2407 filename = os.path.splitext(filename)[0]+'.instprm' # make sure extension is .instprm 2408 File = open(filename,'r') 2409 S = File.readline() 2410 newItems = [] 2411 newVals = [] 2412 Found = False 2413 while S: 2414 if S[0] == '#': 2415 if Found: 2416 break 2417 if 'Bank' in S: 2418 if bank == int(S.split(':')[0].split()[1]): 2419 S = File.readline() 2420 continue 2421 else: 2422 S = File.readline() 2423 while S and '#Bank' not in S: 2424 S = File.readline() 2425 continue 2426 else: #a non #Bank file 2427 S = File.readline() 2428 continue 2429 Found = True 2430 [item,val] = S[:-1].split(':') 2431 newItems.append(item) 2432 try: 2433 newVals.append(float(val)) 2434 except ValueError: 2435 newVals.append(val) 2436 S = File.readline() 2437 File.close() 2438 LoadG2fil() 2439 self.data['Instrument Parameters'][0] = G2fil.makeInstDict(newItems,newVals,len(newVals)*[False,]) 2440 2441 2392 2442 class G2Phase(G2ObjectWrapper): 2393 2443 """A wrapper object around a given phase.
Note: See TracChangeset
for help on using the changeset viewer.