Changeset 1239


Ignore:
Timestamp:
Mar 7, 2014 1:59:58 PM (8 years ago)
Author:
vondreele
Message:

wx.ALIGN_CENTER_VERTICAL to WACV in G2ddataGUI
fix data frame size for DData tab
consolidate common refine stuff into RefineCore? in G2strMain
comment out timing prints in G2strMath

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r1172 r1239  
    3636import numpy as np
    3737
     38WACV = wx.ALIGN_CENTER_VERTICAL
    3839VERY_LIGHT_GREY = wx.Colour(235,235,235)
    3940WHITE = wx.Colour(255,255,255)
     
    103104        if generalData['Data plot type'] == 'Preferred orientation':
    104105            POhklSizer = wx.BoxSizer(wx.HORIZONTAL)
    105             POhklSizer.Add(wx.StaticText(DData,-1,' Plot preferred orientation for H K L: '),0,wx.ALIGN_CENTER_VERTICAL)
     106            POhklSizer.Add(wx.StaticText(DData,-1,' Plot preferred orientation for H K L: '),0,WACV)
    106107            h,k,l = generalData['POhkl']
    107108            poAxis = wx.TextCtrl(DData,-1,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER)
    108109            poAxis.Bind(wx.EVT_TEXT_ENTER,OnPOhkl)
    109110            poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOhkl)
    110             POhklSizer.Add(poAxis,0,wx.ALIGN_CENTER_VERTICAL)
     111            POhklSizer.Add(poAxis,0,WACV)
    111112            plotSizer.Add(POhklSizer)           
    112113        return plotSizer
     
    136137        Indx[scaleRef.GetId()] = item
    137138        scaleRef.Bind(wx.EVT_CHECKBOX, OnScaleRef)
    138         scaleSizer.Add(scaleRef,0,wx.ALIGN_CENTER_VERTICAL)
     139        scaleSizer.Add(scaleRef,0,WACV)
    139140        scaleVal = wx.TextCtrl(DData,wx.ID_ANY,
    140141            '%.4f'%(UseList[item]['Scale'][0]),style=wx.TE_PROCESS_ENTER)
     
    142143        scaleVal.Bind(wx.EVT_TEXT_ENTER,OnScaleVal)
    143144        scaleVal.Bind(wx.EVT_KILL_FOCUS,OnScaleVal)
    144         scaleSizer.Add(scaleVal,0,wx.ALIGN_CENTER_VERTICAL)
     145        scaleSizer.Add(scaleVal,0,WACV)
    145146        return scaleSizer
    146147       
     
    552553    def TopSizer(name,choices,parm,OnType):
    553554        topSizer = wx.BoxSizer(wx.HORIZONTAL)
    554         topSizer.Add(wx.StaticText(DData,-1,name),0,wx.ALIGN_CENTER_VERTICAL)
     555        topSizer.Add(wx.StaticText(DData,-1,name),0,WACV)
    555556        sizeType = wx.ComboBox(DData,wx.ID_ANY,value=UseList[item][parm][0],choices=choices,
    556557            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     
    568569        Indx[lgmixRef.GetId()] = [item,name]
    569570        lgmixRef.Bind(wx.EVT_CHECKBOX, OnRef)
    570         lgmixSizer.Add(lgmixRef,0,wx.ALIGN_CENTER_VERTICAL)
     571        lgmixSizer.Add(lgmixRef,0,WACV)
    571572        lgmixVal = wx.TextCtrl(DData,wx.ID_ANY,
    572573            '%.4f'%(UseList[item][name][1][2]),style=wx.TE_PROCESS_ENTER)
     
    574575        lgmixVal.Bind(wx.EVT_TEXT_ENTER,OnVal)
    575576        lgmixVal.Bind(wx.EVT_KILL_FOCUS,OnVal)
    576         lgmixSizer.Add(lgmixVal,0,wx.ALIGN_CENTER_VERTICAL)
     577        lgmixSizer.Add(lgmixVal,0,WACV)
    577578        return lgmixSizer
    578579                   
     
    585586        Indx[reset.GetId()] = [item,name]
    586587        reset.Bind(wx.EVT_CHECKBOX,OnReset)
    587         resetSizer.Add(reset,0,wx.ALIGN_CENTER_VERTICAL)
     588        resetSizer.Add(reset,0,WACV)
    588589        return resetSizer
    589590       
     
    595596        Indx[sizeRef.GetId()] = [item,0]
    596597        sizeRef.Bind(wx.EVT_CHECKBOX, OnRef)
    597         isoSizer.Add(sizeRef,0,wx.ALIGN_CENTER_VERTICAL)
     598        isoSizer.Add(sizeRef,0,WACV)
    598599        sizeVal = wx.TextCtrl(DData,wx.ID_ANY,
    599600            fmt%(UseList[item][parm][1][0]),style=wx.TE_PROCESS_ENTER)
     
    601602        sizeVal.Bind(wx.EVT_TEXT_ENTER,OnVal)
    602603        sizeVal.Bind(wx.EVT_KILL_FOCUS,OnVal)
    603         isoSizer.Add(sizeVal,0,wx.ALIGN_CENTER_VERTICAL)
     604        isoSizer.Add(sizeVal,0,WACV)
    604605        return isoSizer
    605606       
    606607    def UniSizer(parm,OnAxis):
    607608        uniSizer = wx.BoxSizer(wx.HORIZONTAL)
    608         uniSizer.Add(wx.StaticText(DData,-1,' Unique axis, H K L: '),0,wx.ALIGN_CENTER_VERTICAL)
     609        uniSizer.Add(wx.StaticText(DData,-1,' Unique axis, H K L: '),0,WACV)
    609610        h,k,l = UseList[item][parm][3]
    610611        Axis = wx.TextCtrl(DData,-1,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER)
     
    612613        Axis.Bind(wx.EVT_TEXT_ENTER,OnAxis)
    613614        Axis.Bind(wx.EVT_KILL_FOCUS,OnAxis)
    614         uniSizer.Add(Axis,0,wx.ALIGN_CENTER_VERTICAL)
     615        uniSizer.Add(Axis,0,WACV)
    615616        return uniSizer
    616617       
     
    625626            Indx[sizeRef.GetId()] = [item,id]
    626627            sizeRef.Bind(wx.EVT_CHECKBOX, OnRef)
    627             dataSizer.Add(sizeRef,0,wx.ALIGN_CENTER_VERTICAL)
     628            dataSizer.Add(sizeRef,0,WACV)
    628629            sizeVal = wx.TextCtrl(DData,wx.ID_ANY,fmt%(val),style=wx.TE_PROCESS_ENTER)
    629630            Indx[sizeVal.GetId()] = [item,id]
    630631            sizeVal.Bind(wx.EVT_TEXT_ENTER,OnVal)
    631632            sizeVal.Bind(wx.EVT_KILL_FOCUS,OnVal)
    632             dataSizer.Add(sizeVal,0,wx.ALIGN_CENTER_VERTICAL)
     633            dataSizer.Add(sizeVal,0,WACV)
    633634            dataSizer.Add((5,0),0)
    634635        return dataSizer
     
    644645            Indx[sizeRef.GetId()] = [item,id]
    645646            sizeRef.Bind(wx.EVT_CHECKBOX, OnSizeRef)
    646             dataSizer.Add(sizeRef,0,wx.ALIGN_CENTER_VERTICAL)
     647            dataSizer.Add(sizeRef,0,WACV)
    647648            sizeVal = wx.TextCtrl(DData,wx.ID_ANY,'%.3f'%(val),style=wx.TE_PROCESS_ENTER)
    648649            Indx[sizeVal.GetId()] = [item,id]
    649650            sizeVal.Bind(wx.EVT_TEXT_ENTER,OnSizeVal)
    650651            sizeVal.Bind(wx.EVT_KILL_FOCUS,OnSizeVal)
    651             dataSizer.Add(sizeVal,0,wx.ALIGN_CENTER_VERTICAL)
     652            dataSizer.Add(sizeVal,0,WACV)
    652653        return dataSizer
    653654       
     
    666667            Indx[strainRef.GetId()] = [item,id]
    667668            strainRef.Bind(wx.EVT_CHECKBOX, OnStrainRef)
    668             dataSizer.Add(strainRef,0,wx.ALIGN_CENTER_VERTICAL)
     669            dataSizer.Add(strainRef,0,WACV)
    669670            strainVal = wx.TextCtrl(DData,wx.ID_ANY,'%.5f'%(val),style=wx.TE_PROCESS_ENTER)
    670671            Indx[strainVal.GetId()] = [item,id]
    671672            strainVal.Bind(wx.EVT_TEXT_ENTER,OnStrainVal)
    672673            strainVal.Bind(wx.EVT_KILL_FOCUS,OnStrainVal)
    673             dataSizer.Add(strainVal,0,wx.ALIGN_CENTER_VERTICAL)
     674            dataSizer.Add(strainVal,0,WACV)
    674675        return dataSizer
    675676
     
    684685            Indx[hstrainRef.GetId()] = [item,id]
    685686            hstrainRef.Bind(wx.EVT_CHECKBOX, OnHstrainRef)
    686             hstrainSizer.Add(hstrainRef,0,wx.ALIGN_CENTER_VERTICAL)
     687            hstrainSizer.Add(hstrainRef,0,WACV)
    687688            hstrainVal = wx.TextCtrl(DData,wx.ID_ANY,'%.5f'%(val),style=wx.TE_PROCESS_ENTER)
    688689            Indx[hstrainVal.GetId()] = [item,id]
    689690            hstrainVal.Bind(wx.EVT_TEXT_ENTER,OnHstrainVal)
    690691            hstrainVal.Bind(wx.EVT_KILL_FOCUS,OnHstrainVal)
    691             hstrainSizer.Add(hstrainVal,0,wx.ALIGN_CENTER_VERTICAL)
     692            hstrainSizer.Add(hstrainVal,0,WACV)
    692693        return hstrainSizer
    693694       
     
    696697        choice = ['March-Dollase','Spherical harmonics']
    697698        POtype = choice[['MD','SH'].index(POData[0])]
    698         poSizer.Add(wx.StaticText(DData,-1,' Preferred orientation model '),0,wx.ALIGN_CENTER_VERTICAL)
     699        poSizer.Add(wx.StaticText(DData,-1,' Preferred orientation model '),0,WACV)
    699700        POType = wx.ComboBox(DData,wx.ID_ANY,value=POtype,choices=choice,
    700701            style=wx.CB_READONLY|wx.CB_DROPDOWN)
     
    703704        poSizer.Add(POType)
    704705        if POData[0] == 'SH':
    705             poSizer.Add(wx.StaticText(DData,-1,' Harmonic order: '),0,wx.ALIGN_CENTER_VERTICAL)
     706            poSizer.Add(wx.StaticText(DData,-1,' Harmonic order: '),0,WACV)
    706707            poOrder = wx.ComboBox(DData,wx.ID_ANY,value=str(POData[4]),choices=[str(2*i) for i in range(18)],
    707708                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    708709            Indx[poOrder.GetId()] = item
    709710            poOrder.Bind(wx.EVT_COMBOBOX,OnPOOrder)
    710             poSizer.Add(poOrder,0,wx.ALIGN_CENTER_VERTICAL)
     711            poSizer.Add(poOrder,0,WACV)
    711712            poRef = wx.CheckBox(DData,-1,label=' Refine? ')
    712713            poRef.SetValue(POData[2])
    713714            Indx[poRef.GetId()] = item
    714715            poRef.Bind(wx.EVT_CHECKBOX,OnPORef)
    715             poSizer.Add(poRef,0,wx.ALIGN_CENTER_VERTICAL)
     716            poSizer.Add(poRef,0,WACV)
    716717        return poSizer
    717718       
     
    722723        Indx[poRef.GetId()] = item
    723724        poRef.Bind(wx.EVT_CHECKBOX,OnPORef)
    724         poSizer.Add(poRef,0,wx.ALIGN_CENTER_VERTICAL)
     725        poSizer.Add(poRef,0,WACV)
    725726        poVal = wx.TextCtrl(DData,wx.ID_ANY,
    726727            '%.3f'%(POData[1]),style=wx.TE_PROCESS_ENTER)
     
    728729        poVal.Bind(wx.EVT_TEXT_ENTER,OnPOVal)
    729730        poVal.Bind(wx.EVT_KILL_FOCUS,OnPOVal)
    730         poSizer.Add(poVal,0,wx.ALIGN_CENTER_VERTICAL)
    731         poSizer.Add(wx.StaticText(DData,-1,' Unique axis, H K L: '),0,wx.ALIGN_CENTER_VERTICAL)
     731        poSizer.Add(poVal,0,WACV)
     732        poSizer.Add(wx.StaticText(DData,-1,' Unique axis, H K L: '),0,WACV)
    732733        h,k,l =POData[3]
    733734        poAxis = wx.TextCtrl(DData,-1,'%3d %3d %3d'%(h,k,l),style=wx.TE_PROCESS_ENTER)
     
    735736        poAxis.Bind(wx.EVT_TEXT_ENTER,OnPOAxis)
    736737        poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOAxis)
    737         poSizer.Add(poAxis,0,wx.ALIGN_CENTER_VERTICAL)
     738        poSizer.Add(poAxis,0,WACV)
    738739        return poSizer
    739740       
    740741    def SHDataSizer(POData):
    741742        textJ = G2lat.textureIndex(POData[5])
    742         mainSizer.Add(wx.StaticText(DData,-1,' Spherical harmonic coefficients: '+'Texture index: %.3f'%(textJ)),0,wx.ALIGN_CENTER_VERTICAL)
     743        mainSizer.Add(wx.StaticText(DData,-1,' Spherical harmonic coefficients: '+'Texture index: %.3f'%(textJ)),0,WACV)
    743744        mainSizer.Add((0,5),0)
    744745        ODFSizer = wx.FlexGridSizer(2,8,2,2)
     
    747748        ODFkeys.sort()
    748749        for odf in ODFkeys:
    749             ODFSizer.Add(wx.StaticText(DData,-1,odf),0,wx.ALIGN_CENTER_VERTICAL)
     750            ODFSizer.Add(wx.StaticText(DData,-1,odf),0,WACV)
    750751            ODFval = wx.TextCtrl(DData,wx.ID_ANY,'%8.3f'%(POData[5][odf]),style=wx.TE_PROCESS_ENTER)
    751752            ODFIndx[ODFval.GetId()] = odf
    752753#             ODFval.Bind(wx.EVT_TEXT_ENTER,OnODFValue)
    753754#             ODFval.Bind(wx.EVT_KILL_FOCUS,OnODFValue)
    754             ODFSizer.Add(ODFval,0,wx.ALIGN_CENTER_VERTICAL)
     755            ODFSizer.Add(ODFval,0,WACV)
    755756        return ODFSizer
    756757       
     
    761762        Indx[extRef.GetId()] = item
    762763        extRef.Bind(wx.EVT_CHECKBOX, OnExtRef)
    763         extSizer.Add(extRef,0,wx.ALIGN_CENTER_VERTICAL)
     764        extSizer.Add(extRef,0,WACV)
    764765        extVal = wx.TextCtrl(DData,wx.ID_ANY,
    765766            '%.2f'%(UseList[item]['Extinction'][0]),style=wx.TE_PROCESS_ENTER)
     
    767768        extVal.Bind(wx.EVT_TEXT_ENTER,OnExtVal)
    768769        extVal.Bind(wx.EVT_KILL_FOCUS,OnExtVal)
    769         extSizer.Add(extVal,0,wx.ALIGN_CENTER_VERTICAL)
     770        extSizer.Add(extVal,0,WACV)
    770771        return extSizer
    771772   
     
    773774        extSizer = wx.BoxSizer(wx.VERTICAL)
    774775        typeSizer = wx.BoxSizer(wx.HORIZONTAL)           
    775         typeSizer.Add(wx.StaticText(DData,-1,' Extinction type: '),0,wx.ALIGN_CENTER_VERTICAL)
     776        typeSizer.Add(wx.StaticText(DData,-1,' Extinction type: '),0,WACV)
    776777        Choices = ['None','Primary','Secondary Type I','Secondary Type II','Secondary Type I & II']
    777778        typeTxt = wx.ComboBox(DData,-1,choices=Choices,value=UseList[item]['Extinction'][1],
     
    780781        typeTxt.Bind(wx.EVT_COMBOBOX,OnSCExtType)
    781782        typeSizer.Add(typeTxt)
    782         typeSizer.Add(wx.StaticText(DData,-1,' Approx: '),0,wx.ALIGN_CENTER_VERTICAL)
     783        typeSizer.Add(wx.StaticText(DData,-1,' Approx: '),0,WACV)
    783784        Choices=['Lorentzian','Gaussian']
    784785        approxTxT = wx.ComboBox(DData,-1,choices=Choices,value=UseList[item]['Extinction'][0],
     
    787788        approxTxT.Bind(wx.EVT_COMBOBOX,OnSCExtType)
    788789        typeSizer.Add(approxTxT)
    789         extSizer.Add(typeSizer,0,wx.ALIGN_CENTER_VERTICAL)
     790        extSizer.Add(typeSizer,0,WACV)
    790791        if UseList[item]['Extinction'][1] != 'None':
    791792            extSizer.Add((0,5),)
    792793            valSizer =wx.BoxSizer(wx.HORIZONTAL)
    793             valSizer.Add(wx.StaticText(DData,-1,' Tbar(mm):'),0,wx.ALIGN_CENTER_VERTICAL)
     794            valSizer.Add(wx.StaticText(DData,-1,' Tbar(mm):'),0,WACV)
    794795            tbarVal = wx.TextCtrl(DData,wx.ID_ANY,
    795796                '%.3f'%(UseList[item]['Extinction'][2]['Tbar']),style=wx.TE_PROCESS_ENTER)
     
    797798            tbarVal.Bind(wx.EVT_TEXT_ENTER,OnTbarVal)
    798799            tbarVal.Bind(wx.EVT_KILL_FOCUS,OnTbarVal)
    799             valSizer.Add(tbarVal,0,wx.ALIGN_CENTER_VERTICAL)
    800             valSizer.Add(wx.StaticText(DData,-1,' cos(2ThM):'),0,wx.ALIGN_CENTER_VERTICAL)
     800            valSizer.Add(tbarVal,0,WACV)
     801            valSizer.Add(wx.StaticText(DData,-1,' cos(2ThM):'),0,WACV)
    801802            cos2tm = wx.TextCtrl(DData,wx.ID_ANY,
    802803                '%.3f'%(UseList[item]['Extinction'][2]['Cos2TM']),style=wx.TE_PROCESS_ENTER)
     
    804805            cos2tm.Bind(wx.EVT_TEXT_ENTER,OnCos2TM)
    805806            cos2tm.Bind(wx.EVT_KILL_FOCUS,OnCos2TM)
    806             valSizer.Add(cos2tm,0,wx.ALIGN_CENTER_VERTICAL)
    807             extSizer.Add(valSizer,0,wx.ALIGN_CENTER_VERTICAL)
     807            valSizer.Add(cos2tm,0,WACV)
     808            extSizer.Add(valSizer,0,WACV)
    808809            val2Sizer =wx.BoxSizer(wx.HORIZONTAL)
    809810            if 'Primary' in UseList[item]['Extinction'][1]:
     
    820821                Indx[Eref.GetId()] = [item,ekey]
    821822                Eref.Bind(wx.EVT_CHECKBOX, OnEref)
    822                 val2Sizer.Add(Eref,0,wx.ALIGN_CENTER_VERTICAL)
     823                val2Sizer.Add(Eref,0,WACV)
    823824                Eval = wx.TextCtrl(DData,wx.ID_ANY,
    824825                    '%10.3e'%(UseList[item]['Extinction'][2][ekey][0]),style=wx.TE_PROCESS_ENTER)
     
    826827                Eval.Bind(wx.EVT_TEXT_ENTER,OnEval)
    827828                Eval.Bind(wx.EVT_KILL_FOCUS,OnEval)
    828                 val2Sizer.Add(Eval,0,wx.ALIGN_CENTER_VERTICAL)
    829 
    830             extSizer.Add(val2Sizer,0,wx.ALIGN_CENTER_VERTICAL)
     829                val2Sizer.Add(Eval,0,WACV)
     830
     831            extSizer.Add(val2Sizer,0,WACV)
    831832        return extSizer
    832833       
     
    838839            Indx[babRef.GetId()] = [item,bab]
    839840            babRef.Bind(wx.EVT_CHECKBOX, OnBabRef)
    840             babSizer.Add(babRef,0,wx.ALIGN_CENTER_VERTICAL)
     841            babSizer.Add(babRef,0,WACV)
    841842            babVal = wx.TextCtrl(DData,wx.ID_ANY,
    842843                '%.3f'%(UseList[item]['Babinet']['Bab'+bab][0]),style=wx.TE_PROCESS_ENTER)
     
    844845            babVal.Bind(wx.EVT_TEXT_ENTER,OnBabVal)
    845846            babVal.Bind(wx.EVT_KILL_FOCUS,OnBabVal)
    846             babSizer.Add(babVal,0,wx.ALIGN_CENTER_VERTICAL)
     847            babSizer.Add(babVal,0,WACV)
    847848            babSizer.Add((5,5),0)
    848849        return babSizer
     
    851852        DData.GetSizer().Clear(True)
    852853    mainSizer = wx.BoxSizer(wx.VERTICAL)
    853     mainSizer.Add(wx.StaticText(DData,-1,'Histogram data for '+PhaseName+':'),0,wx.ALIGN_CENTER_VERTICAL)
     854    mainSizer.Add(wx.StaticText(DData,-1,'Histogram data for '+PhaseName+':'),0,WACV)
    854855    if PWDR:
    855856        mainSizer.Add(PlotSizer())           
     
    866867        Indx[showData.GetId()] = item
    867868        showData.Bind(wx.EVT_CHECKBOX, OnShowData)
    868         showSizer.Add(showData,0,wx.ALIGN_CENTER_VERTICAL)
     869        showSizer.Add(showData,0,WACV)
    869870        useData = wx.CheckBox(DData,-1,label='Use?')
    870871        Indx[useData.GetId()] = item
    871         showSizer.Add(useData,0,wx.ALIGN_CENTER_VERTICAL)
     872        showSizer.Add(useData,0,WACV)
    872873        useData.Bind(wx.EVT_CHECKBOX, OnUseData)
    873874        useData.SetValue(UseList[item]['Use'])
     
    875876        Indx[copyData.GetId()] = item
    876877        copyData.Bind(wx.EVT_BUTTON,OnCopyData)
    877         showSizer.Add(copyData,wx.ALIGN_CENTER_VERTICAL)
     878        showSizer.Add(copyData,WACV)
    878879        copyFlags = wx.Button(DData,-1,label=' Copy flags?')
    879880        Indx[copyFlags.GetId()] = item
    880881        copyFlags.Bind(wx.EVT_BUTTON,OnCopyFlags)
    881         showSizer.Add(copyFlags,wx.ALIGN_CENTER_VERTICAL)
     882        showSizer.Add(copyFlags,WACV)
    882883        mainSizer.Add((5,5),0)
    883         mainSizer.Add(showSizer,0,wx.ALIGN_CENTER_VERTICAL)
     884        mainSizer.Add(showSizer,0,WACV)
    884885        mainSizer.Add((0,5),0)
    885886       
     
    892893                isoSizer = wx.BoxSizer(wx.HORIZONTAL)
    893894                isoSizer.Add(TopSizer(' Size model: ',['isotropic','uniaxial','ellipsoidal'],
    894                     'Size',OnSizeType),0,wx.ALIGN_CENTER_VERTICAL)
     895                    'Size',OnSizeType),0,WACV)
    895896                isoSizer.Add(LGmixSizer('Size',OnLGmixVal,OnLGmixRef))
    896                 isoSizer.Add(ResetSizer('isotropic',OnResetSize),0,wx.ALIGN_CENTER_VERTICAL)
     897                isoSizer.Add(ResetSizer('isotropic',OnResetSize),0,WACV)
    897898                mainSizer.Add(isoSizer)
    898899                mainSizer.Add(IsoSizer(u' Cryst. size(\xb5m): ','Size','%.5f',
    899                     OnSizeVal,OnSizeRef),0,wx.ALIGN_CENTER_VERTICAL)
     900                    OnSizeVal,OnSizeRef),0,WACV)
    900901            elif UseList[item]['Size'][0] == 'uniaxial':
    901902                uniSizer = wx.BoxSizer(wx.HORIZONTAL)
    902903                uniSizer.Add(TopSizer(' Size model: ',['isotropic','uniaxial','ellipsoidal'],
    903                     'Size',OnSizeType),0,wx.ALIGN_CENTER_VERTICAL)
     904                    'Size',OnSizeType),0,WACV)
    904905                uniSizer.Add(LGmixSizer('Size',OnLGmixVal,OnLGmixRef))
    905                 uniSizer.Add(ResetSizer('uniaxial',OnResetSize),0,wx.ALIGN_CENTER_VERTICAL)
    906                 mainSizer.Add(UniSizer('Size',OnSizeAxis),0,wx.ALIGN_CENTER_VERTICAL)
     906                uniSizer.Add(ResetSizer('uniaxial',OnResetSize),0,WACV)
     907                mainSizer.Add(UniSizer('Size',OnSizeAxis),0,WACV)
    907908                mainSizer.Add(uniSizer)
    908909                mainSizer.Add(UniDataSizer(u'size(\xb5m): ','Size','%.5f',OnSizeVal,OnSizeRef))
     
    910911                ellSizer = wx.BoxSizer(wx.HORIZONTAL)
    911912                ellSizer.Add(TopSizer(' Size model: ',['isotropic','uniaxial','ellipsoidal'],
    912                     'Size',OnSizeType),0,wx.ALIGN_CENTER_VERTICAL)
     913                    'Size',OnSizeType),0,WACV)
    913914                ellSizer.Add(LGmixSizer('Size',OnLGmixVal,OnLGmixRef))
    914                 ellSizer.Add(ResetSizer('ellipsoidal',OnResetSize),0,wx.ALIGN_CENTER_VERTICAL)
     915                ellSizer.Add(ResetSizer('ellipsoidal',OnResetSize),0,WACV)
    915916                mainSizer.Add(ellSizer)
    916917                mainSizer.Add(EllSizeDataSizer())
     
    920921                isoSizer = wx.BoxSizer(wx.HORIZONTAL)
    921922                isoSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',],
    922                     'Mustrain',OnStrainType),0,wx.ALIGN_CENTER_VERTICAL)
     923                    'Mustrain',OnStrainType),0,WACV)
    923924                isoSizer.Add(LGmixSizer('Mustrain',OnLGmixVal,OnLGmixRef))
    924                 isoSizer.Add(ResetSizer('isotropic',OnResetStrain),0,wx.ALIGN_CENTER_VERTICAL)
     925                isoSizer.Add(ResetSizer('isotropic',OnResetStrain),0,WACV)
    925926                mainSizer.Add(isoSizer)
    926927                mainSizer.Add(IsoSizer(' microstrain: ','Mustrain','%.1f',
    927                     OnStrainVal,OnStrainRef),0,wx.ALIGN_CENTER_VERTICAL)                   
     928                    OnStrainVal,OnStrainRef),0,WACV)                   
    928929                mainSizer.Add((0,5),0)
    929930            elif UseList[item]['Mustrain'][0] == 'uniaxial':
    930931                uniSizer = wx.BoxSizer(wx.HORIZONTAL)
    931932                uniSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',],
    932                     'Mustrain',OnStrainType),0,wx.ALIGN_CENTER_VERTICAL)
     933                    'Mustrain',OnStrainType),0,WACV)
    933934                uniSizer.Add(LGmixSizer('Mustrain',OnLGmixVal,OnLGmixRef))
    934                 uniSizer.Add(ResetSizer('uniaxial',OnResetStrain),0,wx.ALIGN_CENTER_VERTICAL)
     935                uniSizer.Add(ResetSizer('uniaxial',OnResetStrain),0,WACV)
    935936                mainSizer.Add(uniSizer)
    936                 mainSizer.Add(UniSizer('Mustrain',OnStrainAxis),0,wx.ALIGN_CENTER_VERTICAL)
     937                mainSizer.Add(UniSizer('Mustrain',OnStrainAxis),0,WACV)
    937938                mainSizer.Add(UniDataSizer('mustrain: ','Mustrain','%.1f',OnStrainVal,OnStrainRef))
    938939            elif UseList[item]['Mustrain'][0] == 'generalized':
    939940                genSizer = wx.BoxSizer(wx.HORIZONTAL)
    940941                genSizer.Add(TopSizer(' Mustrain model: ',['isotropic','uniaxial','generalized',],
    941                     'Mustrain',OnStrainType),0,wx.ALIGN_CENTER_VERTICAL)
     942                    'Mustrain',OnStrainType),0,WACV)
    942943                genSizer.Add(LGmixSizer('Mustrain',OnLGmixVal,OnLGmixRef))
    943                 genSizer.Add(ResetSizer('generalized',OnResetStrain),0,wx.ALIGN_CENTER_VERTICAL)
     944                genSizer.Add(ResetSizer('generalized',OnResetStrain),0,WACV)
    944945                mainSizer.Add(genSizer)
    945946                mainSizer.Add(GenStrainDataSizer())                       
  • trunk/GSASIIphsGUI.py

    r1233 r1239  
    7070    Size = mainSizer.GetMinSize()
    7171    Size[0] += 40
    72     Size[1] = max(Size[1],430) + 35
     72#    Size[1] = 500
     73    Size[1] = min(Size[1]+ 150,500)
    7374    phasePage.SetSize(Size)
    7475    phasePage.SetScrollbars(10,10,Size[0]/10-4,Size[1]/10-1)
  • trunk/GSASIIstrMain.py

    r1238 r1239  
    4343ateln2 = 8.0*math.log(2.0)
    4444DEBUG = False
     45
     46def RefineCore(Controls,Histograms,Phases,restraintDict,rigidbodyDict,parmDict,varyList,
     47    calcControls,pawleyLookup,ifPrint,printFile,dlg):
     48#    print 'current',varyList
     49#    for item in parmDict: print item,parmDict[item] ######### show dict just before refinement
     50    G2mv.Map2Dict(parmDict,varyList)
     51    Rvals = {}
     52    while True:
     53        begin = time.time()
     54        values =  np.array(G2stMth.Dict2Values(parmDict, varyList))
     55        Ftol = Controls['min dM/M']
     56        Factor = Controls['shift factor']
     57        maxCyc = Controls['max cyc']
     58        if 'Jacobian' in Controls['deriv type']:           
     59            result = so.leastsq(G2stMth.errRefine,values,Dfun=G2stMth.dervRefine,full_output=True,
     60                ftol=Ftol,col_deriv=True,factor=Factor,
     61                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     62            ncyc = int(result[2]['nfev']/2)
     63        elif 'Hessian' in Controls['deriv type']:
     64            result = G2mth.HessianLSQ(G2stMth.errRefine,values,Hess=G2stMth.HessRefine,ftol=Ftol,maxcyc=maxCyc,Print=ifPrint,
     65                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     66            ncyc = result[2]['num cyc']+1
     67            Rvals['lamMax'] = result[2]['lamMax']
     68        else:           #'numeric'
     69            result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
     70                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     71            ncyc = int(result[2]['nfev']/len(varyList))
     72#        table = dict(zip(varyList,zip(values,result[0],(result[0]-values))))
     73#        for item in table: print item,table[item]               #useful debug - are things shifting?
     74        runtime = time.time()-begin
     75        Rvals['chisq'] = np.sum(result[2]['fvec']**2)
     76        G2stMth.Values2Dict(parmDict, varyList, result[0])
     77        G2mv.Dict2Map(parmDict,varyList)
     78        Rvals['Nobs'] = Histograms['Nobs']
     79        Rvals['Rwp'] = np.sqrt(Rvals['chisq']/Histograms['sumwYo'])*100.      #to %
     80        Rvals['GOF'] = Rvals['chisq']/(Histograms['Nobs']-len(varyList))
     81        print >>printFile,' Number of function calls:',result[2]['nfev'],' Number of observations: ',Histograms['Nobs'],' Number of parameters: ',len(varyList)
     82        print >>printFile,' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles'%(runtime,runtime/ncyc,ncyc)
     83        print >>printFile,' wR = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
     84        try:
     85            covMatrix = result[1]*Rvals['GOF']
     86            sig = np.sqrt(np.diag(covMatrix))
     87            if np.any(np.isnan(sig)):
     88                print '*** Least squares aborted - some invalid esds possible ***'
     89#            table = dict(zip(varyList,zip(values,result[0],(result[0]-values)/sig)))
     90#            for item in table: print item,table[item]               #useful debug - are things shifting?
     91            break                   #refinement succeeded - finish up!
     92        except TypeError,FloatingPointError:          #result[1] is None on singular matrix
     93            print '**** Refinement failed - singular matrix ****'
     94            if 'Hessian' in Controls['deriv type']:
     95                num = len(varyList)-1
     96                for i,val in enumerate(np.flipud(result[2]['psing'])):
     97                    if val:
     98                        print 'Removing parameter: ',varyList[num-i]
     99                        del(varyList[num-i])                   
     100            else:
     101                Ipvt = result[2]['ipvt']
     102                for i,ipvt in enumerate(Ipvt):
     103                    if not np.sum(result[2]['fjac'],axis=1)[i]:
     104                        print 'Removing parameter: ',varyList[ipvt-1]
     105                        del(varyList[ipvt-1])
     106                        break
     107    return Rvals,result,covMatrix,sig
     108
    45109
    46110
     
    106170    #     raise Exception(' *** Refine aborted ***')
    107171    #print G2mv.VarRemapShow(varyList)
    108     G2mv.Map2Dict(parmDict,varyList)
    109     Rvals = {}
    110     while True:
    111         begin = time.time()
    112         values =  np.array(G2stMth.Dict2Values(parmDict, varyList))
    113         Ftol = Controls['min dM/M']
    114         Factor = Controls['shift factor']
    115         maxCyc = Controls['max cyc']
    116         if 'Jacobian' in Controls['deriv type']:           
    117             result = so.leastsq(G2stMth.errRefine,values,Dfun=G2stMth.dervRefine,full_output=True,
    118                 ftol=Ftol,col_deriv=True,factor=Factor,
    119                 args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    120             ncyc = int(result[2]['nfev']/2)
    121         elif 'Hessian' in Controls['deriv type']:
    122             result = G2mth.HessianLSQ(G2stMth.errRefine,values,Hess=G2stMth.HessRefine,ftol=Ftol,maxcyc=maxCyc,Print=True,
    123                 args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    124             ncyc = result[2]['num cyc']+1
    125             Rvals['lamMax'] = result[2]['lamMax']
    126         else:           #'numeric'
    127             result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
    128                 args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    129             ncyc = int(result[2]['nfev']/len(varyList))
    130 #        table = dict(zip(varyList,zip(values,result[0],(result[0]-values))))
    131 #        for item in table: print item,table[item]               #useful debug - are things shifting?
    132         runtime = time.time()-begin
    133         Rvals['chisq'] = np.sum(result[2]['fvec']**2)
    134         G2stMth.Values2Dict(parmDict, varyList, result[0])
    135         G2mv.Dict2Map(parmDict,varyList)
    136         Rvals['Nobs'] = Histograms['Nobs']
    137         Rvals['Rwp'] = np.sqrt(Rvals['chisq']/Histograms['sumwYo'])*100.      #to %
    138         Rvals['GOF'] = Rvals['chisq']/(Histograms['Nobs']-len(varyList))
    139         print >>printFile,'\n Refinement results:'
    140         print >>printFile,135*'-'
    141         print >>printFile,' Number of function calls:',result[2]['nfev'],' Number of observations: ',Histograms['Nobs'],' Number of parameters: ',len(varyList)
    142         print >>printFile,' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles'%(runtime,runtime/ncyc,ncyc)
    143         print >>printFile,' wR = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
    144         try:
    145             covMatrix = result[1]*Rvals['GOF']
    146             sig = np.sqrt(np.diag(covMatrix))
    147             if np.any(np.isnan(sig)):
    148                 print '*** Least squares aborted - some invalid esds possible ***'
    149 #            table = dict(zip(varyList,zip(values,result[0],(result[0]-values)/sig)))
    150 #            for item in table: print item,table[item]               #useful debug - are things shifting?
    151             break                   #refinement succeeded - finish up!
    152         except TypeError,FloatingPointError:          #result[1] is None on singular matrix
    153             print '**** Refinement failed - singular matrix ****'
    154             if 'Hessian' in Controls['deriv type']:
    155                 num = len(varyList)-1
    156                 for i,val in enumerate(np.flipud(result[2]['psing'])):
    157                     if val:
    158                         print 'Removing parameter: ',varyList[num-i]
    159                         del(varyList[num-i])                   
    160             else:
    161                 Ipvt = result[2]['ipvt']
    162                 for i,ipvt in enumerate(Ipvt):
    163                     if not np.sum(result[2]['fjac'],axis=1)[i]:
    164                         print 'Removing parameter: ',varyList[ipvt-1]
    165                         del(varyList[ipvt-1])
    166                         break
     172   
     173    ifPrint = True
     174    print >>printFile,'\n Refinement results:'
     175    print >>printFile,135*'-'
     176    Rvals,result,covMatrix,sig = RefineCore(Controls,Histograms,Phases,restraintDict,
     177        rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifPrint,printFile,dlg)
     178       
     179#    G2mv.Map2Dict(parmDict,varyList)
     180#    Rvals = {}
     181#    while True:
     182#        begin = time.time()
     183#        values =  np.array(G2stMth.Dict2Values(parmDict, varyList))
     184#        Ftol = Controls['min dM/M']
     185#        Factor = Controls['shift factor']
     186#        maxCyc = Controls['max cyc']
     187#        if 'Jacobian' in Controls['deriv type']:           
     188#            result = so.leastsq(G2stMth.errRefine,values,Dfun=G2stMth.dervRefine,full_output=True,
     189#                ftol=Ftol,col_deriv=True,factor=Factor,
     190#                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     191#            ncyc = int(result[2]['nfev']/2)
     192#        elif 'Hessian' in Controls['deriv type']:
     193#            result = G2mth.HessianLSQ(G2stMth.errRefine,values,Hess=G2stMth.HessRefine,ftol=Ftol,maxcyc=maxCyc,Print=True,
     194#                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     195#            ncyc = result[2]['num cyc']+1
     196#            Rvals['lamMax'] = result[2]['lamMax']
     197#        else:           #'numeric'
     198#            result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
     199#                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     200#            ncyc = int(result[2]['nfev']/len(varyList))
     201##        table = dict(zip(varyList,zip(values,result[0],(result[0]-values))))
     202##        for item in table: print item,table[item]               #useful debug - are things shifting?
     203#        runtime = time.time()-begin
     204#        Rvals['chisq'] = np.sum(result[2]['fvec']**2)
     205#        G2stMth.Values2Dict(parmDict, varyList, result[0])
     206#        G2mv.Dict2Map(parmDict,varyList)
     207#        Rvals['Nobs'] = Histograms['Nobs']
     208#        Rvals['Rwp'] = np.sqrt(Rvals['chisq']/Histograms['sumwYo'])*100.      #to %
     209#        Rvals['GOF'] = Rvals['chisq']/(Histograms['Nobs']-len(varyList))
     210#        print >>printFile,135*'-'
     211#        print >>printFile,' Number of function calls:',result[2]['nfev'],' Number of observations: ',Histograms['Nobs'],' Number of parameters: ',len(varyList)
     212#        print >>printFile,' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles'%(runtime,runtime/ncyc,ncyc)
     213#        print >>printFile,' wR = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
     214#        try:
     215#            covMatrix = result[1]*Rvals['GOF']
     216#            sig = np.sqrt(np.diag(covMatrix))
     217#            if np.any(np.isnan(sig)):
     218#                print '*** Least squares aborted - some invalid esds possible ***'
     219##            table = dict(zip(varyList,zip(values,result[0],(result[0]-values)/sig)))
     220##            for item in table: print item,table[item]               #useful debug - are things shifting?
     221#            break                   #refinement succeeded - finish up!
     222#        except TypeError,FloatingPointError:          #result[1] is None on singular matrix
     223#            print '**** Refinement failed - singular matrix ****'
     224#            if 'Hessian' in Controls['deriv type']:
     225#                num = len(varyList)-1
     226#                for i,val in enumerate(np.flipud(result[2]['psing'])):
     227#                    if val:
     228#                        print 'Removing parameter: ',varyList[num-i]
     229#                        del(varyList[num-i])                   
     230#            else:
     231#                Ipvt = result[2]['ipvt']
     232#                for i,ipvt in enumerate(Ipvt):
     233#                    if not np.sum(result[2]['fjac'],axis=1)[i]:
     234#                        print 'Removing parameter: ',varyList[ipvt-1]
     235#                        del(varyList[ipvt-1])
     236#                        break
    167237
    168238#    print 'dependentParmList: ',G2mv.dependentParmList
     
    173243#    print 'test1'
    174244    G2stMth.GetFobsSq(Histograms,Phases,parmDict,calcControls)
    175 #    print 'test2'
    176245    sigDict = dict(zip(varyList,sig))
    177246    newCellDict = G2stMth.GetNewCellParms(parmDict,varyList)
     
    218287    print ' Sequential Refinement'
    219288    G2stIO.ShowBanner(printFile)
    220     G2mv.InitVars()   
    221289    Controls = G2stIO.GetControls(GPXfile)
    222290    G2stIO.ShowControls(Controls,printFile)           
    223     constrDict,fixedList = G2stIO.GetConstraints(GPXfile)
    224291    restraintDict = G2stIO.GetRestraints(GPXfile)
    225292    Histograms,Phases = G2stIO.GetUsedHistogramsAndPhases(GPXfile)
     
    320387        G2stIO.GetFprime(calcControls,Histo)
    321388        # do constraint processing
     389        G2mv.InitVars()   
     390        constrDict,fixedList = G2stIO.GetConstraints(GPXfile)
    322391        varyListStart = tuple(varyList) # save the original varyList before dependent vars are removed
    323392        try:
     
    334403        #     raise Exception(' *** Refine aborted ***')
    335404        #print G2mv.VarRemapShow(varyList)
    336         G2mv.Map2Dict(parmDict,varyList)
    337         print 'parmDict:',parmDict ######### show dict just before refinement
    338         Rvals = {}
    339         while True:
    340             begin = time.time()
    341             values =  np.array(G2stMth.Dict2Values(parmDict,varyList))
    342             Ftol = Controls['min dM/M']
    343             Factor = Controls['shift factor']
    344             maxCyc = Controls['max cyc']
    345 
    346             if 'Jacobian' in Controls['deriv type']:           
    347                 result = so.leastsq(G2stMth.errRefine,values,Dfun=G2stMth.dervRefine,full_output=True,
    348                     ftol=Ftol,col_deriv=True,factor=Factor,
    349                     args=([Histo,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    350                 ncyc = int(result[2]['nfev']/2)
    351             elif 'Hessian' in Controls['deriv type']:
    352                 result = G2mth.HessianLSQ(G2stMth.errRefine,values,Hess=G2stMth.HessRefine,ftol=Ftol,maxcyc=maxCyc,
    353                     args=([Histo,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    354                 ncyc = result[2]['num cyc']+1                           
    355             else:           #'numeric'
    356                 result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
    357                     args=([Histo,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    358                 ncyc = int(result[2]['nfev']/len(varyList))
    359 
    360             runtime = time.time()-begin
    361             Rvals['chisq'] = np.sum(result[2]['fvec']**2)
    362             G2stMth.Values2Dict(parmDict, varyList, result[0])
    363             G2mv.Dict2Map(parmDict,varyList)
     405       
     406        ifPrint = False
     407        print >>printFile,'\n Refinement results for histogram: v'+histogram
     408        print >>printFile,135*'-'
     409        Rvals,result,covMatrix,sig = RefineCore(Controls,Histo,Phases,restraintDict,
     410            rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifPrint,printFile,dlg)
    364411           
    365             Rvals['Rwp'] = np.sqrt(Rvals['chisq']/Histo['sumwYo'])*100.      #to %
    366             Rvals['GOF'] = Rvals['Rwp']/(Histo['Nobs']-len(varyList))
    367             Rvals['Nobs'] = Histo['Nobs']
    368             print >>printFile,'\n Refinement results for histogram: v'+histogram
    369             print >>printFile,135*'-'
    370             print >>printFile,' Number of function calls:',result[2]['nfev'],' Number of observations: ',Histo['Nobs'],' Number of parameters: ',len(varyList)
    371             print >>printFile,' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles'%(runtime,runtime/ncyc,ncyc)
    372             print >>printFile,' wRp = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
    373             try:
    374                 covMatrix = result[1]*Rvals['GOF']
    375                 sig = np.sqrt(np.diag(covMatrix))
    376                 if np.any(np.isnan(sig)):
    377                     print '*** Least squares aborted - some invalid esds possible ***'
    378                     ifPrint = True
    379                 break                   #refinement succeeded - finish up!
    380             except TypeError:          #result[1] is None on singular matrix
    381                 print '**** Refinement failed - singular matrix ****'
    382                 if 'Hessian' in Controls['deriv type']:
    383                     num = len(varyList)-1
    384                     for i,val in enumerate(np.flipud(result[2]['psing'])):
    385                         if val:
    386                             print 'Removing parameter: ',varyList[num-i]
    387                             del(varyList[num-i])                   
    388                 else:
    389                     Ipvt = result[2]['ipvt']
    390                     for i,ipvt in enumerate(Ipvt):
    391                         if not np.sum(result[2]['fjac'],axis=1)[i]:
    392                             print 'Removing parameter: ',varyList[ipvt-1]
    393                             del(varyList[ipvt-1])
    394                             break
    395    
     412#        G2mv.Map2Dict(parmDict,varyList)
     413#        print 'parmDict:',parmDict ######### show dict just before refinement
     414#        Rvals = {}
     415#        while True:
     416#            begin = time.time()
     417#            values =  np.array(G2stMth.Dict2Values(parmDict,varyList))
     418#            Ftol = Controls['min dM/M']
     419#            Factor = Controls['shift factor']
     420#            maxCyc = Controls['max cyc']
     421#
     422#            if 'Jacobian' in Controls['deriv type']:           
     423#                result = so.leastsq(G2stMth.errRefine,values,Dfun=G2stMth.dervRefine,full_output=True,
     424#                    ftol=Ftol,col_deriv=True,factor=Factor,
     425#                    args=([Histo,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     426#                ncyc = int(result[2]['nfev']/2)
     427#            elif 'Hessian' in Controls['deriv type']:
     428#                result = G2mth.HessianLSQ(G2stMth.errRefine,values,Hess=G2stMth.HessRefine,ftol=Ftol,maxcyc=maxCyc,
     429#                    args=([Histo,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     430#                ncyc = result[2]['num cyc']+1                           
     431#            else:           #'numeric'
     432#                result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
     433#                    args=([Histo,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     434#                ncyc = int(result[2]['nfev']/len(varyList))
     435#
     436#            runtime = time.time()-begin
     437#            Rvals['chisq'] = np.sum(result[2]['fvec']**2)
     438#            G2stMth.Values2Dict(parmDict, varyList, result[0])
     439#            G2mv.Dict2Map(parmDict,varyList)
     440#           
     441#            Rvals['Rwp'] = np.sqrt(Rvals['chisq']/Histo['sumwYo'])*100.      #to %
     442#            Rvals['GOF'] = Rvals['Rwp']/(Histo['Nobs']-len(varyList))
     443#            Rvals['Nobs'] = Histo['Nobs']
     444#            print >>printFile,135*'-'
     445#            print >>printFile,' Number of function calls:',result[2]['nfev'],' Number of observations: ',Histo['Nobs'],' Number of parameters: ',len(varyList)
     446#            print >>printFile,' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles'%(runtime,runtime/ncyc,ncyc)
     447#            print >>printFile,' wRp = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
     448#            try:
     449#                covMatrix = result[1]*Rvals['GOF']
     450#                sig = np.sqrt(np.diag(covMatrix))
     451#                if np.any(np.isnan(sig)):
     452#                    print '*** Least squares aborted - some invalid esds possible ***'
     453#                    ifPrint = True
     454#                break                   #refinement succeeded - finish up!
     455#            except TypeError:          #result[1] is None on singular matrix
     456#                print '**** Refinement failed - singular matrix ****'
     457#                if 'Hessian' in Controls['deriv type']:
     458#                    num = len(varyList)-1
     459#                    for i,val in enumerate(np.flipud(result[2]['psing'])):
     460#                        if val:
     461#                            print 'Removing parameter: ',varyList[num-i]
     462#                            del(varyList[num-i])                   
     463#                else:
     464#                    Ipvt = result[2]['ipvt']
     465#                    for i,ipvt in enumerate(Ipvt):
     466#                        if not np.sum(result[2]['fjac'],axis=1)[i]:
     467#                            print 'Removing parameter: ',varyList[ipvt-1]
     468#                            del(varyList[ipvt-1])
     469#                            break
     470#   
    396471        G2stMth.GetFobsSq(Histo,Phases,parmDict,calcControls)
    397472        sigDict = dict(zip(varyList,sig))
  • trunk/GSASIIstrMath.py

    r1229 r1239  
    14041404            time0 = time.time()
    14051405            StructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict)
    1406             print 'sf calc time: %.3fs'%(time.time()-time0)
     1406#            print 'sf calc time: %.3fs'%(time.time()-time0)
    14071407        time0 = time.time()
    14081408        for iref,refl in enumerate(refDict['RefList']):
     
    14441444                print 'TOF Undefined at present'
    14451445                raise Exception    #no TOF yet
    1446         print 'profile calc time: %.3fs'%(time.time()-time0)
     1446#        print 'profile calc time: %.3fs'%(time.time()-time0)
    14471447    return yc,yb
    14481448   
     
    15301530            time0 = time.time()
    15311531            dFdvDict = StructureFactorDerv(refDict,G,hfx,pfx,SGData,calcControls,parmDict)
    1532             print 'sf-derv time %.3fs'%(time.time()-time0)
     1532#            print 'sf-derv time %.3fs'%(time.time()-time0)
    15331533            ApplyRBModelDervs(dFdvDict,parmDict,rigidbodyDict,Phase)
    15341534        time0 = time.time()
     
    17011701                        if Ka2:
    17021702                            depDerivDict[name][iBeg2:iFin2] += dFdvDict[name][iref]*corr2
    1703         print 'profile derv time: %.3fs'%(time.time()-time0)
     1703#        print 'profile derv time: %.3fs'%(time.time()-time0)
    17041704    # now process derivatives in constraints
    17051705    G2mv.Dict2Deriv(varylist,depDerivDict,dMdv)
Note: See TracChangeset for help on using the changeset viewer.