Skip to content

Don't include magnetism parameters in pure python models#3961

Merged
jellybean2004 merged 2 commits into
mainfrom
sasmodels-732-magnetism-error
Jun 1, 2026
Merged

Don't include magnetism parameters in pure python models#3961
jellybean2004 merged 2 commits into
mainfrom
sasmodels-732-magnetism-error

Conversation

@pkienzle
Copy link
Copy Markdown
Contributor

Description

Use the model info interpreter from sasmodels.modelinfo rather than calling the internal modelinfo.make_parameter_table directly.

Fixes sasmodels #732

How Has This Been Tested?

The new tetrahedron pure python model loads without magnetism support, and the exist cylinder model loads with magnetism support.

Review Checklist:

[if using the editor, use [x] in place of [ ] to check a box]

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)
    • Wheels installer (GH artifact) has been tested (installed and worked)

Licensing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

@pkienzle pkienzle requested a review from sara-mokhtari May 22, 2026 14:44
@krzywon krzywon requested review from butlerpd and krzywon May 29, 2026 13:22
Copy link
Copy Markdown
Contributor

@krzywon krzywon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one GUI test that is failing locally for me. I'm surprised it succeeded here. This was noted in #3970, where the test is also failing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally, I am seeing a failing unit test. A pure python model is used to test the magnetic parameters, so this unit test should be updated.

src\sas\qtgui\Perspectives\Fitting\UnitTesting\FittingWidgetTest.py:666: AssertionError
assert widget.magnetism_widget._magnet_model.rowCount() == 10
E assert 0 == 10

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing because the absorbed layer model does not support magnetism.

I changed it to use the core-shell sphere model which does support magnetism.

The tests now pass locally (after modifying pyproject.toml to exclude src/sas/webfit).

@pkienzle pkienzle mentioned this pull request May 29, 2026
8 tasks
Copy link
Copy Markdown
Contributor

@krzywon krzywon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests are now passing.

@jellybean2004
Copy link
Copy Markdown
Member

Since we have a functionality and code review, I am merging this to create the new alpha.

@jellybean2004 jellybean2004 merged commit 63aa7b2 into main Jun 1, 2026
36 checks passed
@jellybean2004 jellybean2004 deleted the sasmodels-732-magnetism-error branch June 1, 2026 14:36
jellybean2004 pushed a commit that referenced this pull request Jun 1, 2026
* don't include magnetism parameters in pure python models

* update magnetism test to use a model that supports magnetism

---------

Co-authored-by: Paul Kienzle <pkienzle@nist.gov>
@jellybean2004
Copy link
Copy Markdown
Member

I was just testing the test installer for the third alpha.

I found that selecting octahedron_truncated is giving an error, while the others are working okay
18:43:46 - ERROR: Traceback (most recent call last): File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1195, in onSelectModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1368, in respondToModelStructure File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1985, in SASModelToQModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 2032, in fromModelToQModel KeyError: 'octahedron_truncated'

@krzywon
Copy link
Copy Markdown
Contributor

krzywon commented Jun 1, 2026

I was just testing the test installer for the third alpha.

I found that selecting octahedron_truncated is giving an error, while the others are working okay 18:43:46 - ERROR: Traceback (most recent call last): File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1195, in onSelectModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1368, in respondToModelStructure File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1985, in SASModelToQModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 2032, in fromModelToQModel KeyError: 'octahedron_truncated'

octahedron_truncated was renamed to truncated_octahedron but is still probably listed in your 'categories.json` file. Delete it and the file will be repopulated. Depending on your OS, it should be in:

  • Windows: C:\Users<user>\AppData\Local\sasview\SasView
  • macOS: /Users//Library/Application Support/SasView
  • Linux: /home//.local/share/SasView

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 new pure python models not working on installer

4 participants