-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
sasmodels uses romberg from scipy.integrate in explore/asymint.py, explore/symint.py, sasmodels/resolution.py, also example/weights/maier_saupe.py.
But romberg is deprecated, and dropped from scipy 1.15, see https://docs.scipy.org/doc/scipy-1.14.1/reference/generated/scipy.integrate.romberg.html
Hence sasmodels fails tests, with errors
90s =================================== FAILURES ===================================
90s ______________________ IgorComparisonTest.test_ellipsoid _______________________
90s
90s self = <sasmodels.resolution.IgorComparisonTest testMethod=test_ellipsoid>
90s
90s def test_ellipsoid(self):
90s """
90s Compare romberg integration for ellipsoid model.
90s """
90s from .core import load_model
90s pars = {
90s 'scale':0.05,
90s 'radius_polar':500, 'radius_equatorial':15000,
90s 'sld':6, 'sld_solvent': 1,
90s }
90s form = load_model('ellipsoid', dtype='double')
90s q = np.logspace(log10(4e-5), log10(2.5e-2), 68)
90s width, length = 0.,0.117
90s resolution = Slit1D(q, q_length=length, q_width=width)
90s > answer = romberg_slit_1d(q, length, width, form, pars)
90s
90s /usr/lib/python3/dist-packages/sasmodels/resolution.py:892:
90s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
90s
90s q = array([4.00000000e-05, 4.40341425e-05, 4.84751427e-05, 5.33640336e-05,
90s 5.87459865e-05, 6.46707286e-05, 7.119300...1.40463244e-02, 1.54629462e-02, 1.70224395e-02,
90s 1.87392132e-02, 2.06291296e-02, 2.27096508e-02, 2.50000000e-02])
90s width = 0.117, length = 0.0
90s form = <sasmodels.kerneldll.DllModel object at 0x7fa0c949c260>
90s pars = {'radius_equatorial': 15000, 'radius_polar': 500, 'scale': 0.05, 'sld': 6, ...}
90s
90s def romberg_slit_1d(q, width, length, form, pars):
90s """
90s Romberg integration for slit resolution.
90s
90s This is an adaptive integration technique. It is called with settings
90s that make it slow to evaluate but give it good accuracy.
90s """
90s > from scipy.integrate import romberg # type: ignore
90s E ImportError: cannot import name 'romberg' from 'scipy.integrate' (/usr/lib/python3/dist-packages/scipy/integrate/__init__.py)
90s
90s /usr/lib/python3/dist-packages/sasmodels/resolution.py:571: ImportError
90s _____________________ IgorComparisonTest.test_slit_romberg _____________________
90s
90s self = <sasmodels.resolution.IgorComparisonTest testMethod=test_slit_romberg>
90s
90s def test_slit_romberg(self):
90s """
90s Compare slit resolution smearing with romberg integration result.
90s """
90s pars = TEST_PARS_SLIT_SPHERE
90s data_string = TEST_DATA_SLIT_SPHERE
90s
90s data = np.loadtxt(data_string.split('\n')).T
90s q, delta_qv, _, answer = data
90s > answer = romberg_slit_1d(q, delta_qv, 0., self.model, pars)
90s
90s /usr/lib/python3/dist-packages/sasmodels/resolution.py:870:
90s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
90s
90s q = array([2.26097e-05, 2.53847e-05, 2.81597e-05, 3.09347e-05, 3.37097e-05,
90s 3.92597e-05, 4.48097e-05, 5.03597e-05, ...
90s 1.88741e-03, 1.99841e-03, 2.10941e-03, 2.22041e-03, 2.33141e-03,
90s 2.44241e-03, 2.55341e-03, 2.66441e-03])
90s width = array([0.117, 0.117, 0.117, 0.117, 0.117, 0.117, 0.117, 0.117, 0.117,
90s 0.117, 0.117, 0.117, 0.117, 0.117, 0.117,...0.117,
90s 0.117, 0.117, 0.117, 0.117, 0.117, 0.117, 0.117, 0.117, 0.117,
90s 0.117, 0.117, 0.117, 0.117, 0.117])
90s length = 0.0, form = <sasmodels.kerneldll.DllModel object at 0x7fa0c9657500>
90s pars = {'background': 0.01, 'radius': 60000, 'scale': 0.01, 'sld': 1, ...}
90s
90s def romberg_slit_1d(q, width, length, form, pars):
90s """
90s Romberg integration for slit resolution.
90s
90s This is an adaptive integration technique. It is called with settings
90s that make it slow to evaluate but give it good accuracy.
90s """
90s > from scipy.integrate import romberg # type: ignore
90s E ImportError: cannot import name 'romberg' from 'scipy.integrate' (/usr/lib/python3/dist-packages/scipy/integrate/__init__.py)
90s
90s /usr/lib/python3/dist-packages/sasmodels/resolution.py:571: ImportError
90s =========================== short test summary info ============================
90s FAILED resolution.py::IgorComparisonTest::test_ellipsoid - ImportError: canno...
90s FAILED resolution.py::IgorComparisonTest::test_slit_romberg - ImportError: ca...
90s ============ 2 failed, 101 passed, 8 skipped, 2 warnings in 22.54s =============
So romberg should be replaced with quad, which probably means the divmax=100 option used by sasmodels will need to be dropped.
Metadata
Metadata
Assignees
Labels
No labels