Changeset 711d8e2 in sasmodels


Ignore:
Timestamp:
Feb 20, 2015 12:45:49 PM (10 years ago)
Author:
pkienzle
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:
f734e7d
Parents:
5ca9762 (diff), 6ea6902 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:sasview/sasmodels

Location:
sasmodels
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/bumps_model.py

    r29f5536 rf1ecfa92  
    348348                self._fn = self.model(input) 
    349349 
    350             pars = [getattr(self,p).value for p in self._fn.fixed_pars] 
     350            fixed_pars = [getattr(self,p).value for p in self._fn.fixed_pars] 
    351351            pd_pars = [self._get_weights(p) for p in self._fn.pd_pars] 
    352             #print pars 
    353             self._theory[self.index] = self._fn(pars, pd_pars, self.cutoff) 
     352            #print fixed_pars,pd_pars 
     353            self._theory[self.index] = self._fn(fixed_pars, pd_pars, self.cutoff) 
    354354            #self._theory[:] = self._fn.eval(pars, pd_pars) 
    355355            if self.data_type == 'sesans': 
  • sasmodels/generate.py

    r2a74b99 rf1ecfa92  
    549549        weights = [p+"_w" for p in pd_pars] 
    550550        sasview_spherical = "" 
     551    weight_product = "*".join(weights) if len(weights) > 1 else "1.0" 
    551552    subst = { 
    552         'weight_product': "*".join(weights), 
     553        'weight_product': weight_product, 
    553554        'volume_norm': volume_norm, 
    554555        'fn': fn, 
     
    574575 
    575576    # Finally, put the pieces together in the kernel. 
     577    pd_length = "+".join('N'+p for p in pd_pars) if len(pd_pars) > 0 else "0" 
    576578    subst = { 
    577579        # kernel name is, e.g., cylinder_Iq 
     
    582584        'par_decl': par_decl, 
    583585        # to copy global to local pd pars we need, e.g., Nradius+Nlength 
    584         'pd_length': "+".join('N'+p for p in pd_pars), 
     586        'pd_length': pd_length, 
    585587        # the q initializers, e.g., double qi = q[i]; 
    586588        'qinit': q_pars['qinit'], 
  • sasmodels/kernelcl.py

    r676351f rf1ecfa92  
    353353        fixed = [real(p) for p in pars] 
    354354        cutoff = real(cutoff) 
    355         loops = np.hstack(pd_pars) 
     355        loops = np.hstack(pd_pars) if pd_pars else np.empty(0,dtype=self.input.dtype) 
    356356        loops = np.ascontiguousarray(loops.T, self.input.dtype).flatten() 
    357357        Nloops = [np.uint32(len(p[0])) for p in pd_pars] 
  • sasmodels/models/gaussian_peak.py

    r4c8f9cd r6ea6902  
    4242# This should perhaps be volume normalized? 
    4343form_volume = """ 
    44     return 1; 
     44    return 1.0; 
    4545    """ 
    4646 
    4747Iq = """ 
    48     return exp(-0.5*pow((q - q0])/sigma,2.0)); 
     48    return exp(-0.5*pow((q - q0)/sigma,2.0)); 
    4949    """ 
    5050 
  • sasmodels/model_test.py

    r5428233 r5ca9762  
    6666    args = exc.args 
    6767    if not args: 
    68         arg0 = msg 
     68        exc.args = (msg,) 
    6969    else: 
    70         arg0 = " ".join((args[0],msg)) 
    71     exc.args = tuple([arg0] + list(args[1:])) 
     70        try: 
     71            arg0 = " ".join((args[0],msg)) 
     72            exc.args = tuple([arg0] + list(args[1:])) 
     73        except: 
     74            exc.args = (" ".join((str(exc),msg)),) 
    7275     
    7376def suite(): 
     
    8386 
    8487        model = getattr(module, model_name, None) 
    85         tests = getattr(model, 'tests', []) 
     88        smoke_tests = [[{},0.1,None],[{},(0.1,0.1),None]] 
     89        tests = smoke_tests + getattr(model, 'tests', []) 
    8690         
    8791        if tests: 
     
    120124                     
    121125                if isinstance(Q[0], tuple): 
    122                     npQ = [np.array([Qi[d] for Qi in Q]) for d in xrange(len(Q[0]))] 
     126                    Qx,Qy = zip(*Q) 
     127                    Q_vectors = [np.array(Qx), np.array(Qy)] 
    123128                else: 
    124                     npQ = [np.array(Q)] 
     129                    Q_vectors = [np.array(Q)] 
    125130 
    126                 self.assertTrue(Q) 
    127                 self.assertEqual(len(I), len(Q))     
     131                self.assertEqual(len(I), len(Q)) 
    128132             
    129                 Iq = eval_kernel(self.kernel, npQ, params) 
     133                Iq = eval_kernel(self.kernel, Q_vectors, params) 
    130134             
    131135                self.assertGreater(len(Iq), 0)     
     
    133137                 
    134138                for q, i, iq in zip(Q, I, Iq): 
     139                    if i is None: continue # smoke test --- make sure it runs 
    135140                    err = np.abs(i - iq) 
    136141                    nrm = np.abs(i) 
Note: See TracChangeset for help on using the changeset viewer.