1919import numpy
2020import pytest
2121
22+ # Use the updated SasView model API to load models
23+ from sasmodels .sasview_model import _make_standard_model
24+
2225import diffpy .srfit .pdf .characteristicfunctions as cf
23- from diffpy .srfit .sas .sasimport import sasimport
2426
2527# # Global variables to be assigned in setUp
2628# cf = None
@@ -34,7 +36,7 @@ def testSphere(sas_available):
3436 pytest .skip ("sas package not available" )
3537 radius = 25
3638 # Calculate sphere cf from SphereModel
37- SphereModel = sasimport ( "sas.models.SphereModel" ). SphereModel
39+ SphereModel = _make_standard_model ( "sphere" )
3840 model = SphereModel ()
3941 model .setParam ("radius" , radius )
4042 ff = cf .SASCF ("sphere" , model )
@@ -56,10 +58,10 @@ def testSpheroid(sas_available):
5658 prad = 20.9
5759 erad = 33.114
5860 # Calculate cf from EllipsoidModel
59- EllipsoidModel = sasimport ( "sas.models.EllipsoidModel" ). EllipsoidModel
61+ EllipsoidModel = _make_standard_model ( "ellipsoid" )
6062 model = EllipsoidModel ()
61- model .setParam ("radius_a " , prad )
62- model .setParam ("radius_b " , erad )
63+ model .setParam ("radius_polar " , prad )
64+ model .setParam ("radius_equatorial " , erad )
6365 ff = cf .SASCF ("spheroid" , model )
6466 r = numpy .arange (0 , 100 , 1 / numpy .pi , dtype = float )
6567 fr1 = ff (r )
@@ -79,7 +81,7 @@ def testShell(sas_available):
7981 radius = 19.2
8082 thickness = 7.8
8183 # Calculate cf from VesicleModel
82- VesicleModel = sasimport ( "sas.models.VesicleModel" ). VesicleModel
84+ VesicleModel = _make_standard_model ( "vesicle" )
8385 model = VesicleModel ()
8486 model .setParam ("radius" , radius )
8587 model .setParam ("thickness" , thickness )
@@ -103,7 +105,7 @@ def testCylinder(sas_available):
103105 radius = 100
104106 length = 30
105107
106- CylinderModel = sasimport ( "sas.models.CylinderModel" ). CylinderModel
108+ CylinderModel = _make_standard_model ( "cylinder" )
107109 model = CylinderModel ()
108110 model .setParam ("radius" , radius )
109111 model .setParam ("length" , length )
0 commit comments