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 d37ba31 was
988130c6,
checked in by Gervaise Alina <gervyh@…>, 16 years ago
|
self.fixed field added in models but need to change wrapper generator
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[ae3ce4e] | 1 | #!/usr/bin/env python |
---|
| 2 | """ Provide constant function as a BaseComponent model |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | from sans.models.BaseComponent import BaseComponent |
---|
| 6 | import copy |
---|
| 7 | |
---|
| 8 | class Constant(BaseComponent): |
---|
| 9 | """ Class that evaluates a constant model. |
---|
| 10 | List of default parameters: |
---|
| 11 | value = 1.0 |
---|
| 12 | """ |
---|
| 13 | |
---|
| 14 | def __init__(self): |
---|
| 15 | """ Initialization """ |
---|
| 16 | |
---|
| 17 | # Initialize BaseComponent first, then sphere |
---|
| 18 | BaseComponent.__init__(self) |
---|
| 19 | |
---|
| 20 | ## Name of the model |
---|
| 21 | self.name = "Constant" |
---|
[96672c0] | 22 | self.description='F(c)= c where c is a constant' |
---|
[ae3ce4e] | 23 | ## Parameter details [units, min, max] |
---|
| 24 | self.details = {} |
---|
| 25 | self.details['value'] = ['', None, None] |
---|
| 26 | self.params['value'] = 1.0 |
---|
[988130c6] | 27 | #list of parameter that cannot be fitted |
---|
| 28 | self.fixed= [] |
---|
[ae3ce4e] | 29 | def clone(self): |
---|
| 30 | """ Return a identical copy of self """ |
---|
| 31 | obj = Constant() |
---|
| 32 | obj.params = copy.deepcopy(self.params) |
---|
| 33 | return obj |
---|
| 34 | |
---|
| 35 | def run(self, x = 0.0): |
---|
| 36 | """ Evaluate the model |
---|
| 37 | @param x: unused |
---|
| 38 | @return: (constant value) |
---|
| 39 | """ |
---|
| 40 | return self.params['value'] |
---|
| 41 | |
---|
| 42 | def runXY(self, x = 0.0): |
---|
| 43 | """ Evaluate the model |
---|
| 44 | @param x: unused |
---|
| 45 | @return: constant value |
---|
| 46 | """ |
---|
| 47 | return self.params['value'] |
---|
| 48 | |
---|
| 49 | # End of file |
---|
Note: See
TracBrowser
for help on using the repository browser.