Changeset 9a943d0 in sasmodels
- Timestamp:
- Apr 8, 2016 10:15:52 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- f619de7
- Parents:
- c1a888b
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernelpy.py
rc1a888b r9a943d0 164 164 self.q_input = None 165 165 166 def _loops(parameters, # type: np.ndarray 167 form, # type: Callable[[], np.ndarray] 168 form_volume, # type: Callable[[], float] 169 nq, # type: int 170 call_details,# type: details.CallDetails 171 weights, # type: np.ndarray 172 values, # type: np.ndarray 173 cutoff, # type: float 174 ): # type: (...) -> None 166 def _loops(parameters, form, form_volume, nq, call_details, 167 weights, values, cutoff): 168 # type: (np.ndarray, Callable[[], np.ndarray], Callable[[], float], int, details.CallDetails, np.ndarray, np.ndarray, float) -> None 175 169 ################################################################ 176 170 # # -
sasmodels/modelinfo.py
rc1a888b r9a943d0 22 22 from .details import CallDetails 23 23 Limits = Tuple[float, float] 24 LimitsOrChoice = Union[Limits, Tuple[str]]25 ParameterDef = Tuple[str, str, float, Limits OrChoice, str, str]24 #LimitsOrChoice = Union[Limits, Tuple[str]] 25 ParameterDef = Tuple[str, str, float, Limits, str, str] 26 26 ParameterSetUser = Dict[str, Union[float, List[float]]] 27 27 ParameterSet = Dict[str, float] … … 42 42 # depends on the some polydisperse parameter with the current implementation 43 43 COMMON_PARAMETERS = [ 44 ["scale", "", 1, [0, np.inf], "", "Source intensity"],45 ["background", "1/cm", 1e-3, [0, np.inf], "", "Source background"],44 ("scale", "", 1, (0.0, np.inf), "", "Source intensity"), 45 ("background", "1/cm", 1e-3, (0.0, np.inf), "", "Source background"), 46 46 ] 47 47 assert (len(COMMON_PARAMETERS) == 2 … … 69 69 def parse_parameter(name, units='', default=np.NaN, 70 70 limits=(-np.inf, np.inf), ptype='', description=''): 71 # type: (str, str, float, Limits OrChoice, str, str) -> Parameter71 # type: (str, str, float, Limits, str, str) -> Parameter 72 72 """ 73 73 Parse an individual parameter from the parameter definition block. … … 174 174 lookup = dict((p.id, p) for p in partable.kernel_parameters) 175 175 result = partable.defaults.copy() 176 scalars = dict((name, value) for name, value in pars.items() 177 if name not in lookup or lookup[name].length == 1) 176 178 vectors = dict((name,value) for name,value in pars.items() 177 179 if name in lookup and lookup[name].length > 1) 178 180 if vectors: 179 scalars = dict((name, value) for name, value in pars.items()180 if name not in lookup or lookup[name].length == 1)181 181 for name, value in vectors.items(): 182 182 if np.isscalar(value): … … 192 192 for (k,v) in enumerate(value): 193 193 scalars[name+str(k)] = v 194 result.update(scalars) 195 else: 196 result.update(pars) 194 result.update(scalars) 197 195 198 196 return result … … 642 640 # TODO: check the structure of the tests 643 641 info.tests = getattr(kernel_module, 'tests', []) 644 info.ER = getattr(kernel_module, 'ER', None) 645 info.VR = getattr(kernel_module, 'VR', None) 646 info.form_volume = getattr(kernel_module, 'form_volume', None) 647 info.Iq = getattr(kernel_module, 'Iq', None) 648 info.Iqxy = getattr(kernel_module, 'Iqxy', None) 649 info.profile = getattr(kernel_module, 'profile', None) 650 info.sesans = getattr(kernel_module, 'sesans', None) 642 info.ER = getattr(kernel_module, 'ER', None) # type: ignore 643 info.VR = getattr(kernel_module, 'VR', None) # type: ignore 644 info.form_volume = getattr(kernel_module, 'form_volume', None) # type: ignore 645 info.Iq = getattr(kernel_module, 'Iq', None) # type: ignore 646 info.Iqxy = getattr(kernel_module, 'Iqxy', None) # type: ignore 647 info.profile = getattr(kernel_module, 'profile', None) # type: ignore 648 info.sesans = getattr(kernel_module, 'sesans', None) # type: ignore 651 649 652 650 # Precalculate the monodisperse parameter details
Note: See TracChangeset
for help on using the changeset viewer.