2626 from diffpy.srreal.scatteringfactortable import SFTXray
2727 xtb = SFTXray()
2828 qa = np.linspace(0, 25)
29- sfavg1 = SFAverage.fromComposition(xtb, {'Na' : 1, 'Cl' : 1}, qa)
30- sfavg2 = SFAverage.fromComposition(xtb, [('Mn', 1), ('O', 2)], qa)
29+ sfavg1 = SFAverage.fromComposition({'Na' : 1, 'Cl' : 1}, xtb , qa)
30+ sfavg2 = SFAverage.fromComposition([('Mn', 1), ('O', 2)], xtb , qa)
3131
3232 from diffpy.Structure import loadStructure
3333 from diffpy.srreal.pdfcalculator import DebyePDFCalculator
3434 dpdfc = DebyePDFCalculator()
3535 dpdfc(loadStructure('rutile.cif'))
36- sfavg3 = SFAverage.fromStructure(dpdfc.scatteringfactortable ,
37- dpdfc.getStructure() , dpdfc.qgrid)
36+ sfavg3 = SFAverage.fromStructure(dpdfc.getStructure() ,
37+ dpdfc.scatteringfactortable , dpdfc.qgrid)
3838"""
3939
4040
@@ -76,18 +76,18 @@ class SFAverage(object):
7676 composition = None
7777
7878 @classmethod
79- def fromStructure (cls , sftb , stru , q = 0 ):
79+ def fromStructure (cls , stru , sftb , q = 0 ):
8080 """\
8181 Calculate average scattering factors from a structure object.
8282
8383 Parameters
8484 ----------
85- sftb : ScatteringFactorTable
86- The ScatteringFactorTable object for looking up the values.
8785 stru : diffpy Structure or pyobjcryst Crystal or StructureAdapter
8886 The structure object that stores the atom species and their
8987 occupancies. Can be any type with a registered conversion
9088 to the StructureAdapter class.
89+ sftb : ScatteringFactorTable
90+ The ScatteringFactorTable object for looking up the values.
9191 q : float or NumPy array (optional)
9292 The Q value in inverse Angstroms for which to lookup
9393 the scattering factor values.
@@ -105,7 +105,7 @@ def fromStructure(cls, sftb, stru, q=0):
105105 if hasattr (type (stru ), 'composition' ):
106106 composition = stru .composition
107107 if isinstance (composition , dict ):
108- return cls .fromComposition (sftb , composition , q )
108+ return cls .fromComposition (composition , sftb , q )
109109 # otherwise let's convert to a known structure type
110110 from diffpy .srreal .structureadapter import createStructureAdapter
111111 adpt = createStructureAdapter (stru )
@@ -114,21 +114,21 @@ def fromStructure(cls, sftb, stru, q=0):
114114 smbl = adpt .siteAtomType (i )
115115 cnt = adpt .siteOccupancy (i ) * adpt .siteMultiplicity (i )
116116 composition [smbl ] = composition .get (smbl , 0 ) + cnt
117- return cls .fromComposition (sftb , composition , q )
117+ return cls .fromComposition (composition , sftb , q )
118118
119119
120120 @classmethod
121- def fromComposition (cls , sftb , composition , q = 0 ):
121+ def fromComposition (cls , composition , sftb , q = 0 ):
122122 """\
123123 Calculate average scattering factors from atom concentrations.
124124
125125 Parameters
126126 ----------
127- sftb : ScatteringFactorTable
128- The ScatteringFactorTable object for looking up the values.
129127 composition : dictionary or a list of (symbol, amount) pairs.
130128 The chemical composition for evaluating the average. Atom
131129 symbols may repeat when it is a list of (symbol, amount) pairs.
130+ sftb : ScatteringFactorTable
131+ The ScatteringFactorTable object for looking up the values.
132132 q : float or NumPy array (optional)
133133 The Q value in inverse Angstroms for which to lookup
134134 the scattering factor values.
0 commit comments