Esempio n. 1
0
    def test_OpNpyFileReaderNPZnamed(self):
        # Now read back our test data using an OpNpyFileReader operator
        npyReader = OpNpyFileReader(graph=self.graph)
        try:
            for internalPath, referenceData in zip(["data_A", "data_B"], [self.testData, self.testDataB]):
                npyReader.InternalPath.setValue("data_B")
                npyReader.FileName.setValue(self.testDataFilePathNPZnamed)

                # Read the entire file and verify the contents
                b = npyReader.Output[:].wait()
                assert b.shape == self.testDataB.shape
                assert npyReader.Output.meta.dtype == self.testDataB.dtype

                numpy.testing.assert_almost_equal(b, self.testDataB)
        finally:
            npyReader.cleanUp()
Esempio n. 2
0
    def test_OpNpyFileReaderNPZnamed(self):
        # Now read back our test data using an OpNpyFileReader operator
        npyReader = OpNpyFileReader(graph=self.graph)
        try:
            for internalPath, referenceData in zip(
                ["data_A", "data_B"], [self.testData, self.testDataB]):
                npyReader.InternalPath.setValue("data_B")
                npyReader.FileName.setValue(self.testDataFilePathNPZnamed)

                # Read the entire file and verify the contents
                b = npyReader.Output[:].wait()
                assert b.shape == self.testDataB.shape
                assert npyReader.Output.meta.dtype == self.testDataB.dtype

                numpy.testing.assert_almost_equal(b, self.testDataB)
        finally:
            npyReader.cleanUp()
Esempio n. 3
0
    def test_OpNpyFileReader(self):
        # Now read back our test data using an OpNpyFileReader operator
        npyReader = OpNpyFileReader(graph=self.graph)
        npyReader.FileName.setValue(self.testDataFilePath)

        # Read the entire file and verify the contents
        a = npyReader.Output[:].wait()
        assert a.shape == (10,11) # OpNpyReader automatically added a channel axis
        assert npyReader.Output.meta.dtype == self.testData.dtype

        # Why doesn't this work?  Numpy bug?
        # cmp = ( a == self.testData )
        # assert cmp.all()

        # Check each of the values
        for i in range(10):
            for j in range(11):
                assert a[i,j] == self.testData[i,j]
        npyReader.cleanUp()
Esempio n. 4
0
    def test_OpNpyFileReader(self):
        # Now read back our test data using an OpNpyFileReader operator
        npyReader = OpNpyFileReader(graph=self.graph)
        npyReader.FileName.setValue(self.testDataFilePath)

        # Read the entire file and verify the contents
        a = npyReader.Output[:].wait()
        assert a.shape == (10, 11
                           )  # OpNpyReader automatically added a channel axis
        assert npyReader.Output.meta.dtype == self.testData.dtype

        # Why doesn't this work?  Numpy bug?
        # cmp = ( a == self.testData )
        # assert cmp.all()

        # Check each of the values
        for i in range(10):
            for j in range(11):
                assert a[i, j] == self.testData[i, j]
        npyReader.cleanUp()