Opened 13 days ago

Last modified 5 days ago

#1173 assigned defect

more problems with math in plugins

Reported by: butler Owned by: pkienzle
Priority: critical Milestone: SasView 4.2.0
Component: SasView Keywords:
Cc: Work Package: McSAS Integration Project

Description

while testing a pull request downloaded from the jenkins build thereof, the old

unsupported operand type(s) for *:'NoneType' and 'float'

reared its head again. Other plugins had no problems. Further investigation shows that the exact same function generated from a 4.2 "create model" works while the failing function was created in 4.1.2? However, after editing so that code wise they look identical to me the "older" version continues to fail on the math while the new one does not. I attach the two files.

Is this due to sasmodels infrastructure running these two identical codes differently with one path being wrong? i.e. having a bug not present in the way the files identified as new don't?

Our release notes say we support old style models am listing this as critical to 4.2 release. At the very least we need to correct the release notes if we cannot resolve this issue.

Attachments (3)

L3_Porcar_et_al.py (1.0 KB) - added by butler 13 days ago.
failing older version edited to be "identical" to new version
L3_Porcar_et_alNEW.py (1.5 KB) - added by butler 13 days ago.
New version which runs without problem
Porcar_Pq_Sq.py (237 bytes) - added by butler 6 days ago.
offending multiply model

Download all attachments as: .zip

Change History (10)

Changed 13 days ago by butler

failing older version edited to be "identical" to new version

Changed 13 days ago by butler

New version which runs without problem

comment:1 Changed 13 days ago by butler

  • Owner set to pkienzle
  • Status changed from new to assigned

comment:2 Changed 11 days ago by pkienzle

See #1142.

comment:3 Changed 11 days ago by pkienzle

It seems to work with master for sasview and sasmodels (2016-09-11) on mac started with run.py.

Please give the steps required to reproduce.

comment:4 Changed 10 days ago by butler

Interesting …. by "works with master" I assume you mean on your local development environment? If so this may indicate the problem is with the build machine. I should test with the latest development build (rather than the PR build).

Changed 6 days ago by butler

offending multiply model

comment:5 Changed 6 days ago by butler

Hummm…. so it seems the problem was more subtle and involves the presence of a multiply model multiplying the "offending" model by a plugin SQ. Removing the pyc for that multiply model does not help. So why does the mere existence of another plugin affect in any way whether the first plugin can pull in the math? I attach the multiply model.

comment:6 Changed 5 days ago by pkienzle

Because the model is written with load_model_info(), this does a reload on the parts, L3_Porcar_et_al and L3_Sq, and it is the reload which is causing problems with the namespace for the module.

This could be resolved by throwing a cache in sasmodels.custom which checks the timestamp on the file before reloading the module. This should be a relatively small fix suitable for 4.2, and at least allow L3_Porcar_Sq_Pq to load.

There will still be problems: if Pq or Sq are edited and reloaded, then Porcar_Pq_Sq will be break. This one is harder to resolve since the timestamp on Porcar_Pq_Sq will not have changed, and so Sasview will not know that it needs to be reloaded. I'm guessing for a proper fix for this we will have to maintain a tree of dependencies, and force a reload of all those that are affected by the change of a timestamp. This is a 4.3 fix.

comment:7 Changed 5 days ago by butler

So if I understand what is happening now, there is the same reload problem causing math to be cleared out as before but in a more subtle way? If true that would mean that:

I create plugin model A and it works
I create plugin model B and it works
etc
and all is happy

NOW if I do a sum/multiply model that uses A, for example
NewModel1 = A * hard_sphere or even
NewModel2 = A + B

all of a sudden Models A and B no longer work?!

I will try to test this. If true it needs fixing in 4.2 if at all possible. Maybe the "relatively small fix suitable for 4.2" would do the trick?

Note: See TracTickets for help on using tickets.