Skip to content

Don't calculate magnetic models in magnetism is not toggled. - #4072

Open
pkienzle wants to merge 1 commit into
mainfrom
4071-magnetism-toggle
Open

Don't calculate magnetic models in magnetism is not toggled.#4072
pkienzle wants to merge 1 commit into
mainfrom
4071-magnetism-toggle

Conversation

@pkienzle

Copy link
Copy Markdown
Contributor

Description

Leaves the M0 values as their default (zero) when initializing the model.

Sets the magnetic parameters in the model to zero if magnetism is not active. This causes sasmodels to use Iqxy rather than Imagnetic to compute the 2D models.

This incidentally fixes the problem with a mixed magnetic and pure python model, which otherwise failed in sasmodels because the pure python model don't yet handle magnetism.

Fixes #4071

How Has This Been Tested?

Start sasview with a sphere model, toggle 2D and plot. Verify that there is no asymmetry.

Toggle magnetism and check that M0 are all zero.

Set sld_M0 to 10, set sld_mtheta to 90 and plot. Shows asymmetry.

Toggle magnetism and plot. Shows no asymmetry.

Toggle magnetism and plot. Shows asymmetry again from values stored in the magnetism widget.

Load 2d magnetic data set and send to fitting.

Toggle radius and scale fit.

Toggle magnetism, and toggle sld_M0 and sld_mphi fit.

Start the fit. Verify that radius, scale, sld_M0 and sld_mphi are being updated.

Stop the fit, toggle magnetism and plot. No asymmetry.

Save analysis as non magnetic.

Toggle magnetism and save analysis as magnetic.

Restart sasview and load nonmagnetic analysis. Plot shows no asymmetry.

Toggle magnetism and plot. Shows asymmetry.

Restart sasview and load magnetic analysis. Plot shows asymmetry.

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)

@krzywon krzywon left a comment

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.

Tested and fixes the issue. Code seems okay

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.

Magnetism is always calculated for 2D data, even if magnetism is off

2 participants