SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
15 stars 27 forks source link

Implement SasviewModel.get_weights #516

Open lucas-wilkins opened 2 years ago

lucas-wilkins commented 2 years ago

SasView's FittingWidget class currently has the following code that needs to go, this is basically a reminder that get_weights needs an implementation - which as far as I can tell could just be the code below


# CRUFT: remove when new release of sasmodels is available
# https://github.com/SasView/sasview/pull/181#discussion_r218135162
from sasmodels.sasview_model import SasviewModel
if not hasattr(SasviewModel, 'get_weights'):
    def get_weights(self, name):
        """
        Returns the polydispersity distribution for parameter *name* as *value* and *weight* arrays.
        """
        # type: (str) -> Tuple(np.ndarray, np.ndarray)
        _, x, w = self._get_weights(self._model_info.parameters[name])
        return x, w

    SasviewModel.get_weights = get_weights
pkienzle commented 1 year ago

SasviewModel needs to go away (see https://github.com/SasView/sasview/discussions/2256). We may want to settle on a better sasmodels interface before we start tweaking the current implementation.