on the developer version of SasView, where reparameterizedModel is the reparameterized file, oldModel is the model being reparameterized, and reparameterizedVariable is the name of a reparameterized variable accessed in inline C code within oldModel.
This bug occurs if any inline C code is included in the model, even if a separate C file is defined using source = [] in the main python file. However, models that have defined C code entirely in a separate file are unaffected.
Note: currently, this bug only affects lamellar.py in the 1.0.7 sasmodels version, but will also affect any user-created models with inline C unless resolved
To Reproduce
Steps to reproduce the behavior:
Create a new user model.
Copy in the following code:
from numpy import inf
from sasmodels.core import reparameterize
from sasmodels.special import *
3. The new model should return an error if a model check is run on it
**Expected behavior**
The model should have no issues being loaded or used with the new redefinitions.
**sasmodels version:**
- Version: 1.0.7
**Suggested Solution:**
Either deprecate using inline C code (only one model currently uses it and it is easily replaceable), or fix the reparameterization code in sasmodels.core to support inline C code.
generate._gen_fn needs to be called on the original parameter table, not the new parameter table defined by core.reparameterize. Replacing call_table with base_table in the following should work.
Partner issue of SasView/sasview#2958 To see how to replicate issue in the SasView GUI, see above issue
Describe the bug Reparameterizing a python model with inline C code will fail with an error in the format:
on the developer version of SasView, where
reparameterizedModel
is the reparameterized file,oldModel
is the model being reparameterized, andreparameterizedVariable
is the name of a reparameterized variable accessed in inline C code withinoldModel
.This bug occurs if any inline C code is included in the model, even if a separate C file is defined using
source = []
in the main python file. However, models that have defined C code entirely in a separate file are unaffected.Note: currently, this bug only affects lamellar.py in the 1.0.7 sasmodels version, but will also affect any user-created models with inline C unless resolved
To Reproduce Steps to reproduce the behavior:
from sasmodels.core import reparameterize from sasmodels.special import *
parameters = [
name, units, default, [min, max], type, description
]
translation = """ sld = new """
model_info = reparameterize('lamellar', parameters, translation, file)