Beispiel #1
0
 def test_create_convolutionfunction(self):
     cf = create_convolutionfunction_from_image(self.image, nz=1)
     cf_image = convert_convolutionfunction_to_image(cf)
     cf_image.data = numpy.real(cf_image.data)
     if self.persist:
         export_image_to_fits(
             cf_image, "%s/test_convolutionfunction_cf.fits" % self.dir)
 def test_readwriteconvolutionfunction(self):
     im = create_test_image()
     cf = create_convolutionfunction_from_image(im)
     export_convolutionfunction_to_hdf5(cf, '%s/test_data_model_helpers_convolutionfunction.hdf' % self.dir)
     newcf = import_convolutionfunction_from_hdf5('%s/test_data_model_helpers_convolutionfunction.hdf' % self.dir)
 
     assert newcf.data.shape == cf.data.shape
     assert numpy.max(numpy.abs(cf.data - newcf.data)) < 1e-15
Beispiel #3
0
    def test_readwriteconvolutionfunction(self):
        im = create_test_image()
        cf = create_convolutionfunction_from_image(im)
        config = {
            "buffer": {
                "directory": self.dir
            },
            "convolutionfunction": {
                "name": "test_bufferconvolutionfunction.hdf",
                "data_model": "ConvolutionFunction"
            }
        }
        bdm = BufferConvolutionFunction(config["buffer"],
                                        config["convolutionfunction"], cf)
        bdm.sync()
        new_bdm = BufferConvolutionFunction(config["buffer"],
                                            config["convolutionfunction"])
        new_bdm.sync()
        newcf = bdm.memory_data_model

        assert newcf.data.shape == cf.data.shape
        assert numpy.max(numpy.abs(cf.data - newcf.data)) < 1e-15