Changes in sasmodels/modelinfo.py [7b9e4dd:5399809] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/modelinfo.py

    r7b9e4dd r5399809  
    4545# Note that scale and background cannot be coordinated parameters whose value 
    4646# depends on the some polydisperse parameter with the current implementation 
    47 DEFAULT_BACKGROUND = 1e-3 
    4847COMMON_PARAMETERS = [ 
    4948    ("scale", "", 1, (0.0, np.inf), "", "Source intensity"), 
    50     ("background", "1/cm", DEFAULT_BACKGROUND, (-np.inf, np.inf), "", "Source background"), 
     49    ("background", "1/cm", 1e-3, (-np.inf, np.inf), "", "Source background"), 
    5150] 
    5251assert (len(COMMON_PARAMETERS) == 2 
     
    164163    parameter.length = length 
    165164    parameter.length_control = control 
    166  
    167165    return parameter 
    168166 
     
    424422        self.kernel_parameters = parameters 
    425423        self._set_vector_lengths() 
    426  
    427424        self.npars = sum(p.length for p in self.kernel_parameters) 
    428425        self.nmagnetic = sum(p.length for p in self.kernel_parameters 
     
    431428        if self.nmagnetic: 
    432429            self.nvalues += 3 + 3*self.nmagnetic 
    433  
    434430        self.call_parameters = self._get_call_parameters() 
    435431        self.defaults = self._get_defaults() 
     
    467463        self.magnetism_index = [k for k, p in enumerate(self.call_parameters) 
    468464                                if p.id.startswith('M0:')] 
    469  
    470465        self.pd_1d = set(p.name for p in self.call_parameters 
    471466                         if p.polydisperse and p.type not in ('orientation', 'magnetic')) 
     
    771766        # Custom sum/multi models 
    772767        return kernel_module.model_info 
     768 
    773769    info = ModelInfo() 
    774770    #print("make parameter table", kernel_module.parameters) 
     
    792788    info.category = getattr(kernel_module, 'category', None) 
    793789    info.structure_factor = getattr(kernel_module, 'structure_factor', False) 
     790    # TODO: find Fq by inspection 
     791    info.effective_radius_type = getattr(kernel_module, 'effective_radius_type', None) 
     792    info.have_Fq = getattr(kernel_module, 'have_Fq', False) 
    794793    info.profile_axes = getattr(kernel_module, 'profile_axes', ['x', 'y']) 
    795794    info.source = getattr(kernel_module, 'source', []) 
    796795    info.c_code = getattr(kernel_module, 'c_code', None) 
     796    info.effective_radius = getattr(kernel_module, 'effective_radius', None) 
     797    info.ER = None  # CRUFT 
     798    info.VR = None  # CRUFT 
    797799    # TODO: check the structure of the tests 
    798800    info.tests = getattr(kernel_module, 'tests', []) 
    799     info.ER = getattr(kernel_module, 'ER', None) # type: ignore 
    800     info.VR = getattr(kernel_module, 'VR', None) # type: ignore 
    801801    info.form_volume = getattr(kernel_module, 'form_volume', None) # type: ignore 
    802802    info.Iq = getattr(kernel_module, 'Iq', None) # type: ignore 
     
    823823    info.lineno = {} 
    824824    _find_source_lines(info, kernel_module) 
    825  
    826825    return info 
    827826 
     
    916915    #: provided in the file. 
    917916    structure_factor = None # type: bool 
     917    #: True if the model defines an Fq function with signature 
     918    #: void Fq(double q, double *F1, double *F2, ...) 
     919    have_Fq = False 
    918920    #: List of C source files used to define the model.  The source files 
    919921    #: should define the *Iq* function, and possibly *Iqac* or *Iqabc* if the 
     
    922924    #: use those functions.  Form factors are indicated by providing 
    923925    #: an :attr:`ER` function. 
     926    effective_radius_type = None   # type: List[str] 
     927    #: Returns the occupied volume and the total volume for each parameter set. 
     928    #: See :attr:`ER` for details on the parameters. 
    924929    source = None           # type: List[str] 
    925930    #: The set of tests that must pass.  The format of the tests is described 
     
    942947    #: each parameter set.  Multiplicity parameters will be received as 
    943948    #: arrays, with one row per polydispersity condition. 
    944     ER = None               # type: Optional[Callable[[np.ndarray], np.ndarray]] 
    945     #: Returns the occupied volume and the total volume for each parameter set. 
    946     #: See :attr:`ER` for details on the parameters. 
    947     VR = None               # type: Optional[Callable[[np.ndarray], Tuple[np.ndarray, np.ndarray]]] 
    948     #: Arbitrary C code containing supporting functions, etc., to be inserted 
    949     #: after everything in source.  This can include Iq and Iqxy functions with 
    950     #: the full function signature, including all parameters. 
    951949    c_code = None 
    952950    #: Returns the form volume for python-based models.  Form volume is needed 
Note: See TracChangeset for help on using the changeset viewer.