Source code for sas.models.NoStructure

#!/usr/bin/env python
""" Provide sin(x) function as a BaseComponent model
"""

from sas.models.BaseComponent import BaseComponent
import math
 
[docs]class NoStructure(BaseComponent): """ Class that evaluates a sin(x) model. """ def __init__(self): """ Initialization """ # Initialize BaseComponent first, then sphere BaseComponent.__init__(self) ## Name of the model self.name = "NoStructure" self.description=""" NoStructure factor F(x)= 1 """
[docs] def clone(self): """ Return a identical copy of self """ return self._clone(NoStructure())
[docs] def run(self, x = 0.0): """ Evaluate the model @param x: input x @return: 1 """ if x.__class__.__name__ == 'list': return 1 elif x.__class__.__name__ == 'tuple': raise ValueError, "Tuples are not allowed as input to BaseComponent models" else: return 1
[docs] def runXY(self, x = 0.0): """ Evaluate the model @param x: input x, or [x, y] [radian] @return: sin(x) or sin(x)*sin(y) """ if x.__class__.__name__ == 'list': return 1 elif x.__class__.__name__ == 'tuple': raise ValueError, "Tuples are not allowed as input to BaseComponent models" else: return 1 # End of file