def test_input_preprocessors(self): """Check multiple preprocessors on input""" pp_list = PreprocessorList([Randomize, RemoveNaNColumns]) self.send_signal("Preprocessor", pp_list) self.widget.apply_button.button.click() self.assertEqual([pp_list] + list(self.widget.LEARNER.preprocessors), self.widget.learner.preprocessors)
def test_input_preprocessors(self): """Check multiple preprocessors on input""" pp_list = PreprocessorList([Randomize(), RemoveNaNColumns()]) self.send_signal("Preprocessor", pp_list) self.widget.apply_button.button.click() self.assertEqual((pp_list, ), self.widget.learner.preprocessors, '`PreprocessorList` was not added to preprocessors')
def test_preprocessor_list(self): # TODO problematic interface design: should be able to use Orange.data.Table directly path = os.path.join(get_sample_datasets_dir(), AGILENT_TILE) reader = OWTilefile.get_tile_reader(path) pp = PreprocessorList(PREPROCESSORS_INDEPENDENT_SAMPLES[0:7]) reader.set_preprocessor(pp) t = reader.read() assert len(t.domain.attributes) == 3
def commit(self): """ Update parameters to preprocessors and set output signals. """ data = None if self.data is not None: data = self.pp_batch(self.pp(self.data)) self.Outputs.data.send(data) self.Outputs.preprocessor.send(PreprocessorList([self.pp, self.pp_batch]))
self.info_preproc.setText( self._format_preproc_str( self.preprocessor).lstrip("\n")) else: # only allow readers with tile-by-tile support to run. reader = None return reader elif self.source == self.URL: url = self.url_combo.currentText().strip() if url: return UrlReader(url) if __name__ == "__main__": import sys from orangecontrib.spectroscopy.preprocess import Cut, LinearBaseline from Orange.preprocess.preprocess import PreprocessorList import orangecontrib.protospec #load readers a = QApplication(sys.argv) # preproc = PreprocessorList([Cut(lowlim=2000, highlim=2006), LinearBaseline()]) preproc = PreprocessorList( [LinearBaseline(), Cut(lowlim=2000, highlim=2006)]) # preproc = PreprocessorList([Cut(lowlim=2000, highlim=2006), Cut(lowlim=2002, highlim=2006)]) # Test 2nd Deriv superwide # from orangecontrib.spectroscopy.preprocess import Normalize, Integrate, integrate, SavitzkyGolayFiltering # preproc = PreprocessorList([Normalize(lower=1591.0484214631633, upper=1719.720747038586, int_method=integrate.IntegrateFeatureSimple), SavitzkyGolayFiltering(window=13, deriv=2), Integrate(methods=integrate.IntegrateFeatureAtPeak, limits=[[1625.0, 1.0], [1152.0, 1.0], [1575.0, 1.0], [1127.0, 1.0]])]) ow = OWTilefile() ow.update_preprocessor(preproc) ow.show() a.exec_() ow.saveSettings()