Changeset d3ffeb7 in sasmodels


Ignore:
Timestamp:
Aug 20, 2018 11:16:06 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
d32de68
Parents:
bad3093
Message:

beta_mode takes choices from units; lazy results implementation

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/product.py

    r6d90684 rd3ffeb7  
    3737ER_ID = "radius_effective" 
    3838VF_ID = "volfraction" 
    39 BETA_DEFINITION = ("beta_mode", "", 0, [["P*S"],["P*(1+beta*(S-1))"]], "", 
     39BETA_DEFINITION = ("beta_mode", ["P*S", "P*(1+beta*(S-1))"], 0, (None, None), "", 
    4040                   "Structure factor dispersion calculation mode") 
    4141 
     
    294294            #    } 
    295295            #lazy_pars = s_result, F1, F2, combined_scale 
    296             self.results = [F2*volfrac/volume_avg, s_result] 
     296 
     297            # self.results = [F2*volfrac/volume_avg, s_result] 
    297298            final_result = combined_scale*(F2 + (F1**2)*(s_result - 1)) + background 
     299 
     300            # TODO: 1. include calculated Q vector 
     301            # TODO: 2. consider implications if there are intermediate results in P(Q) 
     302            # def lazy(F1, F2, S, scale, bg): 
     303            def lazy(F1, F2, S, scale): 
     304                return { 
     305                    "P(Q)": lambda: scale*F2, 
     306                    "S(Q)": lambda: S, 
     307                    "beta(Q)": lambda: F1**2 / F2, 
     308                    "S_eff(Q)": lambda: 1 + (F1**2 / F2)*(S-1), 
     309                    # "I(Q)":  lambda: scale*(F2 + (F1**2)*(S-1)) + bg, 
     310                } 
     311 
     312            self.results = lazy(F1, F2, s_result, volfrac/volume_avg) 
     313 
    298314        else: 
    299315            p_result = self.p_kernel.Iq(p_details, p_values, cutoff, magnetic) 
    300316            # remember the parts for plotting later 
    301             self.results = [p_result, s_result] 
     317            # self.results = [p_result, s_result] 
    302318            final_result = scale*(p_result*s_result) + background 
     319 
     320            def lazy(P, S): 
     321                return { 
     322                    "P(Q)": lambda: P, 
     323                    "S(Q)": lambda: S, 
     324                } 
     325 
     326            self.results = lazy(p_result, s_result) 
    303327 
    304328        #call_details.show(values) 
  • sasmodels/sasview_model.py

    rd533590 rd3ffeb7  
    381381                continue 
    382382            self.params[p.name] = p.default 
    383             self.details[p.id] = [p.units, p.limits[0], p.limits[1]] 
     383            self.details[p.id] = [p.units if not p.choices else p.choices, p.limits[0], p.limits[1]] 
    384384            if p.polydisperse: 
    385385                self.details[p.id+".width"] = [ 
Note: See TracChangeset for help on using the changeset viewer.