Changeset 9c1a59c in sasmodels


Ignore:
Timestamp:
Sep 27, 2016 9:49:19 AM (2 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, F1F2models_grethe, beta_approx, costrafo411, cuda-test, decoupling_approach, py3, release_v0.94, release_v0.95, ticket-1015-gpu-mem-error, ticket-1015-quick-fix, ticket-1157, ticket-608-user-defined-weights, ticket_1156
Children:
6cefbc9
Parents:
52ec91e
Message:

use array weights for array models; use distribution parameters from sasview

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r3bcb88c r9c1a59c  
    565565        parameters = self._model_info.parameters 
    566566        pairs = [self._get_weights(p) for p in parameters.call_parameters] 
     567        #weights.plot_weights(self._model_info, pairs) 
    567568        call_details, values, is_magnetic = make_kernel_args(calculator, pairs) 
    568569        #call_details.show() 
     
    618619            # remember them is kind of funky. 
    619620            # Note: can't seem to get disperser parameters from sasview 
    620             # (1) Could create a sasview model that has not yet # been 
     621            # (1) Could create a sasview model that has not yet been 
    621622            # converted, assign the disperser to one of its polydisperse 
    622623            # parameters, then retrieve the disperser parameters from the 
    623             # sasview model.  (2) Could write a disperser parameter retriever 
    624             # in sasview.  (3) Could modify sasview to use sasmodels.weights 
    625             # dispersers. 
     624            # sasview model. 
     625            # (2) Could write a disperser parameter retriever in sasview. 
     626            # (3) Could modify sasview to use sasmodels.weights dispersers. 
    626627            # For now, rely on the fact that the sasview only ever uses 
    627628            # new dispersers in the set_dispersion call and create a new 
    628629            # one instead of trying to assign parameters. 
    629             dispersion = weights.MODELS[dispersion.type]() 
    630630            self.dispersion[parameter] = dispersion.get_pars() 
    631631        else: 
     
    658658        elif par.polydisperse: 
    659659            dis = self.dispersion[par.name] 
    660             value, weight = weights.get_weights( 
    661                 dis['type'], dis['npts'], dis['width'], dis['nsigmas'], 
    662                 self.params[par.name], par.limits, par.relative_pd) 
     660            if dis['type'] == 'array': 
     661                value, weight = dis['values'], dis['weights'] 
     662            else: 
     663                value, weight = weights.get_weights( 
     664                    dis['type'], dis['npts'], dis['width'], dis['nsigmas'], 
     665                    self.params[par.name], par.limits, par.relative_pd) 
    663666            return value, weight / np.sum(weight) 
    664667        else: 
Note: See TracChangeset for help on using the changeset viewer.