Skip to content

Commit

Permalink
Remove NaNs from any resulting fit, regardless of the source to ensur…
Browse files Browse the repository at this point in the history
…e resulting data is plottable
  • Loading branch information
krzywon committed Oct 9, 2024
1 parent 9e3cd58 commit ebada3b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def get_weights(self: Any, name: str) -> Tuple[np.ndarray, np.ndarray]:

logger = logging.getLogger(__name__)


class ToolTippedItemModel(QtGui.QStandardItemModel):
"""
Subclass from QStandardItemModel to allow displaying tooltips in
Expand Down Expand Up @@ -3116,6 +3117,12 @@ def createTheoryIndex(self, fitted_data):
Create a QStandardModelIndex containing model data
"""
name = self.nameFromData(fitted_data)
# TODO: Temporary Hack to fix NaNs in generated theory data
# This is usually from GSC models that are calculated outside the Q range they were created for
# The 'remove_nans_in_data' should become its own function in a data utility class, post-6.0.0 release.
from sasdata.dataloader.filereader import FileReader
temp_reader = FileReader()
fitted_data = temp_reader._remove_nans_in_data(fitted_data)
# Modify the item or add it if new
theory_item = GuiUtils.createModelItemWithPlot(fitted_data, name=name)
self.communicate.updateTheoryFromPerspectiveSignal.emit(theory_item)
Expand Down

0 comments on commit ebada3b

Please sign in to comment.