def test_NtNdArray(self): print() timeStamp = TestUtility.getTimeStamp() id = random.randint(0, 100000) nx = 1024 ny = 1024 nda = NtNdArray() nda['uniqueId'] = id dims = [ PvDimension(nx, 0, nx, 1, False), PvDimension(ny, 0, ny, 1, False) ] nda['codec'] = PvCodec('pvapyc', PvInt(14)) nda['dimension'] = dims nda['descriptor'] = 'PvaPy Simulated Image' nda['compressedSize'] = nx * ny nda['uncompressedSize'] = nx * ny nda['timeStamp'] = timeStamp nda['dataTimeStamp'] = timeStamp attrs = [NtAttribute('ColorMode', PvInt(0))] nda['attribute'] = attrs value = np.random.randint(0, 256, size=nx * ny, dtype=np.uint8) nda['value'] = {'ubyteValue': value} value2 = nda['value'][0]['ubyteValue'] print('Comparing image arrays {} to {}'.format(value2, value)) assert (np.array_equiv(value, value2))