26
26
from diffpy.srreal.scatteringfactortable import SFTXray
27
27
xtb = SFTXray()
28
28
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)
31
31
32
32
from diffpy.Structure import loadStructure
33
33
from diffpy.srreal.pdfcalculator import DebyePDFCalculator
34
34
dpdfc = DebyePDFCalculator()
35
35
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)
38
38
"""
39
39
40
40
@@ -76,18 +76,18 @@ class SFAverage(object):
76
76
composition = None
77
77
78
78
@classmethod
79
- def fromStructure (cls , sftb , stru , q = 0 ):
79
+ def fromStructure (cls , stru , sftb , q = 0 ):
80
80
"""\
81
81
Calculate average scattering factors from a structure object.
82
82
83
83
Parameters
84
84
----------
85
- sftb : ScatteringFactorTable
86
- The ScatteringFactorTable object for looking up the values.
87
85
stru : diffpy Structure or pyobjcryst Crystal or StructureAdapter
88
86
The structure object that stores the atom species and their
89
87
occupancies. Can be any type with a registered conversion
90
88
to the StructureAdapter class.
89
+ sftb : ScatteringFactorTable
90
+ The ScatteringFactorTable object for looking up the values.
91
91
q : float or NumPy array (optional)
92
92
The Q value in inverse Angstroms for which to lookup
93
93
the scattering factor values.
@@ -105,7 +105,7 @@ def fromStructure(cls, sftb, stru, q=0):
105
105
if hasattr (type (stru ), 'composition' ):
106
106
composition = stru .composition
107
107
if isinstance (composition , dict ):
108
- return cls .fromComposition (sftb , composition , q )
108
+ return cls .fromComposition (composition , sftb , q )
109
109
# otherwise let's convert to a known structure type
110
110
from diffpy .srreal .structureadapter import createStructureAdapter
111
111
adpt = createStructureAdapter (stru )
@@ -114,21 +114,21 @@ def fromStructure(cls, sftb, stru, q=0):
114
114
smbl = adpt .siteAtomType (i )
115
115
cnt = adpt .siteOccupancy (i ) * adpt .siteMultiplicity (i )
116
116
composition [smbl ] = composition .get (smbl , 0 ) + cnt
117
- return cls .fromComposition (sftb , composition , q )
117
+ return cls .fromComposition (composition , sftb , q )
118
118
119
119
120
120
@classmethod
121
- def fromComposition (cls , sftb , composition , q = 0 ):
121
+ def fromComposition (cls , composition , sftb , q = 0 ):
122
122
"""\
123
123
Calculate average scattering factors from atom concentrations.
124
124
125
125
Parameters
126
126
----------
127
- sftb : ScatteringFactorTable
128
- The ScatteringFactorTable object for looking up the values.
129
127
composition : dictionary or a list of (symbol, amount) pairs.
130
128
The chemical composition for evaluating the average. Atom
131
129
symbols may repeat when it is a list of (symbol, amount) pairs.
130
+ sftb : ScatteringFactorTable
131
+ The ScatteringFactorTable object for looking up the values.
132
132
q : float or NumPy array (optional)
133
133
The Q value in inverse Angstroms for which to lookup
134
134
the scattering factor values.
0 commit comments