Skip to content

composite model failure #4074

Closed
Closed

Description

@butlerpd

Describe the bug
Elliot Gilbert from the ACNS reported that an error occurred when trying to run a composite model created by adding a power law plus two Gaussians following the help documentation. @butlerpd reproduced the error. The error occurs when choosing that model from the dropdown. In other words creating the model saves correctly, SasView then recognizes it as a valid plugin to the extent that it shows up in the plugin category dropdown, but as soon as that model is chosen the following error is thrown and no model is actually loaded.

10:45:20 - INFO: --- SasView session started, version 6.1.2, 2025 ---
10:45:20 - INFO: Python: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
10:47:41 - ERROR: Traceback (most recent call last): File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1418, in onSelectModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 1589, in respondToModelStructure File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 2364, in SASModelToQModel File "sas\qtgui\Perspectives\Fitting\FittingWidget.py", line 2412, in fromModelToQModel File "", line 244, in basename File "", line 213, in split TypeError: expected str, bytes or os.PathLike object, not NoneType

The plugin model file @butlerpd used was:

from sasmodels.core import load_model_info
from sasmodels.sasview_model import make_model_from_info

model_info = load_model_info('power_law+gaussian_peak+gaussian_peak')
model_info.name = 'PowerPlusTwoGaussian'
model_info.description = 'power_law + gaussian_peak + gaussian_peak'
Model = make_model_from_info(model_info)

To Reproduce
Steps to reproduce the behavior:

  1. create the above plugin. I used the Add/multiply feature to first create a power law plus Gaussian. I then opened that model in the model editor and added the second Gaussian as described in the help and shown above. Then saved
  2. Now, from within the SasView GUI, use the Plugin Models Category and then choose the model just created
  3. Result, no model is loaded and the error is thrown

Expected behavior
The model should load correctly as any other model

SasView version (please complete the following information):

  • Version: Still present in 6.2.0 but initially detected in 6.1.2

Operating system (please complete the following information):

  • OS: Windows 11 for sure

Installation method (please complete the following information):

  • Installed: from installer on release page

Activity

  1. added theissue type on Aug 3, 2026
  2. krzywon commented on Aug 3, 2026

    @krzywon
    Contributor

    I was able to reproduce this, but then changed the model_info.name parameter to the file name, and was able to load the plugin model. I think #848 is back.

  3. butlerpd commented on Aug 3, 2026

    @butlerpd
    MemberAuthor

    actually, it seems that the name is set to None which is the problem. I suspect that a different name might work but that a None was not envisaged as a possibility when fixing #848? Apparently all mixture models generate a modelinfo.name=None which may be the problem?

  4. butlerpd commented on Aug 3, 2026

    @butlerpd
    MemberAuthor

    and yes @krzywon if I change the name in the file for modelinfo.name= to be the same as the filename it works. I think plugins start by assuming the names are the same and then fallback to a different method only when they are not? In this case the fall back finds a name=None instead of a string?

  5. self-assigned this
    on Aug 6, 2026
  6. rozyczko commented on Aug 6, 2026

    @rozyczko
    Member

    This could also use a fix in sasmodels if not hasattr(model, 'filename') to also handle None in sasview_model.load_custom_model (line 146).

    Theproposed fix for SasView should be sufficient on its own, but fixing that in sasmodels would fix it for scripting users too.

  7. rozyczko commented on Aug 6, 2026

    @rozyczko
    Member
  8. butlerpd commented on Aug 6, 2026

    @butlerpd
    MemberAuthor

    great point @rozyczko! Actually, I'm now wondering if the fix should not in fact be in sasmodels to start with? of course if a NONE gets generated somewhere else, the sasview fix will still catch it.... which leads to the much larger and difficult discussion about how to avoid traceback errors from ever occurring and silently degrading the reliability of the GUI app...

  9. rozyczko commented on Aug 7, 2026

    @rozyczko
    Member

    Thanks, @butlerpd

    if the fix should not in fact be in sasmodels to start with?

    Indeed it should ALSO be in sasmodels.

    SasView/sasmodels#749

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions