Changeset 4345
- Timestamp:
- Mar 6, 2020 3:05:22 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/G2compare.py
r4339 r4345 278 278 wx.CallAfter(oldmenu.Destroy) 279 279 if self.getMode() == "Histogram": 280 pass 280 item = modeMenu.Append(wx.ID_ANY,'Prince test') 281 self.Bind(wx.EVT_MENU, self.onHistPrinceTest, id=item.GetId()) 281 282 elif self.getMode() == "Phase": 282 283 pass … … 568 569 item, cookie = self.GPXtree.GetNextChild(self.root, cookie) 569 570 if len(items) < 2: 570 G2G.G2MessageBox(self,'F-test requires two more moreprojects','Need more projects')571 G2G.G2MessageBox(self,'F-test requires two projects','Need more projects') 571 572 return 572 573 elif len(items) == 2: … … 666 667 msg += postmsg 667 668 G2G.G2MessageBox(self,msg,'F-test result') 668 669 670 def onHistPrinceTest(self,event): 671 '''Compare two histograms (selected here if more than two are present) 672 using the statistical test proposed by Ted Prince in 673 Acta Cryst. B35 1099-1100. (1982). Also see Int. Tables Vol. C 674 (1st Ed.) chapter 8.4, 618-621 (1995). 675 ''' 676 items = [] 677 item, cookie = self.GPXtree.GetFirstChild(self.root) 678 while item: 679 items.append(item) 680 item, cookie = self.GPXtree.GetNextChild(self.root, cookie) 681 682 if len(items) < 2: 683 G2G.G2MessageBox(self,'Prince test requires two histograms','Need more') 684 return 685 elif len(items) == 2: 686 s0,s1 = items 687 else: 688 # need to make selection here 689 sel = [] 690 for i in items: 691 sel.append(self.GPXtree.GetItemText(i)) 692 dlg = G2G.G2SingleChoiceDialog(self,'Select one refinement', 693 'Choose refinement',sel) 694 if dlg.ShowModal() == wx.ID_OK: 695 s0 = dlg.GetSelection() 696 dlg.Destroy() 697 else: 698 dlg.Destroy() 699 return 700 inds = list(range(len(items))) 701 del sel[s0] 702 del inds[s0] 703 dlg = G2G.G2SingleChoiceDialog(self,'Select comparison refinement', 704 'Choose refinement',sel) 705 if dlg.ShowModal() == wx.ID_OK: 706 s1 = dlg.GetSelection() 707 s1 = inds[s1] 708 dlg.Destroy() 709 else: 710 dlg.Destroy() 711 return 712 model0 = self.GPXtree.GetItemPyData(s0) 713 data0 = model0[1] 714 model1 = self.GPXtree.GetItemPyData(s1) 715 data1 = model1[1] 716 if len(data0[0]) != len(data1[0]): 717 G2G.G2MessageBox(self,'Unable to test: differing numbers of data points','Comparison not valid') 718 return 719 if max(abs((data0[0]-data1[0])/data0[0])) > 0.01: 720 G2G.G2MessageBox(self,'Unable to use test: "X" values differ','Comparison not valid') 721 return 722 X = data0[3] - data1[3] 723 #Z = np.sqrt(data0[3]) * (data0[1] - (data0[3] + data1[3])/2) 724 X = (data0[3] - data1[3]) / np.sqrt(data0[1]) 725 Z = (data0[1] - (data0[3] + data1[3])/2) / np.sqrt(data0[1]) 726 lam = np.sum(X*Z) / np.sum(X) 727 sig = np.sqrt( 728 (np.sum(Z*Z) - lam*lam*np.sum(X*X)) / 729 ((len(data0[0]) - 1) * np.sum(X*X)) 730 ) 731 732 0 the x-postions (two-theta in degrees), 733 1 the intensity values (Yobs), 734 2 the weights for each Yobs value 735 3 the computed intensity values (Ycalc) 736 4 the background values 737 5 Yobs-Ycalc 738 739 GSASIIpath.IPyBreak_base() 740 741 #====================================================================== 669 742 if __name__ == '__main__': 670 743 #if sys.platform == "darwin": -
trunk/GSASIIIO.py
r4343 r4345 345 345 Data['calibrant'] = '' 346 346 Data['IOtth'] = [5.0,50.0] 347 if GSASIIpath.GetConfigValue('Image_2theta_min'): 348 try: 349 Data['IOtth'][0] = float(GSASIIpath.GetConfigValue('Image_2theta_min')) 350 except: 351 pass 352 if GSASIIpath.GetConfigValue('Image_2theta_max'): 353 try: 354 Data['IOtth'][1] = float(GSASIIpath.GetConfigValue('Image_2theta_max')) 355 except: 356 pass 347 357 Data['LRazimuth'] = [0.,180.] 348 358 Data['azmthOff'] = 0.0 -
trunk/GSASIIautoInt.py
r4343 r4345 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 #GSAS-II autointegration routines 4 ########### SVN repository information ################### 5 # $Date: $ 6 # $Author: $ 7 # $Revision: $ 8 # $URL: $ 9 # $Id: $ 10 ########### SVN repository information ################### 1 11 ''' 2 12 *GSASIIautoint: autointegration routines* -
trunk/GSASIIctrlGUI.py
r4330 r4345 1070 1070 :param wx.Panel parent: the parent to the :class:`~wxpython.ComboBox` (usually a 1071 1071 frame or panel) 1072 :param d ict dct: a dict (or list)to contain the value set1072 :param dct: a dict or list to contain the value set 1073 1073 for the :class:`~wxpython.ComboBox`. 1074 1074 :param item: the dict key (or list index) where ``dct[item]`` will … … 1094 1094 The default for :data:`values` is to use the same list as 1095 1095 specified for :data:`choices`. 1096 :param function onChange: an optional routine that will be called 1097 when the 1098 :class:`~wxpython.ComboBox` can be specified. 1096 1099 :param (other): additional keyword arguments accepted by 1097 1100 :class:`~wxpython.ComboBox` can be specified. 1098 1101 ''' 1099 def __init__(self,parent,dct,item,choices,values=None, **kw):1102 def __init__(self,parent,dct,item,choices,values=None,OnChange=None,**kw): 1100 1103 if values is None: 1101 1104 values = choices … … 1113 1116 self.dct = dct 1114 1117 self.item = item 1118 self.OnChange = OnChange 1115 1119 self.Bind(wx.EVT_COMBOBOX, self.onSelection) 1116 1120 def onSelection(self,event): … … 1120 1124 else: 1121 1125 self.dct[self.item] = self.values[0] # unknown 1126 if self.OnChange: self.OnChange(event) 1122 1127 1123 1128 ################################################################################ … … 4707 4712 return d 4708 4713 4714 inhibitSave = False 4709 4715 def SaveConfigVars(vars,parent=None): 4710 4716 '''Write the current config variable values to config.py … … 4716 4722 :returns: True if unable to write the file, None otherwise 4717 4723 ''' 4724 if inhibitSave: 4725 if GSASIIpath.GetConfigValue('debug'): 4726 print('inhibitSave prevents saving configuration') 4727 return 4728 4718 4729 # try to write to where an old config file is located 4719 4730 try: … … 4878 4889 GSASIIpath.SetConfigValue(self.vars) 4879 4890 self.EndModal(wx.ID_OK) 4891 global inhibitSave 4892 if event is not None: inhibitSave = True 4880 4893 import GSASIImpsubs as G2mp 4881 4894 G2mp.ResetMP() … … 4885 4898 as the current settings 4886 4899 ''' 4900 global inhibitSave 4901 inhibitSave = False 4887 4902 if not SaveConfigVars(self.vars,parent=self): 4888 4903 self.OnApplyChanges() # force a reload of the config settings … … 4963 4978 style=wx.CB_READONLY|wx.CB_DROPDOWN) 4964 4979 self.colSel.Bind(wx.EVT_COMBOBOX, OnNewColorBar) 4980 self.varsizer.Add(self.colSel, 0, wx.ALIGN_CENTRE|wx.ALL, 5) 4981 elif var == 'Image_calibrant': 4982 import ImageCalibrants as calFile 4983 calList = sorted([m for m in calFile.Calibrants.keys()], 4984 key=lambda s: s.lower()) 4985 self.colSel = EnumSelector(self,self.vars[var],1,calList, 4986 OnChange=self.OnChange) 4965 4987 self.varsizer.Add(self.colSel, 0, wx.ALIGN_CENTRE|wx.ALL, 5) 4966 4988 else: -
trunk/GSASIIimgGUI.py
r4343 r4345 1337 1337 comboSizer = wx.BoxSizer(wx.HORIZONTAL) 1338 1338 comboSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Calibrant '),0,WACV) 1339 if (GSASIIpath.GetConfigValue('Image_calibrant') and 1340 GSASIIpath.GetConfigValue('Image_calibrant') in calList and 1341 not data['calibrant']): 1342 data['calibrant'] = GSASIIpath.GetConfigValue('Image_calibrant') 1339 1343 calSel = wx.ComboBox(parent=G2frame.dataWindow,value=data['calibrant'],choices=calList, 1340 1344 style=wx.CB_READONLY|wx.CB_DROPDOWN) -
trunk/config_example.py
r4085 r4345 127 127 128 128 Autoscale_ParmNames = ['userComment2',r'extraInputs\1\extraInputs','Ion_Chamber_I0',] 129 '''Gives the possible selection of incident monitor names as found in an image metadata file. 130 Used in AutoIntegration 131 ''' 129 132 DefaultAutoScale = "userComment2" 130 '''Gives the possible selection of incident monitor names as found in an image metadata file. 131 DefaultAutoScale must be one of the AutoScale_ParmNames 133 '''DefaultAutoScale selects one of the AutoScale_ParmNames. 132 134 Used in AutoIntegration 133 135 ''' … … 204 206 '''A list of previously used .gpx files 205 207 ''' 208 209 Image_calibrant = '' 210 ''' Specifies a default calibrant material for images. Will be applied for 211 newly-read images, but if changed the specified material will be saved. 212 ''' 213 214 Image_2theta_min = 5.0 215 ''' Specifies a default 2-theta minimum used for calibration and integration 216 as the Inner 2-theta value. Will be applied for 217 newly-read images, but if changed the new value will be saved. 218 ''' 219 220 Image_2theta_max = 50.0 221 ''' Specifies a default 2-theta maximum used for calibration and integration 222 as the Outer 2-theta value. Will be applied for 223 newly-read images, but if changed the new value will be saved. 224 '''
Note: See TracChangeset
for help on using the changeset viewer.