Changeset 2996 for branch/2frame/GSASIIscriptable.py
- Timestamp:
- Aug 11, 2017 12:16:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/2frame/GSASIIscriptable.py
r2984 r2996 34 34 35 35 import GSASIIpath 36 GSASIIpath.SetBinaryPath( ) # would rather have this in __name__ == '__main__' stanza36 GSASIIpath.SetBinaryPath(False) # would rather have this in __name__ == '__main__' stanza 37 37 import GSASIIIO as G2IO 38 38 import GSASIIfiles as G2fil … … 1162 1162 return self['data'][0]['ranId'] 1163 1163 1164 @property 1165 def residuals(self): 1166 data = self['data'][0] 1167 return {key: data[key] 1168 for key in ['R', 'Rb', 'wR', 'wRb', 'wRmin']} 1169 1164 1170 def fit_fixed_points(self): 1165 1171 """Attempts to apply a background fit to the fixed points currently specified.""" … … 1199 1205 1200 1206 # Some simple lookups 1207 controls = self.proj['Controls']['data'] 1201 1208 inst, inst2 = self['Instrument Parameters'] 1202 1209 pwddata = self['data'][1] … … 1215 1222 1216 1223 # Do the fit 1217 # TODO get controls from root1218 1224 data = np.array([xdata, ydata, W, Z, Z, Z]) 1219 1225 G2pwd.DoPeakFit('LSQ', [], bgrnd, limits, inst, inst2, data, 1220 bakVary, controls={})1226 prevVaryList=bakVary, controls=controls) 1221 1227 1222 1228 # Post-fit … … 1236 1242 return self['data'][1][3] 1237 1243 1238 def plot(self, Yobs=True, Ycalc=True, Background=True ):1244 def plot(self, Yobs=True, Ycalc=True, Background=True, Residual=True): 1239 1245 if plt: 1240 1246 data = self['data'][1] … … 1245 1251 if Background: 1246 1252 plt.plot(data[0], data[4], label='Background') 1253 if Residual: 1254 plt.plot(data[0], data[5], label="Residual") 1247 1255 1248 1256 def set_refinements(self, refs): … … 1310 1318 # are added 1311 1319 if do_fit_fixed_points: 1320 # Background won't be fit if refinement flag not set 1321 orig = self['Background'][0][1] 1322 self['Background'][0][1] = True 1312 1323 self.fit_fixed_points() 1324 # Restore the previous value 1325 self['Background'][0][1] = orig 1313 1326 1314 1327 def clear_refinements(self, refs): … … 1354 1367 def is_valid_refinement_key(key): 1355 1368 valid_keys = ["Cell", "Atoms", "LeBail"] 1369 return key in valid_keys 1370 1371 @staticmethod 1372 def is_valid_HAP_refinement_key(key): 1373 valid_keys = ["Babinet", "Extinction", "HStrain", "Mustrain", 1374 "Pref.Ori.", "Show", "Size", "Use", "Scale"] 1356 1375 return key in valid_keys 1357 1376
Note: See TracChangeset
for help on using the changeset viewer.