def test_remove_module(self) -> None: pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir) module = FitsReadingModule(name_in='read') pipeline.add_module(module) module = BadPixelSigmaFilterModule(name_in='badpixel', image_in_tag='im_arr1', image_out_tag='im_out') pipeline.add_module(module) assert pipeline.get_module_names() == ['read', 'badpixel'] assert pipeline.remove_module('read') assert pipeline.get_module_names() == ['badpixel'] assert pipeline.remove_module('badpixel') with pytest.warns(UserWarning) as warning: pipeline.remove_module('test') assert len(warning) == 1 assert warning[0].message.args[0] == 'Pipeline module \'test\' is not found in the ' \ 'Pypeline dictionary so it could not be removed. ' \ 'The dictionary contains the following modules: [].' \ os.remove(self.test_dir + 'PynPoint_database.hdf5')
def test_remove_module(self): pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir) read = FitsReadingModule(name_in='read') pipeline.add_module(read) process = BadPixelSigmaFilterModule(name_in='badpixel', image_in_tag='im_arr1', image_out_tag='im_out') pipeline.add_module(process) assert pipeline.get_module_names() == ['read', 'badpixel'] assert pipeline.remove_module('read') assert pipeline.get_module_names() == ['badpixel'] assert pipeline.remove_module('badpixel') with pytest.warns(UserWarning) as warning: pipeline.remove_module('test') assert len(warning) == 1 assert warning[0].message.args[0] == 'Module name \'test\' not found in the Pypeline ' \ 'dictionary.' os.remove(self.test_dir + 'PynPoint_database.hdf5')
def test_add_module(self): pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir) read = FitsReadingModule(name_in='read1', input_dir=None, image_tag='im_arr1') assert pipeline.add_module(read) is None read = FitsReadingModule(name_in='read2', input_dir=self.test_dir, image_tag='im_arr2') assert pipeline.add_module(read) is None with pytest.warns(UserWarning) as warning: pipeline.add_module(read) assert len(warning) == 1 assert warning[0].message.args[0] == 'Pipeline module names need to be unique. ' \ 'Overwriting module \'read2\'.' process = BadPixelSigmaFilterModule(name_in='badpixel', image_in_tag='im_arr1', image_out_tag='im_out') assert pipeline.add_module(process) is None write = FitsWritingModule(name_in='write1', file_name='result.fits', data_tag='im_arr1') assert pipeline.add_module(write) is None write = FitsWritingModule(name_in='write2', file_name='result.fits', data_tag='im_arr1', output_dir=self.test_dir) assert pipeline.add_module(write) is None assert pipeline.run() is None assert pipeline.get_module_names() == ['read1', 'read2', 'badpixel', 'write1', 'write2'] os.remove(self.test_dir+'result.fits') os.remove(self.test_dir+'PynPoint_database.hdf5')
def test_add_module(self) -> None: pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir) module = FitsReadingModule(name_in='read1', input_dir=None, image_tag='im_arr1') assert pipeline.add_module(module) is None module = FitsReadingModule(name_in='read2', input_dir=self.test_dir, image_tag='im_arr2') assert pipeline.add_module(module) is None with pytest.warns(UserWarning) as warning: pipeline.add_module(module) assert len(warning) == 1 assert warning[0].message.args[0] == 'Names of pipeline modules that are added to the ' \ 'Pypeline need to be unique. The current pipeline ' \ 'module, \'read2\', does already exist in the ' \ 'Pypeline dictionary so the previous module with ' \ 'the same name will be overwritten.' module = BadPixelSigmaFilterModule(name_in='badpixel', image_in_tag='im_arr1', image_out_tag='im_out') assert pipeline.add_module(module) is None module = FitsWritingModule(name_in='write1', file_name='result.fits', data_tag='im_arr1') assert pipeline.add_module(module) is None module = FitsWritingModule(name_in='write2', file_name='result.fits', data_tag='im_arr1', output_dir=self.test_dir) assert pipeline.add_module(module) is None assert pipeline.run() is None assert pipeline.get_module_names() == [ 'read1', 'read2', 'badpixel', 'write1', 'write2' ] os.remove(self.test_dir + 'result.fits') os.remove(self.test_dir + 'PynPoint_database.hdf5')
def test_remove_module(self): pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir) read = FitsReadingModule(name_in="read") pipeline.add_module(read) process = BadPixelSigmaFilterModule(name_in="badpixel") pipeline.add_module(process) assert pipeline.get_module_names() == ["read", "badpixel"] assert pipeline.remove_module("read") assert pipeline.get_module_names() == ["badpixel"] assert pipeline.remove_module("badpixel") with pytest.warns(UserWarning) as warning: pipeline.remove_module("test") assert len(warning) == 1 assert warning[0].message.args[0] == "Module name 'test' not found in the Pypeline " \ "dictionary." os.remove(self.test_dir + "PynPoint_database.hdf5")
def test_add_module(self): pipeline = Pypeline(self.test_dir, self.test_dir, self.test_dir) read = FitsReadingModule(name_in="read1", input_dir=None, image_tag="im_arr1") assert pipeline.add_module(read) is None read = FitsReadingModule(name_in="read2", input_dir=self.test_dir, image_tag="im_arr2") assert pipeline.add_module(read) is None with pytest.warns(UserWarning) as warning: pipeline.add_module(read) assert len(warning) == 1 assert warning[0].message.args[0] == "Processing module names need to be unique. " \ "Overwriting module 'read2'." process = BadPixelSigmaFilterModule(name_in="badpixel", image_in_tag="im_arr1") assert pipeline.add_module(process) is None write = FitsWritingModule(name_in="write1", file_name="result.fits", data_tag="im_arr1") assert pipeline.add_module(write) is None write = FitsWritingModule(name_in="write2", file_name="result.fits", data_tag="im_arr1", output_dir=self.test_dir) assert pipeline.add_module(write) is None assert pipeline.run() is None assert pipeline.get_module_names() == [ 'read1', 'read2', 'badpixel', 'write1', 'write2' ] os.remove(self.test_dir + "result.fits") os.remove(self.test_dir + "PynPoint_database.hdf5")