ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 90662e6 was
79492222,
checked in by krzywon, 10 years ago
|
Changed the file and folder names to remove all SANS references.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[51f14603] | 1 | """ |
---|
| 2 | Provide constant function as a BaseComponent model |
---|
| 3 | """ |
---|
| 4 | |
---|
[79492222] | 5 | from sas.models.BaseComponent import BaseComponent |
---|
[51f14603] | 6 | import copy |
---|
| 7 | |
---|
| 8 | class Constant(BaseComponent): |
---|
| 9 | """ |
---|
| 10 | Class that evaluates a constant model. |
---|
| 11 | List of default parameters: |
---|
| 12 | |
---|
| 13 | * value = 1.0 |
---|
| 14 | """ |
---|
| 15 | |
---|
| 16 | def __init__(self): |
---|
| 17 | """ Initialization """ |
---|
| 18 | |
---|
| 19 | # Initialize BaseComponent first, then sphere |
---|
| 20 | BaseComponent.__init__(self) |
---|
| 21 | |
---|
| 22 | ## Name of the model |
---|
| 23 | self.name = "Constant" |
---|
| 24 | self.description = 'F(c)= c where c is a constant' |
---|
| 25 | ## Parameter details [units, min, max] |
---|
| 26 | self.details = {} |
---|
| 27 | self.details['value'] = ['', None, None] |
---|
| 28 | self.params['value'] = 1.0 |
---|
| 29 | #list of parameter that cannot be fitted |
---|
| 30 | self.fixed = [] |
---|
| 31 | def clone(self): |
---|
| 32 | """ Return a identical copy of self """ |
---|
| 33 | obj = Constant() |
---|
| 34 | obj.params = copy.deepcopy(self.params) |
---|
| 35 | return obj |
---|
| 36 | |
---|
| 37 | def run(self, x = 0.0): |
---|
| 38 | """ Evaluate the model |
---|
| 39 | @param x: unused |
---|
| 40 | @return: (constant value) |
---|
| 41 | """ |
---|
| 42 | return self.params['value'] |
---|
| 43 | |
---|
| 44 | def runXY(self, x = 0.0): |
---|
| 45 | """ Evaluate the model |
---|
| 46 | @param x: unused |
---|
| 47 | @return: constant value |
---|
| 48 | """ |
---|
| 49 | return self.params['value'] |
---|
| 50 | |
---|
| 51 | # End of file |
---|
Note: See
TracBrowser
for help on using the repository browser.