Exemple #1
0
    def test_attribute_reading_present(self):

        attribute = AttributeReadingModule(file_name='parang.dat',
                                           attribute='PARANG',
                                           name_in='attribute3',
                                           input_dir=None,
                                           data_tag='images',
                                           overwrite=False)

        self.pipeline.add_module(attribute)

        with pytest.warns(UserWarning) as warning:
            self.pipeline.run_module('attribute3')

        assert warning[0].message.args[0] == 'The attribute \'PARANG\' is already present. Set ' \
                                             'the \'overwrite\' parameter to True in order to ' \
                                             'overwrite the values with parang.dat.'
Exemple #2
0
    def test_attribute_reading_same(self):

        attribute = AttributeReadingModule(file_name='attribute.dat',
                                           attribute='EXP_NO',
                                           name_in='attribute6',
                                           input_dir=None,
                                           data_tag='images',
                                           overwrite=True)

        self.pipeline.add_module(attribute)

        with pytest.warns(UserWarning) as warning:
            self.pipeline.run_module('attribute6')

        assert len(warning) == 1
        assert warning[0].message.args[0] == 'The \'EXP_NO\' attribute is already present and ' \
                                             'contains the same values as are present in ' \
                                             'attribute.dat.'
Exemple #3
0
    def test_attribute_reading_same(self):

        attribute = AttributeReadingModule(file_name="attribute.dat",
                                           attribute="EXP_NO",
                                           name_in="attribute6",
                                           input_dir=None,
                                           data_tag="images",
                                           overwrite=True)

        self.pipeline.add_module(attribute)

        with pytest.warns(UserWarning) as warning:
            self.pipeline.run_module("attribute6")

        assert len(warning) == 1
        assert warning[0].message.args[0] == "The 'EXP_NO' attribute is already present and " \
                                             "contains the same values as are present in " \
                                             "attribute.dat."
Exemple #4
0
    def test_attribute_reading_overwrite(self):

        attribute = AttributeReadingModule(file_name="parang.dat",
                                           attribute="PARANG",
                                           name_in="attribute7",
                                           input_dir=None,
                                           data_tag="images",
                                           overwrite=True)

        self.pipeline.add_module(attribute)
        self.pipeline.run_module("attribute7")

        attribute = self.pipeline.get_attribute("images",
                                                "PARANG",
                                                static=False)
        assert np.allclose(attribute,
                           np.arange(1., 11., 1.),
                           rtol=limit,
                           atol=0.)
Exemple #5
0
    def test_attribute_reading_overwrite(self):

        attribute = AttributeReadingModule(file_name='parang.dat',
                                           attribute='PARANG',
                                           name_in='attribute7',
                                           input_dir=None,
                                           data_tag='images',
                                           overwrite=True)

        self.pipeline.add_module(attribute)
        self.pipeline.run_module('attribute7')

        attribute = self.pipeline.get_attribute('images',
                                                'PARANG',
                                                static=False)
        assert np.allclose(attribute,
                           np.arange(1., 11., 1.),
                           rtol=limit,
                           atol=0.)