Skip to content

beta approx branch doesn't support ER/VR tests (Trac #1202) #192

@pkienzle

Description

@pkienzle

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),
    ...
]

to

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),
]

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

{
    "status": "closed",
    "changetime": "2019-03-19T14:49:37",
    "_ts": "2019-03-19 14:49:37.985291+00:00",
    "description": "sasmodels 1.0 beta\n\nSince we have restructured effective radius and form:shell volume ratio, the ER and VR tests no longer work.\n\n\nInstead of using `calculator()` in `direct_model.call_kernel`, can use `calculator.Fq()` to return `(F, Fsq, effective_radius, shell_volume, volume_ratio)`.\n\nBecause `calculator.Fq()` needs a q value, we can modify the test syntax from\n{{{\ntests = [\n    ...\n    ({}, 'ER', Reff),\n    ({}, 'VR', form_to_shell),\n    ...\n]\n}}}\nto\n{{{\ntests = [\n    ...\n    ({'radius_effective_type': 1}, 0.1, None, Reff, form_to_shell),\n    ...\n}}}\nThat is, if the test uses 5 columns rather than three, then the last two columns will be ER and VR.\n\nIs this too obscure?  Do we also want to test F and Fsq outputs?\n\nMaybe specify outputs as a dict, with missing entries not tested:\n{{{\n    ({radius_effective_type: 1}, 0.1, \n     {'F': F, 'Fsq': F*F, 'Reff': Reff, 'Vr': form_to_shell})\n}}}\n\n---\n\nA further issue is that there are now multiple effective radius types in some models.\n\nIt is probably good enough to treat each one as an independent test in the file.\n\nFor example, for cylinder, using the list form for specifying test results:\n{{{\n# Default radius and length\nradius, length = parameters[2][2], parameters[3][2]\ntests = [\n    ...\n    ({'radius_effective_type': 1}, 0.1, None, (0.75*radius**2*length)**(1./3.), None),\n    ({'radius_effective_type': 2}, 0.1, None, radius, None),\n    ({'radius_effective_type': 3}, 0.1, None, length/2., None),\n    ({'radius_effective_type': 4}, 0.1, None, min(radius, length/2.), None),\n    ({'radius_effective_type': 5}, 0.1, None, max(radius, length/2.), None),\n    ({'radius_effective_type': 6}, 0.1, None, sqrt(4*radius**2 + length**2)/2., None),\n]\n\n}}}\n",
    "reporter": "pkienzle",
    "cc": "",
    "resolution": "fixed",
    "workpackage": "Beta Approximation Project",
    "time": "2018-10-22T20:29:45",
    "component": "sasmodels",
    "summary": "beta approx branch doesn't support ER/VR tests",
    "priority": "major",
    "keywords": "",
    "milestone": "sasmodels 1.0",
    "owner": "GitHub <[email protected]>",
    "type": "defect"
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions