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