Changes in / [9616dfe:dbf1a60] in sasmodels


Ignore:
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • example/multiscatfit.py

    r49d1f8b8 rbc248f8  
    3434from sasmodels.data import load_data, set_beam_stop, set_top 
    3535 
    36 from sasmodels.multiscat import MultipleScattering 
     36from multiscat import MultipleScattering 
    3737 
    3838## Load the data 
    3939#data = load_data('DEC07267.DAT') 
    4040#set_beam_stop(data, 0.003, outer=0.025) 
    41 data = load_data('latex_smeared.xml', index=0) 
     41data = load_data('latex_smeared.xml', index=1) 
    4242 
    4343## Define the model 
     
    6666 
    6767# Mulitple scattering probability parameter 
    68 # HACK: the probability is stuffed in as an extra parameter to the experiment. 
     68# HACK: the parameter is assigned to model.theta, which is otherwise unused 
     69# since the dataset is 1D; this won't work for 2D data 
    6970probability = Parameter(name="probability", value=0.0) 
    7071probability.range(0.0, 0.9) 
     72model.phi = probability 
    7173 
    72 M = Experiment(data=data, model=model, extra_pars={'probability': probability}) 
     74M = Experiment(data=data, model=model) 
    7375 
    7476# Stack mulitple scattering on top of the existing resolution function. 
  • sasmodels/bumps_model.py

    r49d1f8b8 r2d81cfe  
    137137    """ 
    138138    _cache = None # type: Dict[str, np.ndarray] 
    139     def __init__(self, data, model, cutoff=1e-5, name=None, extra_pars=None): 
     139    def __init__(self, data, model, cutoff=1e-5, name=None): 
    140140        # type: (Data, Model, float) -> None 
    141141        # remember inputs so we can inspect from outside 
     
    145145        self._interpret_data(data, model.sasmodel) 
    146146        self._cache = {} 
    147         self.extra_pars = extra_pars 
    148147 
    149148    def update(self): 
     
    167166        Return a dictionary of parameters 
    168167        """ 
    169         pars = self.model.parameters() 
    170         if self.extra_pars: 
    171             pars.update(self.extra_pars) 
    172         return pars 
     168        return self.model.parameters() 
    173169 
    174170    def theory(self): 
  • sasmodels/kerneldll.py

    rbf94e6e r2d81cfe  
    158158        return CC + [source, "-o", output, "-lm"] 
    159159 
    160 # Assume the default location of module DLLs is in .sasmodels/compiled_models. 
    161 DLL_PATH = os.path.join(os.path.expanduser("~"), ".sasmodels", "compiled_models") 
     160# Windows-specific solution 
     161if os.name == 'nt': 
     162    # Assume the default location of module DLLs is in .sasmodels/compiled_models. 
     163    DLL_PATH = os.path.join(os.path.expanduser("~"), ".sasmodels", "compiled_models") 
     164    if not os.path.exists(DLL_PATH): 
     165        os.makedirs(DLL_PATH) 
     166else: 
     167    # Set up the default path for compiled modules. 
     168    DLL_PATH = tempfile.gettempdir() 
    162169 
    163170ALLOW_SINGLE_PRECISION_DLLS = True 
     
    226233 
    227234    Set *sasmodels.kerneldll.DLL_PATH* to the compiled dll output path. 
    228     The default is in ~/.sasmodels/compiled_models. 
     235    The default is the system temporary directory. 
    229236    """ 
    230237    if dtype == F16: 
     
    243250        need_recompile = dll_time < newest_source 
    244251    if need_recompile: 
    245         # Make sure the DLL path exists 
    246         if not os.path.exists(DLL_PATH): 
    247             os.makedirs(DLL_PATH) 
    248252        basename = splitext(os.path.basename(dll))[0] + "_" 
    249253        system_fd, filename = tempfile.mkstemp(suffix=".c", prefix=basename) 
Note: See TracChangeset for help on using the changeset viewer.