Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Speedup 2D COS widget #773

Merged
merged 8 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions orangecontrib/spectroscopy/widgets/owcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from orangewidget.utils.visual_settings_dlg import VisualSettingsDialog
from orangecontrib.spectroscopy.data import getx
from orangecontrib.spectroscopy.widgets.owhyper import ImageColorLegend
from orangecontrib.spectroscopy.widgets.owspectra import InteractiveViewBox
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this unneeded import (found it in the lint)

from orangecontrib.spectroscopy.widgets.owspectra import InteractiveViewBox, PlotCurvesItem
from orangecontrib.spectroscopy.widgets.gui import float_to_str_decimals as strdec, pixel_decimals


Expand Down Expand Up @@ -168,7 +168,7 @@ class Outputs:

settingsHandler = settings.DomainContextHandler()
selector = settings.Setting(0)
isonum = settings.Setting(0)
isonum = settings.Setting(5)
visual_settings = settings.Setting({}, schema_only=True)

# autocommit = settings.Setting(True)
Expand Down Expand Up @@ -417,18 +417,26 @@ def plotCOS(self):
self.cbarCOS.set_range(-1 * np.nanmax(np.absolute(cosmat)), np.nanmax(np.absolute(cosmat)))
self.cbarCOS.set_colors(np.array(colorcet.diverging_bwr_40_95_c42) * 255)

for s in leftSP:
self.left_plot.plot(s, leftSPwn, pen=pg.mkPen(color=(50, 50, 50), width=0.5))
left_indices = np.linspace(0, len(leftSP)-1, 100, dtype=int)
for s in leftSP[left_indices]:
pt = pg.PlotCurveItem(s, leftSPwn, pen=pg.mkPen(color=(50, 50, 50), width=0.5))
self.left_plot.addItem(pt, ignoreBounds=True)

self.left_plot.plot(leftSP.mean(axis=0), leftSPwn, pen=p)
self.left_plot.addItem(self.left_hLine)

for s in topSP:
self.top_plot.plot(topSPwn, s, pen=pg.mkPen(color=(50, 50, 50), width=0.5))
self.left_plot.setXRange(np.min(leftSP), np.max(leftSP))

top_indices = np.linspace(0, len(topSP)-1, 100, dtype=int)
borondics marked this conversation as resolved.
Show resolved Hide resolved
for s in topSP[top_indices]:
pt = pg.PlotCurveItem(topSPwn, s, pen=pg.mkPen(color=(50, 50, 50), width=0.5))
self.top_plot.addItem(pt, ignoreBounds=True)

self.top_plot.plot(topSPwn, topSP.mean(axis=0), pen=p)
self.top_plot.addItem(self.top_vLine)

self.top_plot.setYRange(np.min(topSP), np.max(topSP))

def hideitems_for_saving(self):
self.hLine.hide()
self.vLine.hide()
Expand Down
Loading