SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
48 stars 41 forks source link

default value and limits are ignored for muliplicity/variant models (Trac #879) #965

Open pkienzle opened 5 years ago

pkienzle commented 5 years ago

The model default value for multiplicity is ignored when selecting the model. To see this, select the RPA model, change the case num to 3, switch to the unified power Rg and it will have 3 levels. Set case num to 0 and switch to spherical_sld and you will have n_shells=0 even though n_shells has limits of [1, 10]. The upper limit is respected.

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

{
    "status": "new",
    "changetime": "2017-10-26T12:53:39",
    "_ts": "2017-10-26 12:53:39.698146+00:00",
    "description": "The model default value for multiplicity is ignored when selecting the model.  To see this, select the RPA model, change the case num to 3, switch to the unified power Rg and it will have 3 levels.  Set case num to 0 and switch to spherical_sld and you will have n_shells=0 even though n_shells has limits of [1, 10].  The upper limit is respected.",
    "reporter": "pkienzle",
    "cc": "",
    "resolution": "",
    "workpackage": "SasView Bug Fixing",
    "time": "2017-03-09T15:54:51",
    "component": "SasView",
    "summary": "default value and limits are ignored for muliplicity/variant models",
    "priority": "minor",
    "keywords": "",
    "milestone": "SasView 5.0.0",
    "owner": "",
    "type": "defect"
}
pkienzle commented 5 years ago

Trac update at 2017/03/09 16:22:37: pkienzle commented:

Line 3624 of basepage.py sets the initial multiplicity to 1 rather than 0.

Line 2003-2031 of basepage.py uses the current value of multiplicity for the new model.

Line 1765-1766 of basepage.py populate the multifactor box with numbers from 0 to multiplicity-1.

A possible fix is to extend sasmodels.sasview_model so that MultiplicityInfo (line 74) includes default and the lower limit (the upper limit is already there as attribute "number"). These will need to be initialized from p.default and p.limit[0] (line 215). The default value should be used in basepage.py line 2003-2013 to set the initial value.

Dealing with the lower limit is more complicated. The current code assumes that the list is numbered from 0, and that selection number in the combobox matches the integer.

butlerpd commented 5 years ago

Trac update at 2017/10/26 12:53:39: butler changed milestone from "SasView 4.2.0" to "SasView 5.0.0"

rozyczko commented 5 years ago

I think we resolved this in 5.0 after some investigative QA by Richard. The default multip value is taken directly from the model (p.default) and the range also is read from p.limit[0] as indicated.

rozyczko commented 5 years ago

Leaving it open in case this needs reimplementation in 4.x

rozyczko commented 4 years ago

Also, changing the milestone so the above can be discussed.