SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
15 stars 27 forks source link

fix stacked disk (qx,qy) test (Trac #963) #295

Open pkienzle opened 5 years ago

pkienzle commented 5 years ago

The tests in stacked disk fail for single precision because J1(qr) is not accurate for large qr. In this test, radius=3000.

Use the following to see the error as a function of q for large radius:

    explore/precision.py cylinder

We are using cephes for our implementation of J1. The implementation in fnlib did not perform any better. Note that precision.py shows single precision J1 in numpy/scipy to be more accurate, but that is probably because it is using double precision internally.

The following paper provides an alternative algorithm:

http://ieeexplore.ieee.org/iel5/5223291/5223292/05223347.pdf

Harrison, J., 2009. Fast and accurate Bessel function computation, in: Computer Arithmetic, 2009. ARITH 2009. 19th IEEE Symposium On. IEEE, pp. 104–113.

Migrated from http://trac.sasview.org/ticket/963

{
    "status": "new",
    "changetime": "2017-10-27T16:02:26",
    "_ts": "2017-10-27 16:02:26.482432+00:00",
    "description": "The tests in stacked disk fail for single precision because J1(qr) is not accurate for large qr.  In this test, radius=3000.\n\nUse the following to see the error as a function of q for large radius:\n{{{\n    explore/precision.py cylinder\n}}}\n\nWe are using cephes for our implementation of J1.  The implementation in fnlib did not perform any better.  Note that precision.py shows single precision J1 in numpy/scipy to be more accurate, but that is probably because it is using double precision internally.\n\nThe following paper provides an alternative algorithm:\n\n    http://ieeexplore.ieee.org/iel5/5223291/5223292/05223347.pdf\n\n\nHarrison, J., 2009. Fast and accurate Bessel function computation, in: Computer Arithmetic, 2009. ARITH 2009. 19th IEEE Symposium On. IEEE, pp. 104\u2013113.\n",
    "reporter": "pkienzle",
    "cc": "",
    "resolution": "",
    "workpackage": "SasView Bug Fixing",
    "time": "2017-05-18T21:37:49",
    "component": "SasView",
    "summary": "fix stacked disk (qx,qy) test",
    "priority": "major",
    "keywords": "",
    "milestone": "SasView 4.3.0",
    "owner": "",
    "type": "defect"
}
butlerpd commented 5 years ago

Trac update at 2017/10/27 16:02:26: butler changed milestone from "SasView 4.2.0" to "SasView 4.3.0"