Changeset 40a87fa in sasmodels for sasmodels/details.py


Ignore:
Timestamp:
Aug 8, 2016 11:24:11 AM (8 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:
2472141
Parents:
2d65d51
Message:

lint and latex cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/details.py

    rbaa79c2 r40a87fa  
    113113    @pd_prod.setter 
    114114    def pd_prod(self, v): 
     115        """Total size of the pd mesh""" 
    115116        self.buffer[-4] = v 
    116117 
     
    122123    @pd_sum.setter 
    123124    def pd_sum(self, v): 
     125        """Total length of all the weight vectors""" 
    124126        self.buffer[-3] = v 
    125127 
     
    131133    @num_active.setter 
    132134    def num_active(self, v): 
     135        """Number of active polydispersity loops""" 
    133136        self.buffer[-2] = v 
    134137 
     
    140143    @theta_par.setter 
    141144    def theta_par(self, v): 
     145        """Location of the theta parameter in the parameter vector""" 
    142146        self.buffer[-1] = v 
    143147 
     
    185189    pd_length = np.array([len(w) 
    186190                          for w in weights[2:2+model_info.parameters.npars]]) 
    187     num_active = np.sum(pd_length>1) 
     191    num_active = np.sum(pd_length > 1) 
    188192    max_pd = model_info.parameters.max_pd 
    189193    if num_active > max_pd: 
     
    250254    values, weights = zip(*pairs) 
    251255    scalars = [v[0] for v in values] 
    252     if all(len(w)==1 for w in weights): 
     256    if all(len(w) == 1 for w in weights): 
    253257        call_details = mono_details(kernel.info) 
    254258        # Pad value array to a 32 value boundary 
     
    276280    mag = values[parameters.nvalues-3*parameters.nmagnetic:parameters.nvalues] 
    277281    mag = mag.reshape(-1, 3) 
    278     M0 = mag[:,0] 
    279     if np.any(M0): 
    280         theta, phi = mag[:,1]*pi/180., mag[:,2]*pi/180. 
     282    scale = mag[:,0] 
     283    if np.any(scale): 
     284        theta, phi = mag[:, 1]*pi/180., mag[:, 2]*pi/180. 
    281285        cos_theta = cos(theta) 
    282         mx = M0*cos_theta*cos(phi) 
    283         my = M0*sin(theta) 
    284         mz = -M0*cos_theta*sin(phi) 
    285         mag[:,0], mag[:,1], mag[:,2] = mx, my, mz 
     286        mag[:, 0] = scale*cos_theta*cos(phi)  # mx 
     287        mag[:, 1] = scale*sin(theta)  # my 
     288        mag[:, 2] = -scale*cos_theta*sin(phi)  # mz 
    286289        return True 
    287290    else: 
Note: See TracChangeset for help on using the changeset viewer.