Changeset 2539


Ignore:
Timestamp:
Nov 21, 2016 11:13:37 AM (5 years ago)
Author:
vondreele
Message:

fix to unicode character in directory name problem
numerous unused parameters removed - more to come

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2532 r2539  
    2222import random as ran
    2323import time
    24 import copy
    2524import glob
    2625import imp
     
    329328    def PreviewFile(self,filename,fp):
    330329        'confirm we have the right file'
    331         rdmsg = 'File '+str(filename)+' begins:\n\n'
     330        rdmsg = 'File '+repr(filename)+' begins:\n\n'
    332331        for i in range(3):
    333332            rdmsg += fp.readline()
     
    910909        while item: # loop over (new) phases
    911910            iph += 1
    912             phaseName = self.PatternTree.GetItemText(item)
    913911            data = self.PatternTree.GetItemPyData(item)
    914912            item, cookie = self.PatternTree.GetNextChild(sub, cookie)
  • trunk/GSASIIstrMath.py

    r2534 r2539  
    10701070        Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #Mxyz,Nref,Nop,Natm = BPM in magstrfc.for OK
    10711071        dqdm = np.array([np.outer(hm,hm)-np.eye(3) for hm in HM.T]).T   #Mxyz,Mxyz,Nref (3x3 matrix)
    1072         dqmx = np.sum(dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]*SGData['SpnFlp'][nxs,nxs,nxs,:,nxs],axis=0)   #matrix * vector = vector
     1072        dqmx = dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]
     1073#        dqmx = np.sum(dqmx*SGData['SpnFlp'][nxs,nxs,nxs,:,nxs],axis=1)   #matrix * vector = vector
     1074        dqmx = np.sum(dqmx,axis=1)   #matrix * vector = vector
    10731075        dmx = Q*dGdM[:,nxs,:,:]+dqmx                                    #*Mag canceled out of dqmx term
    10741076#        GSASIIpath.IPyBreak()
  • trunk/imports/G2img_1TIF.py

    r2347 r2539  
    1919'''
    2020
    21 import sys
    2221import struct as st
    23 import os.path as ospath
    2422import GSASIIIO as G2IO
    2523import GSASIIpath
     
    136134        elif Type == 3:
    137135            Value = st.unpack(byteOrd+nVal*'h',File.read(nVal*2))
    138             x = st.unpack(byteOrd+nVal*'h',File.read(nVal*2))
    139136        elif Type == 4:
    140137            if Tag in [273,279]:
     
    266263            image = np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32)
    267264        elif IFD[273][2][0] == 512:
    268             tiftype = '11-ID-C'
     265            tifType = '11-ID-C'
    269266            pixy = [200,200]
    270267            File.seek(512)
  • trunk/imports/G2img_ADSC.py

    r2133 r2539  
    1313'''
    1414
    15 import sys
    16 import os
    1715import GSASIIIO as G2IO
    1816import GSASIIpath
     
    3937        '''
    4038        self.Comments,self.Data,self.Npix,self.Image = G2IO.GetImgData(filename)
    41         Image[0][0] = 0
    4239        if self.Npix == 0 or not self.Comments:
    4340            return False
  • trunk/imports/G2img_CBF.py

    r2441 r2539  
    1313'''
    1414
    15 import sys
    16 import os
    1715import time
    1816import GSASIIIO as G2IO
  • trunk/imports/G2img_GE.py

    r2461 r2539  
    1616'''
    1717
    18 import sys
    1918import os
    2019import numpy as np
     
    117116    '''
    118117    import struct as st
    119     import array as ar
    120118    import cPickle
    121119    more = False
  • trunk/imports/G2phase.py

    r2534 r2539  
    209209            self.errors = 'Error reading at line '+str(line+1)
    210210            if 'EXPR NPHAS' in S[:12]:
    211                 Num = S[12:-1].count('0')
    212211                NPhas = S[12:-1].split()
    213212            if 'CRS' in S[:3]:
     
    350349        elif general['Type'] =='magnetic':
    351350            general['AtomPtrs'] = [3,1,10,12]
    352             general['SGData']['SGSpin'] = SpnFlp
    353             general['MagDmin'] = MagDmin   
     351#            general['SGData']['SGSpin'] = SpnFlp
     352#            general['MagDmin'] = MagDmin   
    354353        else:   #nuclear
    355354            general['AtomPtrs'] = [3,1,7,9]   
     
    401400        Phase = {}
    402401        Title = os.path.basename(filename)
    403         Compnd = ''
    404402        Type = 'nuclear'
    405403        Atoms = []
     
    454452                        self.warnings += "Change this in phase's General tab."           
    455453                    dlg.Destroy()
    456                 SGlines = G2spc.SGPrint(SGData)
     454                SGlines = G2spc.SGPrint(SGData) #silent check of space group symbol
    457455            elif 'qi' in S[:2]:
    458456                if nqi:
  • trunk/testDeriv.py

    r2532 r2539  
    2020'''
    2121
    22 import os
    23 import os.path as ospath
    2422import sys
    2523import time
     
    2725import wx
    2826import numpy as np
    29 import matplotlib as mpl
    3027import GSASIIpath
    3128import GSASIIstrMath as G2stMth
     
    173170            M2 = dMdV[varyList.index(name)]
    174171            hplot.plot(M2,'b',label='analytic deriv')
    175             if name in varyList:
    176                 mmin = np.min(dMdV[varyList.index(name)])
    177                 mmax = np.max(dMdV[varyList.index(name)])
    178                 print 'parameter:',name,self.parmDict[name],delt,mmin,mmax
    179                 if name in self.varylist:
    180                     self.values[self.varylist.index(name)] -= delt
    181                     M0 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
    182                         varyList,self.calcControls,self.pawleyLookup,None)
    183                     self.values[self.varylist.index(name)] += 2.*delt
    184                     M1 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
    185                         varyList,self.calcControls,self.pawleyLookup,None)
    186                     self.values[self.varylist.index(name)] -= delt
    187                 elif name in self.depVarList:   #in depVarList
    188                     if 'dA' in name:
    189                         name = name.replace('dA','A')
    190                         delt *= -1
    191                     self.parmDict[name] -= delt
    192                     M0 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
    193                         varyList,self.calcControls,self.pawleyLookup,None)
    194                     self.parmDict[name] += 2.*delt
    195                     M1 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
    196                         varyList,self.calcControls,self.pawleyLookup,None)
    197                     self.parmDict[name] -= delt   
    198                 Mn = (M1-M0)/(2.*abs(delt))
    199                 hplot.plot(Mn,'r',label='numeric deriv')
    200                 hplot.plot(M2-Mn,'g',label='diff')
     172            mmin = np.min(dMdV[varyList.index(name)])
     173            mmax = np.max(dMdV[varyList.index(name)])
     174            print 'parameter:',name,self.parmDict[name],delt,mmin,mmax
     175            if name in self.varylist:
     176                self.values[self.varylist.index(name)] -= delt
     177                M0 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
     178                    varyList,self.calcControls,self.pawleyLookup,None)
     179                self.values[self.varylist.index(name)] += 2.*delt
     180                M1 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
     181                    varyList,self.calcControls,self.pawleyLookup,None)
     182                self.values[self.varylist.index(name)] -= delt
     183            elif name in self.depVarList:   #in depVarList
     184                if 'dA' in name:
     185                    name = name.replace('dA','A')
     186                    delt *= -1
     187                self.parmDict[name] -= delt
     188                M0 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
     189                    varyList,self.calcControls,self.pawleyLookup,None)
     190                self.parmDict[name] += 2.*delt
     191                M1 = G2stMth.errRefine(self.values,self.HistoPhases,self.parmDict,
     192                    varyList,self.calcControls,self.pawleyLookup,None)
     193                self.parmDict[name] -= delt   
     194            Mn = (M1-M0)/(2.*abs(delt))
     195            hplot.plot(Mn,'r',label='numeric deriv')
     196            hplot.plot(M2-Mn,'g',label='diff')
    201197#            GSASIIpath.IPyBreak()
    202198            hplot.legend(loc='best')           
Note: See TracChangeset for help on using the changeset viewer.