Changeset 939 for trunk/GSASIIstrIO.py
- Timestamp:
- Jun 2, 2013 11:07:35 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIstrIO.py
r934 r939 1 1 # -*- coding: utf-8 -*- 2 #GSASIIstrIO - structure computation IO routines 2 ''' 3 *GSASIIstrIO: structure I/O routines* 4 ------------------------------------- 5 6 ''' 3 7 ########### SVN repository information ################### 4 8 # $Date: 2013-05-17 12:13:15 -0500 (Fri, 17 May 2013) $ … … 39 43 def GetControls(GPXfile): 40 44 ''' Returns dictionary of control items found in GSASII gpx file 41 input: 42 GPXfile = .gpx full file name 43 return: 44 Controls = dictionary of control items 45 46 :param str GPXfile: full .gpx file name 47 :return: dictionary of control items 45 48 ''' 46 49 Controls = {'deriv type':'analytic Hessian','max cyc':3,'max Hprocess':1, … … 169 172 170 173 def GetFprime(controlDict,Histograms): 174 'Needs a doc string' 171 175 FFtables = controlDict['FFtables'] 172 176 if not FFtables: … … 188 192 def GetPhaseNames(GPXfile): 189 193 ''' Returns a list of phase names found under 'Phases' in GSASII gpx file 190 input: 191 GPXfile = gpx full file name 192 return: 193 PhaseNames = list of phase names 194 195 :param str GPXfile: full .gpx file name 196 :return: list of phase names 194 197 ''' 195 198 fl = open(GPXfile,'rb') … … 209 212 def GetAllPhaseData(GPXfile,PhaseName): 210 213 ''' Returns the entire dictionary for PhaseName from GSASII gpx file 211 input: 212 GPXfile = gpx full file name 213 PhaseName = phase name 214 return: 215 phase dictionary 214 215 :param str GPXfile: full .gpx file name 216 :param str PhaseName: phase name 217 :return: phase dictionary 216 218 ''' 217 219 fl = open(GPXfile,'rb') … … 233 235 def GetHistograms(GPXfile,hNames): 234 236 """ Returns a dictionary of histograms found in GSASII gpx file 235 input: 236 GPXfile = .gpx fullfile name237 hNames = list of histogram names238 return:239 Histograms = dictionary of histograms (types = PWDR & HKLF) 237 238 :param str GPXfile: full .gpx file name 239 :param str hNames: list of histogram names 240 :return: dictionary of histograms (types = PWDR & HKLF) 241 240 242 """ 241 243 fl = open(GPXfile,'rb') … … 281 283 def GetHistogramNames(GPXfile,hType): 282 284 """ Returns a list of histogram names found in GSASII gpx file 283 input: 284 GPXfile = .gpx fullfile name285 hType = list ['PWDR','HKLF']286 return:287 HistogramNames = list of histogram names (types = PWDR & HKLF) 285 286 :param str GPXfile: full .gpx file name 287 :param str hNames: list of histogram names 288 :return: list of histogram names (types = PWDR & HKLF) 289 288 290 """ 289 291 fl = open(GPXfile,'rb') … … 303 305 ''' Returns all histograms that are found in any phase 304 306 and any phase that uses a histogram 305 input: 306 GPXfile = .gpx full file name 307 return: 308 Histograms = dictionary of histograms as {name:data,...} 309 Phases = dictionary of phases that use histograms 307 308 :param str GPXfile: full .gpx file name 309 :return: (Histograms,Phases) 310 311 * Histograms = dictionary of histograms as {name:data,...} 312 * Phases = dictionary of phases that use histograms 313 310 314 ''' 311 315 phaseNames = GetPhaseNames(GPXfile) … … 334 338 335 339 def getBackupName(GPXfile,makeBack): 340 ''' 341 Get the name for the backup .gpx file name 342 343 :param str GPXfile: full .gpx file name 344 :param bool makeBack: if True the name of a new file is returned, if 345 False the name of the last file that exists is returned 346 :returns: the name of a backup file 347 348 ''' 336 349 GPXpath,GPXname = ospath.split(GPXfile) 337 350 if GPXpath == '': GPXpath = '.' … … 350 363 351 364 def GPXBackup(GPXfile,makeBack=True): 365 ''' 366 makes a backup of the current .gpx file (?) 367 368 :param str GPXfile: full .gpx file name 369 :param bool makeBack: if True (default), the backup is written to 370 a new file; if False, the last backup is overwritten 371 :returns: the name of the backup file that was written 372 ''' 352 373 import distutils.file_util as dfu 353 374 GPXback = getBackupName(GPXfile,makeBack) … … 358 379 ''' Updates gpxfile from all histograms that are found in any phase 359 380 and any phase that used a histogram. Also updates rigid body definitions. 360 input: 361 GPXfile = .gpx full file name 362 Histograms = dictionary of histograms as {name:data,...} 363 Phases = dictionary of phases that use histograms 364 RigidBodies = dictionary of rigid bodies 365 CovData = dictionary of refined variables, varyList, & covariance matrix 366 makeBack = True if new backup of .gpx file is to be made; else use the last one made 381 382 383 :param str GPXfile: full .gpx file name 384 :param dict Histograms: dictionary of histograms as {name:data,...} 385 :param dict Phases: dictionary of phases that use histograms 386 :param dict RigidBodies: dictionary of rigid bodies 387 :param dict CovData: dictionary of refined variables, varyList, & covariance matrix 388 :param bool makeBack: True if new backup of .gpx file is to be made; else use the last one made 389 367 390 ''' 368 391 … … 405 428 406 429 def SetSeqResult(GPXfile,Histograms,SeqResult): 430 ''' 431 Needs doc string 432 433 :param str GPXfile: full .gpx file name 434 ''' 407 435 GPXback = GPXBackup(GPXfile) 408 436 print 'Read from file:',GPXback … … 433 461 434 462 def ShowBanner(pFile=None): 463 'Print authorship, copyright and citation notice' 435 464 print >>pFile,80*'*' 436 465 print >>pFile,' General Structure Analysis System-II Crystal Structure Refinement' … … 445 474 446 475 def ShowControls(Controls,pFile=None): 476 'Print controls information' 447 477 print >>pFile,' Least squares controls:' 448 478 print >>pFile,' Refinement type: ',Controls['deriv type'] … … 455 485 def GetFFtable(General): 456 486 ''' returns a dictionary of form factor data for atom types found in General 457 input: 458 General =dictionary of phase info.; includes AtomTypes459 return:460 FFtable = dictionary of form factor data; key is atom type 487 488 :param dict General: dictionary of phase info.; includes AtomTypes 489 :return: FFtable, dictionary of form factor data; key is atom type 490 461 491 ''' 462 492 atomTypes = General['AtomTypes'] … … 471 501 def GetBLtable(General): 472 502 ''' returns a dictionary of neutron scattering length data for atom types & isotopes found in General 473 input: 474 General = dictionary of phase info.; includes AtomTypes & Isotopes 475 return: 476 BLtable = dictionary of scattering length data; key is atom type 503 504 :param dict General: dictionary of phase info.; includes AtomTypes & Isotopes 505 :return: BLtable, dictionary of scattering length data; key is atom type 477 506 ''' 478 507 atomTypes = General['AtomTypes'] … … 485 514 486 515 def GetPawleyConstr(SGLaue,PawleyRef,pawleyVary): 516 'needs a doc string' 487 517 # if SGLaue in ['-1','2/m','mmm']: 488 518 # return #no Pawley symmetry required constraints … … 529 559 530 560 def cellVary(pfx,SGData): 561 'needs a doc string' 531 562 if SGData['SGLaue'] in ['-1',]: 532 563 return [pfx+'A0',pfx+'A1',pfx+'A2',pfx+'A3',pfx+'A4',pfx+'A5'] … … 554 585 555 586 def GetRigidBodyModels(rigidbodyDict,Print=True,pFile=None): 587 'needs a doc string' 556 588 557 589 def PrintResRBModel(RBModel): … … 612 644 613 645 def SetRigidBodyModels(parmDict,sigDict,rigidbodyDict,pFile=None): 646 'needs a doc string' 614 647 615 648 def PrintRBVectandSig(VectRB,VectSig): … … 648 681 649 682 def GetPhaseData(PhaseData,RestraintDict={},rbIds={},Print=True,pFile=None): 683 'needs a doc string' 650 684 651 685 def PrintFFtable(FFtable): … … 989 1023 990 1024 def cellFill(pfx,SGData,parmDict,sigDict): 1025 'needs a doc string' 991 1026 if SGData['SGLaue'] in ['-1',]: 992 1027 A = [parmDict[pfx+'A0'],parmDict[pfx+'A1'],parmDict[pfx+'A2'], … … 1030 1065 1031 1066 def PrintRestraints(cell,SGData,AtPtrs,Atoms,AtLookup,textureData,phaseRest,pFile): 1067 'needs a doc string' 1032 1068 if phaseRest: 1033 1069 Amat = G2lat.cell2AB(cell)[0] … … 1116 1152 1117 1153 def getCellEsd(pfx,SGData,A,covData): 1154 'needs a doc string' 1118 1155 dpr = 180./np.pi 1119 1156 rVsq = G2lat.calc_rVsq(A) … … 1174 1211 1175 1212 def SetPhaseData(parmDict,sigDict,Phases,RBIds,covData,RestraintDict=None,pFile=None): 1213 'needs a doc string' 1176 1214 1177 1215 def PrintAtomsAndSig(General,Atoms,atomsSig): … … 1481 1519 1482 1520 def GetHistogramPhaseData(Phases,Histograms,Print=True,pFile=None): 1521 'needs a doc string' 1483 1522 1484 1523 def PrintSize(hapData): … … 1739 1778 1740 1779 def SetHistogramPhaseData(parmDict,sigDict,Phases,Histograms,Print=True,pFile=None): 1780 'needs a doc string' 1741 1781 1742 1782 def PrintSizeAndSig(hapData,sizeSig): … … 2034 2074 2035 2075 def GetHistogramData(Histograms,Print=True,pFile=None): 2076 'needs a doc string' 2036 2077 2037 2078 def GetBackgroundParms(hId,Background): … … 2245 2286 2246 2287 def SetHistogramData(parmDict,sigDict,Histograms,Print=True,pFile=None): 2288 'needs a doc string' 2247 2289 2248 2290 def SetBackgroundParms(pfx,Background,parmDict,sigDict):
Note: See TracChangeset
for help on using the changeset viewer.