-
Notifications
You must be signed in to change notification settings - Fork 30
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
pure python valid region does not behave as shown in docs #577
Comments
Should avoid computing the form volume and form radius since they are also likely to be invalid. The code becomes: if call_details.num_active == 0:
weight_norm = 1.0
total = form()
if np.isnan(total).any():
total = np.zeros(nq, 'd')
weighted_shell = weighted_form = weighted_radius = 0
else:
weighted_shell, weighted_form = form_volume()
weighted_radius = form_radius() |
Current code looks like returning NaN should work: sasmodels/sasmodels/kernelpy.py Lines 268 to 278 in 00fd024
For valid = ... we could do a simple string substitution with Note that this is the same place we would need to insert a call to transform the function arguments if we want |
If there are regions of parameter space which are not valid, a model function can exclude them from fitting according to the docs. However the C models do it differently and require a
valid = (Boolean expression)
while the python model is told to returnnp.nan
.Recent attempts at using this second version shows it does not actually work for fitting. Upon investigation @pkienzle believes that the following code placed at line 225 of
kernelpy.py
] might fix the problemThat said, a preferred solution would be to make the two interfaces the same. That however would require parsing a C style Boolean expression.
The text was updated successfully, but these errors were encountered: