ESS_GUIESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change
on this file since ecc5d043 was
ecc5d043,
checked in by Piotr Rozyczko <piotr.rozyczko@…>, 5 years ago
|
Reworked the complex constraint functionality SASVIEW-1019
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[eae226b] | 1 | class Constraint(object): |
---|
| 2 | """ |
---|
| 3 | Internal representation of a single parameter constraint |
---|
[14ec91c5] | 4 | Currently just a data structure, might get expaned with more functionality, |
---|
| 5 | hence made into a class. |
---|
[eae226b] | 6 | """ |
---|
[ecc5d043] | 7 | def __init__(self, parent=None, param=None, value=0.0, |
---|
| 8 | min=None, max=None, func=None, value_ex=None, |
---|
| 9 | operator="="): |
---|
[eae226b] | 10 | self._value = value |
---|
| 11 | self._param = param |
---|
[baeac95] | 12 | self._value_ex = value_ex |
---|
[eae226b] | 13 | self._func = func |
---|
[ba01ad1] | 14 | self.active = True |
---|
[eae226b] | 15 | self._min = min |
---|
| 16 | self._max = max |
---|
[ecc5d043] | 17 | self._operator = operator |
---|
[eae226b] | 18 | |
---|
| 19 | @property |
---|
| 20 | def value(self): |
---|
[baeac95] | 21 | # value/parameter to fit to (e.g. 1.0 or sld) |
---|
[eae226b] | 22 | return self._value |
---|
| 23 | |
---|
| 24 | @value.setter |
---|
| 25 | def value(self, val): |
---|
| 26 | self._value = val |
---|
| 27 | |
---|
| 28 | @property |
---|
[baeac95] | 29 | def value_ex(self): |
---|
| 30 | # full parameter name to fit to (e.g. M1.sld) |
---|
| 31 | return self._value_ex |
---|
| 32 | |
---|
| 33 | @value_ex.setter |
---|
| 34 | def value_ex(self, val): |
---|
| 35 | self._value_ex = val |
---|
| 36 | |
---|
| 37 | @property |
---|
[eae226b] | 38 | def param(self): |
---|
[baeac95] | 39 | # parameter which is being fitted |
---|
[eae226b] | 40 | return self._param |
---|
| 41 | |
---|
| 42 | @param.setter |
---|
| 43 | def param(self, val): |
---|
| 44 | self._param = val |
---|
| 45 | |
---|
| 46 | @property |
---|
| 47 | def func(self): |
---|
[baeac95] | 48 | # Function to be used for constraint |
---|
| 49 | # e.g. sqrt(M1.sld+1.0) |
---|
[eae226b] | 50 | return self._func |
---|
| 51 | |
---|
| 52 | @func.setter |
---|
| 53 | def func(self, val): |
---|
| 54 | self._func = val |
---|
| 55 | |
---|
| 56 | @property |
---|
| 57 | def min(self): |
---|
[baeac95] | 58 | # min param value for single value constraints |
---|
[eae226b] | 59 | return self._min |
---|
| 60 | |
---|
| 61 | @min.setter |
---|
| 62 | def min(self, val): |
---|
| 63 | self._min = val |
---|
| 64 | |
---|
| 65 | @property |
---|
| 66 | def max(self): |
---|
[baeac95] | 67 | # max param value for single value constraints |
---|
[eae226b] | 68 | return self._max |
---|
| 69 | |
---|
| 70 | @max.setter |
---|
| 71 | def max(self, val): |
---|
| 72 | self._max = val |
---|
| 73 | |
---|
[ecc5d043] | 74 | @property |
---|
| 75 | def operator(self): |
---|
| 76 | # operator to use for constraint |
---|
| 77 | return self._operator |
---|
| 78 | |
---|
| 79 | @operator.setter |
---|
| 80 | def operator(self, val): |
---|
| 81 | self._operator = val |
---|
| 82 | |
---|
Note: See
TracBrowser
for help on using the repository browser.