Opened 4 years ago

Closed 3 years ago

#1202 closed defect (fixed)

beta approx branch doesn't support ER/VR tests

Reported by: pkienzle Owned by: GitHub <noreply@…>
Priority: major Milestone: sasmodels 1.0
Component: sasmodels Keywords:
Cc: Work Package: Beta Approximation Project


sasmodels 1.0 beta

Since we have restructured effective radius and form:shell volume ratio, the ER and VR tests no longer work.

Instead of using calculator() in direct_model.call_kernel, can use calculator.Fq() to return (F, Fsq, effective_radius, shell_volume, volume_ratio).

Because calculator.Fq() needs a q value, we can modify the test syntax from

tests = [
    ({}, 'ER', Reff),
    ({}, 'VR', form_to_shell),


tests = [
    ({'radius_effective_type': 1}, 0.1, None, Reff, form_to_shell),

That is, if the test uses 5 columns rather than three, then the last two columns will be ER and VR.

Is this too obscure? Do we also want to test F and Fsq outputs?

Maybe specify outputs as a dict, with missing entries not tested:

    ({radius_effective_type: 1}, 0.1, 
     {'F': F, 'Fsq': F*F, 'Reff': Reff, 'Vr': form_to_shell})


A further issue is that there are now multiple effective radius types in some models.

It is probably good enough to treat each one as an independent test in the file.

For example, for cylinder, using the list form for specifying test results:

# Default radius and length
radius, length = parameters[2][2], parameters[3][2]
tests = [
    ({'radius_effective_type': 1}, 0.1, None, (0.75*radius**2*length)**(1./3.), None),
    ({'radius_effective_type': 2}, 0.1, None, radius, None),
    ({'radius_effective_type': 3}, 0.1, None, length/2., None),
    ({'radius_effective_type': 4}, 0.1, None, min(radius, length/2.), None),
    ({'radius_effective_type': 5}, 0.1, None, max(radius, length/2.), None),
    ({'radius_effective_type': 6}, 0.1, None, sqrt(4*radius**2 + length**2)/2., None),

Change History (4)

comment:1 Changed 4 years ago by pkienzle

The F and Fsq values returned from Fq are not scaled or normalized by volume and do not include background.

We should therefore use a six column format instead of five:

tests = [
    ({'radius_effective_type': 1}, 0.1, F, Fsq, Reff, form_to_shell_ratio),

This allows us to test the computed F value and simplifies the test code a tiny bit. Otherwise, it would have to compute I(q) = Fsq*scale/volume + background.

comment:2 Changed 4 years ago by Paul Kienzle <pkienzle@…>

In 304c775207a9dbbadb23ad414848454d66b556d1/sasmodels:

provide method for testing Fq results. Refs #1202.

comment:3 Changed 4 years ago by Paul Kienzle <pkienzle@…>

In 39a06c989ba87dcedc6e5270d59fc4c9dd47ffe5/sasmodels:

Remove references to ER and VR from sasmodels. Refs #1202.

comment:4 Changed 3 years ago by GitHub <noreply@…>

  • Owner set to GitHub <noreply@…>
  • Resolution set to fixed
  • Status changed from new to closed

In 29c455af8add2421edd313d03218d6a1ba3b7873/sasmodels:

Merge pull request #90 from SasView?/beta_approx

Beta approx

closes #1201
closes #1202
closes #822
closes #1076

Note: See TracTickets for help on using tickets.