Skip to content

Commit

Permalink
simplify 2D slicer option, plotting not needed as 1D data exposed in …
Browse files Browse the repository at this point in the history
…Dataexplorer
  • Loading branch information
dehoni committed Oct 22, 2023
1 parent f9cb5d6 commit c45f273
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/sas/qtgui/Perspectives/Inversion/InversionWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def updateTab(self, data = None, is2D=False):

if is2D:
data.isSliced = False
#self.communicate.plotUpdateSignal.emit([data])
#self.communicate.plotUpdateSignal.emit([data])
self.show2DPlot()
else: #1D data
self.logic.add_errors()
Expand All @@ -483,6 +483,18 @@ def updateTab(self, data = None, is2D=False):
self.calculateAllButton.setVisible(False)
self.showResultsButton.setVisible(False)

def addDataPlot2D(self, plot_set, item):
"""
Create a new 2D plot and add it to the workspace
"""
self.plot2D = Plotter2DWidget(self, quickplot=True)
self.plot2D.data = self.logic.data
self.plot2D.plot()
self.plot2D.item = self.tabMain
self.plot2D.onSectorView()

self.plot2D.show()
self.enableButtons()

######################################################################
# GUI Interaction Events
Expand Down Expand Up @@ -1277,7 +1289,7 @@ def slice(self):
slicedData = self.multiSlicer()
self.isSliced = True

labels = ["title", "phi", "Qbins", "DeltaPhi", "plots"]
labels = ["title", "phi", "Qbins", "DeltaPhi"]
self.sliceList.setColumnCount(len(labels))
self.sliceList.setHorizontalHeaderLabels(labels)
self.sliceList.setEnabled(False)
Expand All @@ -1293,10 +1305,7 @@ def slice(self):
self.sliceList.setItem(row, 0, QtWidgets.QTableWidgetItem(slice.title)) # sets the title
self.sliceList.setItem(row, 1, QtWidgets.QTableWidgetItem(str(slice.phi))) # sets the phi
self.sliceList.setItem(row, 2, QtWidgets.QTableWidgetItem(str(slice.Qbins))) # set Number of points on plot
self.sliceList.setItem(row, 3, QtWidgets.QTableWidgetItem(str(slice.deltaPhi))) # set Delta phi
plotButton = QtWidgets.QPushButton(str(slice.phi))
self.sliceList.setCellWidget(row, 4, plotButton)
plotButton.clicked.connect(partial(self.show1DPlot, slice))
self.sliceList.setItem(row, 3, QtWidgets.QTableWidgetItem(str(slice.deltaPhi))) # set Delta phi
item = GuiUtils.createModelItemWithPlot(update_data=slice, name=str(slice.title))
itemList.append(item)
self.parent.communicate.updateModelFromPerspectiveSignal.emit(item)
Expand Down Expand Up @@ -1351,9 +1360,8 @@ def show1DPlot(self, data):
"""
show a 1D plot of all of the slices
"""
self.plot1D.clean()
self.plot1D.plot(data)
self.plot1D.show()

self.plot1D = self.logic.new1DPlot(data, self.tab_id)
params = self.plot2D.slicer.getParams()
params["Phi [deg]"] = data.phi
self.plot2D.slicer.setParams(params)
Expand Down

0 comments on commit c45f273

Please sign in to comment.