You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to create a constraint, it appears that the order of an expression in parentheses changes when a math operation is applied to the parameter. For example, the below behaves normally:
The same happens when other operations are applied.
>>> from phoebe.parameters.constraint import sin
>>> (1 - sin(b['ecc@binary']))
<ConstraintParameter: (sin({ecc@binary@component})) - 1.000000 (SI) => -1.0>
The code can be tricked by explicitly putting the parameter first though. So the mathmatically equivalent espression below produces the correct result:
I'm not surprised that order matters (and you'll see lots of similar workarounds to what you showed in the built-in constraints themselves), but I think in the past this used to raise an error instead of giving the wrong expression - thanks for reporting this!
When trying to create a constraint, it appears that the order of an expression in parentheses changes when a math operation is applied to the parameter. For example, the below behaves normally:
but when an operation is applied to the eccentricity parameter the expression order changes moving the parameter to the front and flipping the signs:
The same happens when other operations are applied.
The code can be tricked by explicitly putting the parameter first though. So the mathmatically equivalent espression below produces the correct result:
The text was updated successfully, but these errors were encountered: