Changeset 3825
- Timestamp:
- Feb 15, 2019 10:43:35 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIIO.py ¶
r3814 r3825 1343 1343 self.Histograms = {} 1344 1344 self.powderDict = {} 1345 self.sasdDict = {} 1345 1346 self.xtalDict = {} 1346 1347 self.parmDict = {} … … 1478 1479 else: 1479 1480 choices = sorted(self.powderDict.values()) 1481 hnum = G2G.ItemSelector(choices,self.G2frame) 1482 if hnum is None: return True 1483 self.histnam = [choices[hnum]] 1484 numselected = len(self.histnam) 1485 elif self.currentExportType == 'sasd': 1486 if len(self.sasdDict) == 0: 1487 self.G2frame.ErrorDialog( 1488 'Empty project', 1489 'Project does not contain any small angle data.') 1490 return True 1491 elif len(self.sasdDict) == 1: 1492 self.histnam = self.sasdDict.values() 1493 elif self.multiple: 1494 choices = sorted(self.sasdDict.values()) 1495 hnum = G2G.ItemSelector(choices,self.G2frame,multiple=True) 1496 if not hnum: return True 1497 self.histnam = [choices[i] for i in hnum] 1498 numselected = len(self.histnam) 1499 else: 1500 choices = sorted(self.sasdDict.values()) 1480 1501 hnum = G2G.ItemSelector(choices,self.G2frame) 1481 1502 if hnum is None: return True … … 1655 1676 self.OverallParms = {} 1656 1677 self.powderDict = {} 1678 self.sasdDict = {} 1657 1679 self.xtalDict = {} 1658 1680 self.Phases = {} … … 1680 1702 elif self.currentExportType == 'image': 1681 1703 histType = 'IMG' 1704 elif self.currentExportType == 'sasd': 1705 histType = 'SASD' 1682 1706 1683 1707 if histType: # Loading just one kind of tree entry … … 1712 1736 elif hist.startswith("HKLF"): 1713 1737 d = self.xtalDict 1738 elif hist.startswith("SASD"): 1739 d = self.sasdDict 1714 1740 else: 1715 1741 return … … 1737 1763 elif hist.startswith("HKLF"): 1738 1764 self.xtalDict[i] = hist 1765 elif hist.startswith("SASD"): 1766 self.sasdDict[i] = hist 1739 1767 1740 1768 def dumpTree(self,mode='type'): -
TabularUnified trunk/GSASIIdataGUI.py ¶
r3814 r3825 2551 2551 mapmenu = wx.Menu() 2552 2552 item = menu.AppendSubMenu(mapmenu,'Maps as','Export density map(s)') 2553 2554 sasdmenu = wx.Menu() 2555 item = menu.AppendSubMenu(sasdmenu,'Small angle data as','Export small angle histogram(s)') 2553 2556 2554 2557 # sequential exports are handled differently; N.B. enabled in testSeqRefineMode … … 2580 2583 elif typ == "map": 2581 2584 submenu = mapmenu 2585 elif typ == "sasd": 2586 submenu = sasdmenu 2582 2587 # elif typ == "pdf": 2583 2588 # submenu = pdfmenu … … 5044 5049 for lbl,txt in (('Phase','Export selected phase(s)'), 5045 5050 ('Project','Export entire sequential fit'), 5046 ('Powder','Export selected powder histogram(s)') 5051 ('Powder','Export selected powder histogram(s)'), 5052 ('sasd','Export selected small angle histogram(s)') 5047 5053 ): 5048 5054 objlist = [] -
TabularUnified trunk/GSASIIplot.py ¶
r3819 r3825 4982 4982 Plot.set_title('Size Distribution') 4983 4983 Plot.set_xlabel(r'$D, \AA$',fontsize=14) 4984 Plot.set_ylabel(r'$Volume distributionf(D)$',fontsize=14)4984 Plot.set_ylabel(r'$Volume\ distribution,\ f(D)$',fontsize=14) 4985 4985 if data['Size']['logBins']: 4986 4986 Plot.set_xscale("log",nonposx='mask') -
TabularUnified trunk/GSASIIpy3.py ¶
r3136 r3825 111 111 else: # in range where g formatting should do what I want 112 112 # used? 113 decimals = digits[0] - 1113 decimals = digits[0] - 6 114 114 fmt = "{" + (":{:d}.{:d}g".format(digits[0],decimals))+"}" 115 115 try: -
TabularUnified trunk/GSASIIstrMath.py ¶
r3821 r3825 1609 1609 fbm = (Q*TMcorr[nxs,:,nxs,nxs,:]*sinm[nxs,:,nxs,:,:]*SMag[nxs,nxs,:,:,:]) 1610 1610 1611 fas = np.sum(np.sum(fam,axis=-1) **2,axis=-1)#xyz,Nref,ntau; sum ops & atoms1612 fbs = np.sum(np.sum(fbm,axis=-1) **2,axis=-1)#ditto1611 fas = np.sum(np.sum(fam,axis=-1),axis=-1)/ngl #xyz,Nref,ntau; sum ops & atoms 1612 fbs = np.sum(np.sum(fbm,axis=-1),axis=-1)/ngl #ditto 1613 1613 1614 refl.T[10] = np.sum(np.sum(fas,axis= 0)/ngl,axis=-1)+np.sum(np.sum(fbs,axis=0)/ngl,axis=-1)#square of sums1614 refl.T[10] = np.sum(np.sum(fas,axis=-1),axis=0)**2+np.sum(np.sum(fbs,axis=-1),axis=0)**2 #square of sums 1615 1615 # refl.T[11] = mphase[:,0,0] #ignore f' & f" 1616 1616 -
TabularUnified trunk/exports/G2export_csv.py ¶
r3738 r3825 354 354 print(hist+' reflections written to file '+self.fullpath) 355 355 356 class ExportSASDCSV(G2IO.ExportBaseclass): 357 '''Used to create a csv file for a small angle data set 358 359 :param wx.Frame G2frame: reference to main GSAS-II frame 360 ''' 361 def __init__(self,G2frame): 362 super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__ 363 G2frame=G2frame, 364 formatName = 'CSV file', 365 extension='.csv', 366 longFormatName = 'Export small angle data as comma-separated (csv) file' 367 ) 368 self.exporttype = ['sasd'] 369 #self.multiple = False # only allow one histogram to be selected 370 self.multiple = True 371 372 def Writer(self,TreeName,filename=None): 373 self.OpenFile(filename) 374 histblk = self.Histograms[TreeName] 375 if len(self.Histograms[TreeName]['Models']['Size']['Distribution']): 376 self.Write('"Size Distribution"') 377 Distr = np.array(self.Histograms[TreeName]['Models']['Size']['Distribution']) 378 WriteList(self,("bin_pos","bin_width","bin_value")) 379 digitList = 2*((13,3),)+((13,4,'g'),) 380 for bindata in Distr.T: 381 line = "" 382 for val,digits in zip(bindata,digitList): 383 if line: line += ',' 384 line += G2py3.FormatValue(val,digits) 385 self.Write(line) 386 self.Write('"Small angle data"') 387 Parms = self.Histograms[TreeName]['Instrument Parameters'][0] 388 for parm in Parms: 389 if parm in ['Type','Source',]: 390 line = '"Instparm: %s","%s"'%(parm,Parms[parm][0]) 391 elif parm in ['Lam',]: 392 line = '"Instparm: %s",%10.6f'%(parm,Parms[parm][1]) 393 else: 394 line = '"Instparm: %s",%10.2f'%(parm,Parms[parm][1]) 395 self.Write(line) 396 WriteList(self,("q","y_obs","y_sig","y_calc","y_bkg")) 397 digitList = 5*((13,5,'g'),) 398 for vallist in zip(histblk['Data'][0], 399 histblk['Data'][1], 400 1./np.sqrt(histblk['Data'][2]), 401 histblk['Data'][3], 402 histblk['Data'][4], 403 ): 404 line = "" 405 for val,digits in zip(vallist,digitList): 406 if line: line += ',' 407 line += G2py3.FormatValue(val,digits) 408 self.Write(line) 409 self.CloseFile() 410 411 def Exporter(self,event=None): 412 '''Export a set of small angle data as a csv file 413 ''' 414 # the export process starts here 415 self.InitExport(event) 416 # load all of the tree into a set of dicts 417 self.loadTree() 418 if self.ExportSelect( # set export parameters 419 AskFile='single' # get a file name/directory to save in 420 ): return 421 filenamelist = [] 422 for hist in self.histnam: 423 if len(self.histnam) == 1: 424 name = self.filename 425 else: # multiple files: create a unique name from the histogram 426 name = self.MakePWDRfilename(hist) 427 fileroot = os.path.splitext(G2obj.MakeUniqueLabel(name,filenamelist))[0] 428 # create the file 429 self.filename = os.path.join(self.dirname,fileroot + self.extension) 430 self.Writer(hist) 431 print('Histogram '+hist+' written to file '+self.fullpath) 432 356 433 class ExportSingleCSV(G2IO.ExportBaseclass): 357 434 '''Used to create a csv file with single crystal reflection data
Note: See TracChangeset
for help on using the changeset viewer.