Note
Go to the end to download the full example code
Constraints example
This example shows the usages of the different constraints.
from easyCore.Fitting import Constraints
from easyCore.Objects.ObjectClasses import Parameter
p1 = Parameter('p1', 1)
constraint = Constraints.NumericConstraint(p1, '<', 5)
p1.user_constraints['c1'] = constraint
for value in range(4, 7):
p1.value = value
print(f'Set Value: {value}, Parameter Value: {p1}')
Set Value: 4, Parameter Value: <Parameter 'p1': 4.0+/-0, bounds=[-inf:inf]>
Set Value: 5, Parameter Value: <Parameter 'p1': 5.0+/-0, bounds=[-inf:inf]>
Set Value: 6, Parameter Value: <Parameter 'p1': 5.0+/-0, bounds=[-inf:inf]>
To include embedded rST, use a line of >= 20 #
’s or #%%
between your
rST and your code. This separates your example
into distinct text and code blocks. You can continue writing code below the
embedded rST text block:
Total running time of the script: (0 minutes 0.007 seconds)