Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Oct 18, 2023
1 parent 48cb6db commit 5746900
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 31 deletions.
9 changes: 0 additions & 9 deletions orangecontrib/spectroscopy/tests/test_owcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
import numpy as np

import Orange
from Orange.data import dataset_dirs
from Orange.data.io import FileFormat
from Orange.widgets.tests.base import WidgetTest
from orangecontrib.spectroscopy.data import getx
from orangecontrib.spectroscopy.io.neaspec import NeaReaderGSF
from orangecontrib.spectroscopy.widgets.owcos import OWCos, calc_cos, sort_data


Expand All @@ -21,13 +18,7 @@ class TestOWCOS(WidgetTest):

def setUp(self):
self.widget = self.create_widget(OWCos)
# self.ifg_single = Orange.data.Table("IFG_single.dpt")
# self.ifg_seq = Orange.data.Table("agilent/4_noimage_agg256.seq")
# fn = 'NeaReaderGSF_test/NeaReaderGSF_test O2A raw.gsf'
# absolute_filename = FileFormat.locate(fn, dataset_dirs)
# self.ifg_gsf = NeaReaderGSF(absolute_filename).read()

#
def test_calc_cos(self):
cos = calc_cos(self.DATA1, self.DATA2)
numpy.testing.assert_array_equal(cos[0], [[6., 6., 6.],
Expand Down
43 changes: 21 additions & 22 deletions orangecontrib/spectroscopy/widgets/owcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from Orange.widgets.visualize.utils.customizableplot import CommonParameterSetter, Updater
from Orange.widgets.visualize.utils.plotutils import PlotItem, GraphicsView, AxisItem
from Orange.widgets.widget import OWWidget, Msg, Input, Output
from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin
# from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin
from Orange.widgets import gui, settings

from AnyQt.QtCore import QRectF, Qt
Expand Down Expand Up @@ -59,27 +59,26 @@ def calc_cos(table1, table2):


# class to multithread the isocurve calculation
def run(data: Table,
variable: Optional[Union[Variable, bool]],
feature_name: str,
remove_redundant_inst: bool,
state: TaskState
) -> Table:
if not data:
return None

def callback(i: float, status=""):
state.set_progress_value(i * 100)
if status:
state.set_status(status)
if state.is_interruption_requested():
raise Exception

# the isocurve calculation needs to happen here
return Table.transpose(data, variable, feature_name=feature_name,
remove_redundant_inst=remove_redundant_inst,
progress_callback=callback)

# def run(data: Table,
# variable: Optional[Union[Variable, bool]],
# feature_name: str,
# remove_redundant_inst: bool,
# state: TaskState
# ) -> Table:
# if not data:
# return None
#
# def callback(i: float, status=""):
# state.set_progress_value(i * 100)
# if status:
# state.set_status(status)
# if state.is_interruption_requested():
# raise Exception
#
# # the isocurve calculation needs to happen here
# return Table.transpose(data, variable, feature_name=feature_name,
# remove_redundant_inst=remove_redundant_inst,
# progress_callback=callback)


class ParameterSetter(CommonParameterSetter):
Expand Down

0 comments on commit 5746900

Please sign in to comment.