Package diffpy :: Package srrietveld :: Module profile
[frames] | no frames]

Source Code for Module diffpy.srrietveld.profile

  1  ############################################################################## 
  2  # 
  3  # diffpy.srrietveld by DANSE Diffraction group 
  4  #                   Simon J. L. Billinge 
  5  #                   (c) 2009 Trustees of the Columbia University 
  6  #                   in the City of New York.  All rights reserved. 
  7  # 
  8  # File coded by:    Yingrui Shang 
  9  # 
 10  # See AUTHORS.txt for a list of people who contributed. 
 11  # See LICENSE.txt for license information. 
 12  # 
 13  ############################################################################## 
 14  """ 
 15  This package contains the Pattern class in SrRietveld, which is an script interface 
 16  to access the structure information 
 17  """ 
 18   
 19  __id__ = "$Id: profile.py 6728 2011-08-26 21:54:11Z yshang $" 
 20   
 21  from diffpy.refinementdata.function import Function 
 22  from diffpy.srrietveld.paramnames import PARAMNAMES 
 23   
24 -class Profile(Function):
25 """Profile is a Function component which contains multiple parameters. 26 A composite function may also contain other functions. 27 28 data member: 29 30 formula: a string of the function definition in C style 31 variables: a space separated string of all variables in the formula 32 """
33 - def __init__(self, owner, name=None, handle=None, formula=None, variables=None, shape=None):
34 """Initialization. 35 36 @type owner: a data project 37 @param owner: the owner, which is usually a refinement. 38 @type name: string 39 @param name the name of the pattern 40 @type handle: a HDF5Handle object 41 @param handle: a HDF5Handle pointing to the underlying HDF5 node. 42 @type formula: string 43 @param formula: a string of the function definition in C style 44 @type variables: a space separated string 45 @param variables: a space separated string of all variables 46 47 A name is passed to the initialization method when creating a node. 48 49 A handle is passed to the inialization method in two cases: 50 1. when loading from a HDF5 file; 51 2. when creating a HDF5 file but the object is a hard link to 52 a preexisiting one. 53 54 In the case when both name and handle are given, name will be simply ignored. 55 In the case when neither name nor handle is given, an exception will be raised. 56 57 Generally, in the scripting interface, users do not have to call this 58 constructor directly 59 """ 60 Function.__init__(self, owner, name, handle, shape) 61 return
62 63
64 - def getCutOff(self):
65 ''' 66 Get the peak cut off factors from GSAS and the cut-off of the peak profile 67 tails for FullProf (Wdt) 68 69 @return: cut off related values 70 ''' 71 72 return self.getByPath(PARAMNAMES[self.getEngineType()]["cut_off"])
73
74 - def getEngineType(self):
75 '''Get the engine type for this refinement 76 77 @return: the string of the engine type, for example I{"gsas"} or I{"fullprof"}''' 78 79 return self.owner.owner.owner.getEngineType()
80
81 - def listCoefficientNames(self):
82 ''' 83 List the names of the profile function coefficients 84 85 @return: a list of coefficient names 86 ''' 87 coefficients = self.getByPath(PARAMNAMES[self.getEngineType()]["profile_parameters"]).first() 88 return coefficients.split()
89
90 - def getNumOfCoefficients(self):
91 ''' 92 Get number of profile coefficients 93 94 @return: number of profile coefficients 95 ''' 96 coefficients = self.getByPath(PARAMNAMES[self.getEngineType()]["profile_parameters"]).first() 97 return len(coefficients.split())
98
99 - def getProfileType(self):
100 ''' 101 Get the profile type number. This number is different in engines. User 102 has to refer to the manual of the engine program for meanings of this 103 id number. Since the profile type should be the same for all the single 104 refinements in the series. So only a single number is returned. 105 106 @return: the profile function identification number 107 ''' 108 return self.getByPath(PARAMNAMES[self.getEngineType()]["profile_type"]).first()
109