Changeset 2685


Ignore:
Timestamp:
Feb 1, 2017 11:11:59 PM (5 years ago)
Author:
vondreele
Message:

save image recalibrate all in sequential results table
allow global setting of PDFpeak parameter refinement flags

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r2684 r2685  
    21992199        self.PDFPksMenu.Append(menu=self.PDFPksEdit, title='PDF Peaks')
    22002200        self.PDFPksEdit.Append(help='Fit PDF peaks', id=wxID_PDFPKSFIT, kind=wx.ITEM_NORMAL,
    2201             text='Fit Peaks')
    2202         self.PDFPksEdit.Append(help='Fit all PDF peaks', id=wxID_PDFPKSFITALL, kind=wx.ITEM_NORMAL,
    2203             text='Fit all PDF peakss')
     2201            text='PDF peak fit')
     2202        self.PDFPksEdit.Append(help='Sequential Peak fitting for all PDFs', id=wxID_PDFPKSFITALL, kind=wx.ITEM_NORMAL,
     2203            text='Seq PDF peak fit')
    22042204        self.PDFPksEdit.Append(help='Copy PDF peaks', id=wxID_PDFCOPYPEAKS, kind=wx.ITEM_NORMAL,
    22052205            text='Copy peaks')
  • trunk/GSASIIimage.py

    r2671 r2685  
    205205    if Print:
    206206        CalibPrint(ValSig,chisq,rings.shape[0])
    207     return chisq
    208                    
     207    return [chisq,vals,sigList]
     208
    209209def ImageLocalMax(image,w,Xpix,Ypix):
    210210    'Needs a doc string'
     
    527527    if not data['calibrant']:
    528528        print 'no calibration material selected'
    529         return True   
     529        return []   
    530530    skip = data['calibskip']
    531531    dmin = data['calibdmin']
     
    572572    if not data['rings']:
    573573        print 'no rings found; try lower Min ring I/Ib'
    574         return True   
     574        return []   
    575575       
    576576    rings = np.concatenate((data['rings']),axis=0)
    577     chisq = FitDetector(rings,varyList,parmDict)
     577    [chisq,vals,sigList] = FitDetector(rings,varyList,parmDict)
    578578    data['wavelength'] = parmDict['wave']
    579579    data['distance'] = parmDict['dist']
     
    590590    print 'calibration time = %.3f'%(time.time()-time0)
    591591    G2plt.PlotImage(G2frame,newImage=True)       
    592     return True
     592    return [vals,varyList,sigList,parmDict]
    593593           
    594594def ImageCalibrate(G2frame,data):
     
    715715            varyList = [item for item in varyDict if varyDict[item]]
    716716            if len(Ringp) > 10:
    717                 chip = FitDetector(np.array(Ring0+Ringp),varyList,parmDict,True)
     717                chip = FitDetector(np.array(Ring0+Ringp),varyList,parmDict,True)[0]
    718718                tiltp = parmDict['tilt']
    719719                phip = parmDict['phi']
     
    727727            if len(Ringm) > 10:
    728728                parmDict['tilt'] *= -1
    729                 chim = FitDetector(np.array(Ring0+Ringm),varyList,parmDict,True)
     729                chim = FitDetector(np.array(Ring0+Ringm),varyList,parmDict,True)[0]
    730730                tiltm = parmDict['tilt']
    731731                phim = parmDict['phi']
     
    769769            rings = np.concatenate((data['rings']),axis=0)
    770770            if i:
    771                 chisq = FitDetector(rings,varyList,parmDict,False)
     771                chisq = FitDetector(rings,varyList,parmDict,False)[0]
    772772                data['distance'] = parmDict['dist']
    773773                data['center'] = [parmDict['det-X'],parmDict['det-Y']]
     
    789789    N = len(data['ellipses'])
    790790    if N > 2:
    791         FitDetector(rings,varyList,parmDict)
     791        FitDetector(rings,varyList,parmDict)[0]
    792792        data['wavelength'] = parmDict['wave']
    793793        data['distance'] = parmDict['dist']
  • trunk/GSASIIimgGUI.py

    r2684 r2685  
    180180        try:
    181181            if dlg.ShowModal() == wx.ID_OK:
     182                SeqResult = {}
    182183                items = dlg.GetSelections()
    183184                G2frame.EnablePlot = False
     185                names = []
    184186                for item in items:
    185187                    name = Names[item]
     188                    names.append(name)
    186189                    print 'calibrating',name
    187190                    G2frame.Image = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,name)
     
    192195                    Mid = G2gd.GetPatternTreeItemId(G2frame,G2frame.Image,'Masks')
    193196                    Masks = G2frame.PatternTree.GetItemPyData(Mid)
    194                     G2img.ImageRecalibrate(G2frame,Data,Masks)
     197                    vals,varyList,sigList,parmDict = G2img.ImageRecalibrate(G2frame,Data,Masks)
     198                    SeqResult[name] = {'variables':vals,'varyList':varyList,'sig':sigList,'Rvals':[],
     199                        'covMatrix':np.eye(len(varyList)),'title':name,'parmDict':parmDict}
     200                SeqResult['histNames'] = names
     201                Id =  G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Sequential image calibration results')
     202                if Id:
     203                    G2frame.PatternTree.SetItemPyData(Id,SeqResult)
     204                else:
     205                    Id = G2frame.PatternTree.AppendItem(parent=G2frame.root,text='Sequential image calibration results')
     206                    G2frame.PatternTree.SetItemPyData(Id,SeqResult)
    195207        finally:
    196208            dlg.Destroy()
     209        print 'All selected images recalibrated - results in Sequential image calibration results'
    197210        G2plt.PlotExposedImage(G2frame,event=None)
    198211        wx.CallLater(100,UpdateImageControls,G2frame,data,masks)
  • trunk/GSASIIpwdGUI.py

    r2681 r2685  
    53215321    def peakSizer():
    53225322       
     5323        def PeaksRefine(event):
     5324            c =  event.GetCol()
     5325            if PDFPeaks.GetColLabelValue(c) == 'refine':
     5326                choice = ['P - position','M - magnitude','S - standrd deviation']
     5327                dlg = wx.MultiChoiceDialog(G2frame,'Select','Refinement controls',choice)
     5328                if dlg.ShowModal() == wx.ID_OK:
     5329                    sel = dlg.GetSelections()
     5330                    parms = ''
     5331                    for x in sel:
     5332                        parms += choice[x][0]
     5333                    for peak in peaks['Peaks']:
     5334                        peak[3] = parms
     5335                dlg.Destroy()
     5336                wx.CallAfter(UpdatePDFPeaks,G2frame,peaks,data)
     5337               
     5338       
    53235339        atms = ','.join(data['ElList'].keys())
    53245340        colLabels = ['position','magnitude','sig','refine','Atom A','Atom B','Cooord. No.']
     
    53325348        PDFPeaks.SetRowLabelSize(40)
    53335349        PDFPeaks.AutoSizeColumns(False)
     5350        PDFPeaks.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, PeaksRefine)
    53345351
    53355352        peakBox = wx.BoxSizer(wx.VERTICAL)
Note: See TracChangeset for help on using the changeset viewer.