Changeset 3326 for trunk


Ignore:
Timestamp:
Mar 29, 2018 3:52:00 PM (7 years ago)
Author:
vondreele
Message:

fix missing setdist error in Copy selected for image controls
set Bruker image reader to give Ka1 for wavelength (better than Ka-bar for calibration)
modify SumDialog? to do upon request PWDR average instead of sum - works nicely with Bruker image data
some menu changes with this

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIdataGUI.py

    r3305 r3326  
    477477        item = parent.Append(wx.ID_ANY,'Read Powder Pattern Peaks...','')
    478478        self.Bind(wx.EVT_MENU, self.OnReadPowderPeaks, id=item.GetId())
    479         item = parent.Append(wx.ID_ANY,'Sum powder data','')
     479        item = parent.Append(wx.ID_ANY,'Sum or Average powder data','')
    480480        self.Bind(wx.EVT_MENU, self.OnPwdrSum, id=item.GetId())
    481481        item = parent.Append(wx.ID_ANY,'Sum image data','')
     
    30313031            self.text = text
    30323032            self.data = data
     3033            self.average = False
    30333034            self.selectData = copy.copy(data[:-1])
    30343035            self.selectVals = len(data)*[0.0,]
     
    30743075                ScaleAll = wx.Button(self.panel,wx.ID_ANY,'Set all above')
    30753076                ScaleAll.Bind(wx.EVT_BUTTON, self.OnAllScale)
     3077                if self.dataType == 'PWDR':
     3078                    self.Avg = wx.CheckBox(self.panel,label=' Make average?')
     3079                    self.Avg.Bind(wx.EVT_CHECKBOX,self.OnAve)
    30763080                self.dataGridSizer.Add(ScaleAll,0,wx.LEFT,10)
    3077                 self.dataGridSizer.Add((-1,-1),0,wx.RIGHT,10)
    3078                 self.dataGridSizer.Add(wx.StaticText(self.panel,-1,'Sum result name: '+self.dataType),1,
     3081                self.dataGridSizer.Add(self.Avg,0,wx.RIGHT,10)
     3082                self.dataGridSizer.Add(wx.StaticText(self.panel,-1,' Result name: '+self.dataType),1,
    30793083                    wx.LEFT|wx.ALIGN_CENTER_VERTICAL,1)
    30803084                self.name = G2G.ValidatedTxtCtrl(self.panel,self.data,-1,size=wx.Size(300,20))
     
    31023106            self.panel.Fit()
    31033107            self.Fit()
     3108           
     3109        def OnAve(self,event):
     3110            self.average = self.Avg.GetValue()
    31043111
    31053112        def OnFilter(self,event):
     
    31763183                                '\nFound:   '+str(x[0])+' '+str(x[-1])+'\nfor '+name)
    31773184                            self.OnCancel(event)
    3178                         else:
    3179                             for j,yi in enumerate(y):
    3180                                  Ysum[j] += scale*yi
    3181                                  Vsum[j] += abs(scale)*v[j]
    31823185                    else:
    31833186                        Xminmax = [x[0],x[-1]]
    31843187                        Xsum = x
    3185                         Ysum = scale*y
    3186                         Vsum = abs(scale*v)
    3187             Wsum = 1./np.array(Vsum)
     3188                    if self.dataType == 'PWDR' and self.average:
     3189                        Ysum.append(scale*y)
     3190                        Vsum.append(abs(scale)*v)
     3191                    else:
     3192                        try:
     3193                            Ysum += scale*y
     3194                            Vsum += abs(scale)*v
     3195                        except ValueError:
     3196                            Ysum = scale*y
     3197                            Vsum = abs(scale)*v
     3198            if self.dataType =='PWDR' and self.average:
     3199                maYsum = ma.masked_equal(Ysum,0)
     3200                Ysum = ma.mean(maYsum,axis=0)
     3201                Wsum = 1./np.array(Ysum)
     3202            else:
     3203                Wsum = 1./Vsum
    31883204            YCsum = np.zeros(lenX)
    31893205            YBsum = np.zeros(lenX)
     
    32193235                       
    32203236    def OnPwdrSum(self,event):
    3221         'Sum together powder data(?)'
     3237        'Sum or Average together powder data(?)'
    32223238        TextList = []
    32233239        DataList = []
    32243240        Names = []
    32253241        Inst = None
    3226         Comments = ['Sum equals: \n']
     3242        Comments = ['Sum/Average equals: \n']
    32273243        if self.GPXtree.GetCount():
    32283244            item, cookie = self.GPXtree.GetFirstChild(self.root)
     
    32373253                item, cookie = self.GPXtree.GetNextChild(self.root, cookie)
    32383254            if len(TextList) < 2:
    3239                 self.ErrorDialog('Not enough data to sum','There must be more than one "PWDR" pattern')
     3255                self.ErrorDialog('Not enough data to sum/average','There must be more than one "PWDR" pattern')
    32403256                return
    3241             TextList.append('default_sum_name')               
    3242             dlg = self.SumDialog(self,'Sum data','Enter scale for each pattern to be summed','PWDR',TextList,DataList)
     3257            TextList.append('default_ave_name')               
     3258            dlg = self.SumDialog(self,'Sum/Average data',' Enter scale for each pattern to be summed/averaged','PWDR',TextList,DataList)
    32433259            try:
    32443260                if dlg.ShowModal() == wx.ID_OK:
     
    33073323                return
    33083324            TextList.append('default_sum_name')               
    3309             dlg = self.SumDialog(self,'Sum data','Enter scale for each image to be summed','IMG',TextList,DataList)
     3325            dlg = self.SumDialog(self,'Sum data',' Enter scale for each image to be summed','IMG',TextList,DataList)
    33103326            try:
    33113327                if dlg.ShowModal() == wx.ID_OK:
     
    57495765        'average the selected columns from menu command'
    57505766        cols = sorted(G2frame.dataDisplay.GetSelectedCols()) # ignore selection order
    5751         useCol = -np.array(G2frame.SeqTable.GetColValues(0),dtype=bool)
     5767        useCol =  not np.array(G2frame.SeqTable.GetColValues(0),dtype=bool)
    57525768        if cols:
    57535769            for col in cols:
  • TabularUnified trunk/GSASIIimgGUI.py

    r3267 r3326  
    171171    if data['DetDepth'] > 0.5:
    172172        data['DetDepth'] /= data['distance']
     173    if 'setdist' not in data:
     174        data['setdist'] = data['distance']
    173175#end patch
    174176
  • TabularUnified trunk/imports/G2img_SFRM.py

    r3325 r3326  
    6161        stream = stream.decode('latin-1')
    6262    starter = 'IMG: '
    63     meanwaves = {'Cu':1.54178,'Ti':2.74963,'Cr':2.29092,'Fe':1.93728,
    64         'Co':1.79021,'Mo':0.71069,'Ag':0.56083}
     63    meanwaves = {'Cu':1.54051,'Ti':2.74841,'Cr':2.28962,'Fe':1.93597,
     64        'Co':1.78892,'Mo':0.70926,'Ag':0.559363}
    6565    imageBeg = stream.find(starter)+4
    6666    head = np.array(list(stream[:imageBeg].split('CFR:')[0]))
Note: See TracChangeset for help on using the changeset viewer.