-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parameter types and bounds #185
Conversation
This needs some fixup to make the tests pass on Travis again before it can be merged. |
5b20aeb
to
feff513
Compare
feff513
to
7727c8d
Compare
This is actually quite hard, as there is inconsistency on what doesn't work when one has strings inside a struct initialiser. char name[16] = "test"; // won't work for some implementations Unfortunately, on other platforms (e.g. Apple) it appears that assigning a string literal to a constant char* str = "test"; // does not work sometimes The above are just examples to showcase what does not work; in the real case, the strings are members of a struct that is initialised. I'm investigating. |
Taking a closer look at what the compiler puts into memory in the first case above reveals the buggy behaviour. This is what the
And here is what it actually looks like using the offending compiler:
It seems like the string is not correctly padded to a |
04f072b
to
7727c8d
Compare
As this is a problem with some OpenCL implementations, I will merge this and open a separate issue. |
parameter types and bounds, closes #124
This PR introduces the possibility to give types and bounds to the individual parameters in an object definition. So far, the parameter types only serve to give a number of default bounds on parameters (see below), but they will be more useful in the future.
An example from the Sérsic source is
The second (optional) argument is the parameter type.
There are a number of common, predefined parameter types:
POSITION_X
,POSITION_Y
,RADIUS
,MAGNITUDE
,AXIS_RATIO
,POS_ANGLE
.The generic type for parameters without special, pre-defined meaning is
PARAMETER
, which is the default.The third (optional) argument is the definition of hard bounds for the parameter. This serves to limit the possible range of parameter values, for example to exclude unphysical quantities. Lensed will check whether a prior agrees with the bounds, and display a warning if the prior is partially out of the range, or an error if it is fully out of range.
We can also define bounds to be set by default for certain parameter types. So far, these are
RADIUS
has bounds [0, inf)AXIS_RATIO
has bounds [0, 1]