Changeset 2550


Ignore:
Timestamp:
Nov 28, 2016 2:59:55 PM (5 years ago)
Author:
vondreele
Message:

fix binary import for Bruker raw files
fix issues for new atoms in mag structures

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2547 r2550  
    326326        'confirm we have the right file'
    327327        rdmsg = 'File '+ filename +' begins:\n\n'
    328         for i in range(3):
    329             rdmsg += fp.readline()
     328        rdmsg += fp.read(80)
    330329        rdmsg += '\n\nDo you want to read this file?'
    331330        if not all([ord(c) < 128 and ord(c) != 0 for c in rdmsg]): # show only if ASCII
  • trunk/GSASIIphsGUI.py

    r2546 r2550  
    242242        generalData['AtomMass'] = []
    243243        generalData['Color'] = []
    244         if generalData['Type'] == 'magnetic' and not 'Lande g' in generalData:
    245             generalData['MagDmin'] = 1.0
    246             generalData['Lande g'] = []
     244        if generalData['Type'] == 'magnetic':
     245            generalData['MagDmin'] = generalData.get('MagDmin',1.0)
     246            landeg = generalData.get('Lande g',[])
    247247        generalData['Mydir'] = G2frame.dirname
    248248        badList = {}
     
    280280                generalData['Color'].append(Info['Color'])
    281281                if generalData['Type'] == 'magnetic':
    282                     generalData['MagDmin'] = generalData.get('MagDmin',1.0)
    283                     if not atom[ct] in generalData['AtomTypes']:
    284                         generalData['Lande g'].append(2.0)                       
     282                    if len(landeg) < len(generalData['AtomTypes']):
     283                        landeg.append(2.0)
     284        if generalData['Type'] == 'magnetic':
     285            generalData['Lande g'] = landeg[:len(generalData['AtomTypes'])]
     286                       
    285287        if badList:
    286288            msg = 'Warning: element symbol(s) not found:'
     
    678680                try:
    679681                    val = float(Obj.GetValue())
    680                     if val < 1. or val > 2.0:
     682                    if val < 0.5 or val > 3.0:
    681683                        raise ValueError
    682684                except ValueError:
  • trunk/GSASIIstrMath.py

    r2548 r2550  
    998998#    GSASIIpath.IPyBreak()
    999999    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    1000     dGdm = (1.-Gdata**2)                        #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
     1000    dGdm = (1.-Gdata**2)/Mag                        #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
    10011001    dFdMx = np.zeros((nRef,mSize,3))
    10021002    Uij = np.array(G2lat.U6toUij(Uijdata))
     
    10501050        dqdm = np.array([np.outer(hm,hm)-np.eye(3) for hm in HM.T]).T   #Mxyz,Mxyz,Nref (3x3 matrix)
    10511051        dqmx = dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]
    1052 #        dqmx = np.sum(dqmx*SGData['SpnFlp'][nxs,nxs,nxs,:,nxs],axis=1)   #matrix * vector = vector
    10531052        dqmx = np.sum(dqmx,axis=1)   #matrix * vector = vector
    1054         dmx = Q*dGdM[:,nxs,:,:]+dqmx                                    #*Mag canceled out of dqmx term
     1053        dmx = Q*dGdM[:,nxs,:,:]+dqmx*Mag[nxs,nxs,:,:]                                    #*Mag canceled out of dqmx term
    10551054#        GSASIIpath.IPyBreak()
    10561055#
     
    10591058        fams = np.sum(np.sum(fam,axis=-1),axis=-1)                      #Mxyz,Nref
    10601059        fbms = np.sum(np.sum(fbm,axis=-1),axis=-1)
    1061         famx = Q*TMcorr[nxs,:,nxs,:]*Mag[nxs,nxs,:,:]*sinm[nxs,:,:,:]   #Mxyz,Nref,Nops,Natom
     1060        famx = -Q*TMcorr[nxs,:,nxs,:]*Mag[nxs,nxs,:,:]*sinm[nxs,:,:,:]   #Mxyz,Nref,Nops,Natom
    10621061        fbmx = Q*TMcorr[nxs,:,nxs,:]*Mag[nxs,nxs,:,:]*cosm[nxs,:,:,:]
    10631062        #sums below are over Nops - real part
  • trunk/imports/G2pwd_BrukerRAW.py

    r2547 r2550  
    9494                            x = np.array([start2Th+i*step for i in range(nSteps)])
    9595                            y = np.array([max(1.,st.unpack('<f',File.read(4))[0]) for i in range(nSteps)])
     96                            y = np.where(y<0.,y,1.)
    9697                            w = 1./y
    9798                            self.powderdata = [x,y,w,np.zeros(nSteps),np.zeros(nSteps),np.zeros(nSteps)]
     
    134135                if blockNum <= nBlock:
    135136                    for iBlock in range(blockNum):
    136                         headLen = int(st.unpack('<i',File.read(4))[0])
     137                        headLen = int(st.unpack('<i',File.read(4))[0])+40
    137138                        nSteps = int(st.unpack('<i',File.read(4))[0])
    138139                        if iBlock+1 == blockNum:
  • trunk/testDeriv.py

    r2549 r2550  
    88refinement against numerical values computed in this script.
    99
    10 To use set ``DEBUG=True`` in GSASIIstrMain.py (line 22, as of version
    11 1110); run the least squares - one cycle is sufficient.  Do the "Save
     10To use set ``DEBUG=True`` in GSASIIstrMain.py (line 40, as of version
     112546); run the least squares - zero cycles is sufficient.  Do the "Save
    1212Results"; this will write the file testDeriv.dat in the local
    1313directory.
     
    1717derivatives generated over all observations (including penalty terms)
    1818and the corresponding analytical ones produced in the least
    19 squares. They should match.
     19squares. They should match. Profiling is also done for function
     20calculation & for the 1st selected derivative (rest should be the same).
    2021'''
    2122
Note: See TracChangeset for help on using the changeset viewer.