Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pkienzle opened this issue Mar 30, 2019 · 4 comments
Closed

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

pkienzle opened this issue Mar 30, 2019 · 4 comments

Comments

@pkienzle
Copy link
Contributor

pkienzle commented Mar 30, 2019

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"
}
@pkienzle
Copy link
Contributor Author

Trac update at 2018/10/22 20:52:04: pkienzle commented:

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.

@sasview-bot
Copy link

Trac update at 2018/10/25 21:35:23: Paul Kienzle [email protected] commented:

In changeset 304c775:

#!CommitTicketReference repository="sasmodels" revision="304c775207a9dbbadb23ad414848454d66b556d1"
provide method for testing Fq results. Refs #192.

@sasview-bot
Copy link

Trac update at 2018/10/25 22:16:21: Paul Kienzle [email protected] commented:

In changeset 39a06c9:

#!CommitTicketReference repository="sasmodels" revision="39a06c989ba87dcedc6e5270d59fc4c9dd47ffe5"
Remove references to ER and VR from sasmodels. Refs #192.

@sasview-bot
Copy link

Trac update at 2019/03/19 14:49:37:

In changeset 29c455a:

#!CommitTicketReference repository="sasmodels" revision="29c455af8add2421edd313d03218d6a1ba3b7873"
Merge pull request SasView/sasview#318 from SasView/beta_approx

Beta approx

closes #191
closes #192
closes #137
closes SasView/sasview#1130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants