Changeset 2360
- Timestamp:
- Jul 2, 2016 7:22:46 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r2344 r2360 1014 1014 S = instLines[il] 1015 1015 Found = True 1016 S = S.replace(' ','') 1017 SS = S[:-1].split(';') 1018 for s in SS: 1019 [item,val] = s.split(':') 1020 newItems.append(item) 1021 try: 1022 newVals.append(float(val)) 1023 except ValueError: 1024 newVals.append(val) 1025 il += 1 1016 if '"""' in S: 1017 delim = '"""' 1018 elif "'''" in S: 1019 delim = "'''" 1020 else: 1021 S = S.replace(' ','') 1022 SS = S.strip().split(';') 1023 for s in SS: 1024 [item,val] = s.split(':',1) 1025 newItems.append(item) 1026 try: 1027 newVals.append(float(val)) 1028 except ValueError: 1029 newVals.append(val) 1030 il += 1 1031 continue 1032 # read multiline values, delimited by ''' or """ 1033 item,val = S.strip().split(':',1) 1034 val = val.replace(delim,'').rstrip() 1035 val += '\n' 1036 while True: 1037 il += 1 1038 if il >= len(instLines): break 1039 S = instLines[il] 1040 if delim in S: 1041 val += S.replace(delim,'').rstrip() 1042 val += '\n' 1043 break 1044 else: 1045 val += S.rstrip() 1046 val += '\n' 1047 newItems.append(item) 1048 newVals.append(val) 1049 il += 1 1026 1050 return [G2IO.makeInstDict(newItems,newVals,len(newVals)*[False,]),{}] 1027 1051 … … 1504 1528 'qPlot':False,'dPlot':False,'sqrtPlot':False 1505 1529 } 1506 # apply user-supplied corrections to powder data 1530 # apply user-supplied corrections to powder data (remove this below, also from help) 1531 # also see https://subversion.xray.aps.anl.gov/trac/pyGSAS/changeset/2344 1507 1532 corrfile = os.path.join(os.path.split(rd.readfilename)[0],'G2powdercorrections.txt') 1508 1533 if os.path.exists(corrfile): … … 1517 1542 print('error: '+str(err)) 1518 1543 print('with commands '+str(corr)) 1544 # apply user-supplied corrections to powder data 1545 if 'CorrectionCode' in Iparm1: 1546 print('Applying corrections from instprm file') 1547 corr = Iparm1['CorrectionCode'][0] 1548 try: 1549 exec(corr) 1550 print('done') 1551 except Exception as err: 1552 print('error: '+str(err)) 1553 print('with commands -------------------') 1554 print(str(corr)) 1555 print('---------------------------------') 1519 1556 rd.Sample['ranId'] = valuesdict['ranId'] # this should be removed someday 1520 1557 self.PatternTree.SetItemPyData(Id,[valuesdict,rd.powderdata])
Note: See TracChangeset
for help on using the changeset viewer.