Changeset 1315 for trunk/GSASIIsasd.py


Ignore:
Timestamp:
May 1, 2014 3:20:21 PM (7 years ago)
Author:
vondreele
Message:

new controls parameter 'Contrast' & remove Substances from arguments list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIsasd.py

    r1313 r1315  
    10051005###############################################################################
    10061006
    1007 def SizeDistribution(Profile,ProfDict,Limits,Substances,Sample,data):
     1007def SizeDistribution(Profile,ProfDict,Limits,Sample,data):
    10081008    shapes = {'Spheroid':[SpheroidFF,SpheroidVol],'Cylinder':[CylinderDFF,CylinderDVol],
    10091009        'Cylinder AR':[CylinderARFF,CylinderARVol],'Unified sphere':[UniSphereFF,UniSphereVol],
     
    10531053################################################################################
    10541054
    1055 def ModelFit(Profile,ProfDict,Limits,Substances,Sample,Model):
     1055def ModelFit(Profile,ProfDict,Limits,Sample,Model):
    10561056    shapes = {'Spheroid':[SpheroidFF,SpheroidVol],'Cylinder':[CylinderDFF,CylinderDVol],
    10571057        'Cylinder AR':[CylinderARFF,CylinderARVol],'Unified sphere':[UniSphereFF,UniSphereVol],
     
    10811081        parmDict['Back'] = Back[0]
    10821082        partData = Model['Particle']
    1083         parmDict['Matrix density'] = Substances['Substances'][partData['Matrix']['Name']].get('XAnom density',0.0)
    10841083        for i,level in enumerate(partData['Levels']):
    10851084            cid = str(i)+':'
     
    10941093                parmDict[cid+'FFVolume'] = shapes[controls['FormFact']][1]
    10951094                parmDict[cid+'StrFact'] = sfxns[controls['StrFact']]
    1096                 parmDict[cid+'XAnom density'] = Substances['Substances'][controls['Material']].get('XAnom density',0.0)
     1095                parmDict[cid+'Contrast'] = controls['Contrast']
    10971096                for item in FFparmOrder:
    10981097                    if item in controls['FFargs']:
     
    11261125            Type = controls['DistType']
    11271126            if Type in ['LogNormal','Gaussian','LSW','Schulz-Zimm','Monodisperse']:
    1128                 print ' Component %d: Type: %s: Structure Factor: %s'%(i,Type,controls['StrFact'])               
     1127                print ' Component %d: Type: %s: Structure Factor: %s Contrast: %12.3f'  \
     1128                    %(i,Type,controls['StrFact'],controls['Contrast'])               
    11291129            else:
    11301130                print ' Component %d: Type: %s: '%(i,Type,)
     
    11521152    def getSASD(Q,levelTypes,parmDict):
    11531153        Ic = np.zeros_like(Q)
    1154         rhoMat = parmDict['Matrix density']
    11551154        for i,Type in enumerate(levelTypes):
    11561155            cid = str(i)+':'
     
    11711170                    if item in parmDict:
    11721171                        distDict[item.split(':')[1]] = parmDict[item]
    1173                 rho = parmDict[cid+'XAnom density']
    1174                 contrast = (rho-rhoMat)**2
     1172                contrast = parmDict[cid+'Contrast']
    11751173                rBins,dBins,dist = MakeDiamDist(Type,parmDict[cid+'NumPoints'],parmDict[cid+'Cutoff'],distDict)
    11761174                Gmat = G_matrix(Q,rBins,contrast,FFfxn,Volfxn,FFargs).T
     
    12001198                    if item in parmDict:
    12011199                        SFargs.append(parmDict[item])
    1202                 rho = parmDict[cid+'XAnom density']
    1203                 contrast = (rho-rhoMat)**2
     1200                contrast = parmDict[cid+'Contrast']
    12041201                R = parmDict[cid+'Radius']
    12051202                Gmat = G_matrix(Q,R,contrast,FFfxn,Volfxn,FFargs)             
     
    12521249        return False,0,0,0,0,0
    12531250   
    1254 def ModelFxn(Profile,ProfDict,Limits,Substances,Sample,sasdData):
     1251def ModelFxn(Profile,ProfDict,Limits,Sample,sasdData):
    12551252   
    12561253    shapes = {'Spheroid':[SpheroidFF,SpheroidVol],'Cylinder':[CylinderDFF,CylinderDVol],
     
    12641261#    pdb.set_trace()
    12651262    partData = sasdData['Particle']
    1266     rhoMat = Substances['Substances'][partData['Matrix']['Name']].get('XAnom density',0.0)
    12671263    matFrac = partData['Matrix']['VolFrac'] #[value,flag]       
    12681264    Scale = Sample['Scale']     #[value,flag]
     
    12941290                if item in controls['FFargs']:
    12951291                    FFargs.append(controls['FFargs'][item][0])
    1296             rho = Substances['Substances'][level['Controls']['Material']].get('XAnom density',0.0)
    1297             contrast = (rho-rhoMat)**2
     1292            contrast = controls['Contrast']
    12981293            distDict = {}
    12991294            for item in parmDict:
     
    13361331                if item in controls['FFargs']:
    13371332                    FFargs.append(controls['FFargs'][item][0])
    1338             rho = Substances['Substances'][level['Controls']['Material']].get('XAnom density',0.0)
    1339             contrast = (rho-rhoMat)**2
     1333            contrast = controls['Contrast']
    13401334            Gmat = G_matrix(Q[Ibeg:Ifin],R,contrast,FFfxn,Volfxn,FFargs)             
    13411335            Ic[Ibeg:Ifin] += Gmat[0]*level[distFxn]['Volume'][0]*SFfxn(Q[Ibeg:Ifin],args=SFargs)
Note: See TracChangeset for help on using the changeset viewer.