Changeset 35b4c47 in sasmodels


Ignore:
Timestamp:
Mar 15, 2016 5:25:08 PM (9 years ago)
Author:
Paul Kienzle <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:
667a6f2
Parents:
754e27b
Message:

improve product model, but still not right

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    r17bbadd r35b4c47  
    366366        composition_type, parts = model_info['composition'] 
    367367        if composition_type == 'product': 
    368             from sas.models import MultiplicationModel 
     368            from sas.models.MultiplicationModel import MultiplicationModel 
    369369            P, S = [get_model(p) for p in model_info['oldname']] 
    370370            model = MultiplicationModel(P, S) 
  • sasmodels/product.py

    r17bbadd r35b4c47  
    100100            num_p_pd = len(p_info['pd-2d']) 
    101101            num_s_fixed = len(s_info['fixed-2d']) 
    102             num_s_pd = len(s_info['pd-2d']) 
     102            num_s_pd = len(s_info['pd-2d']) - 1 # exclude effect_radius 
    103103            # volume parameters are amongst the pd pars for P, not S 
    104104            vol_par_idx = [k for k,v in enumerate(p_info['pd-2d']) 
     
    108108            num_p_pd = len(p_info['pd-1d']) 
    109109            num_s_fixed = len(s_info['fixed-1d']) 
    110             num_s_pd = len(s_info['pd-1d']) 
     110            num_s_pd = len(s_info['pd-1d']) - 1  # exclude effect_radius 
    111111            # volume parameters are amongst the pd pars for P, not S 
    112112            vol_par_idx = [k for k,v in enumerate(p_info['pd-1d']) 
     
    118118        # so borrow values from end of p_fixed.  This makes volfraction the 
    119119        # first S parameter. 
    120         start += num_p_fixed - 3 
     120        start += num_p_fixed - 2 
    121121        par_map['s_fixed'] = np.arange(start, start+num_s_fixed) 
    122122        par_map['volfraction'] = num_p_fixed 
     
    126126        par_map['p_pd'] = np.arange(start, start+num_p_pd) 
    127127        start += num_p_pd 
    128         par_map['s_pd'] = np.arange(start, start+num_s_pd)  # should be empty... 
    129  
     128        par_map['s_pd'] = np.arange(start-1, start+num_s_pd)  # should be empty... 
    130129 
    131130        self.fixed_pars = model_info['partype']['fixed-' + dim] 
     
    146145        s_pd = [pars[k] for k in self.par_map['s_pd']] 
    147146        vol_pars = [pars[k] for k in self.par_map['vol_pars']] 
    148         p_pars = dict(list(zip(self.fixed_pars, p_fixed)) 
    149                       +list(zip(self.pd_pars, p_pd))) 
    150147 
    151148        effect_radius, vol_ratio = call_ER_VR(self.p_kernel.info, vol_pars) 
     
    155152        s_fixed[SCALE] = scale 
    156153        s_fixed[BACKGROUND] = 0.0 
    157         s_fixed[EFFECT_RADIUS] = effect_radius 
    158         s_fixed[VOLFRACTION] = s_volfraction/vol_ratio 
     154        s_fixed[2] = s_volfraction/vol_ratio 
     155        s_pd[0] = [effect_radius], [1.0] 
    159156 
    160157        p_res = self.p_kernel(p_fixed, p_pd) 
    161158        s_res = self.s_kernel(s_fixed, s_pd) 
     159        #print s_fixed, s_pd, p_fixed, p_pd 
    162160 
    163161        return p_res*s_res + background 
Note: See TracChangeset for help on using the changeset viewer.