Changeset 05df1de in sasmodels


Ignore:
Timestamp:
Apr 4, 2018 6:09:07 PM (5 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
a21d889, c11d09f
Parents:
29afc50
Message:

fix magnetic modelling for spherosymmetric shapes. Fixes #1083.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r3221de0 r05df1de  
    593593            # Check whether we have a list of ndarrays [qx,qy] 
    594594            qx, qy = qdist 
    595             if not self._model_info.parameters.has_2d: 
    596                 return self.calculate_Iq(np.sqrt(qx ** 2 + qy ** 2)) 
    597             else: 
    598                 return self.calculate_Iq(qx, qy) 
     595            return self.calculate_Iq(qx, qy) 
    599596 
    600597        elif isinstance(qdist, np.ndarray): 
     
    677674        call_details, values, is_magnetic = make_kernel_args(calculator, pairs) 
    678675        #call_details.show() 
    679         #print("pairs", pairs) 
     676        #print("================ parameters ==================") 
     677        #for p, v in zip(parameters.call_parameters, pairs): print(p.name, v[0]) 
    680678        #for k, p in enumerate(self._model_info.parameters.call_parameters): 
    681679        #    print(k, p.name, *pairs[k]) 
     
    871869    CylinderModel().evalDistribution([0.1, 0.1]) 
    872870 
     871def magnetic_demo(): 
     872    Model = _make_standard_model('sphere') 
     873    model = Model() 
     874    model.setParam('M0:sld', 8) 
     875    q = np.linspace(-0.35, 0.35, 500) 
     876    qx, qy = np.meshgrid(q, q) 
     877    result = model.calculate_Iq(qx.flatten(), qy.flatten()) 
     878    result = result.reshape(qx.shape) 
     879 
     880    import pylab 
     881    pylab.imshow(np.log(result + 0.001)) 
     882    pylab.show() 
     883 
    873884if __name__ == "__main__": 
    874885    print("cylinder(0.1,0.1)=%g"%test_cylinder()) 
     886    #magnetic_demo() 
    875887    #test_product() 
    876888    #test_structure_factor() 
Note: See TracChangeset for help on using the changeset viewer.