I writting large array so I'm using numpy memmap
At the end of my operation I would like to use flip function but the problem is, the flip function does not apply after using the flush function on memap
import numpy as np
from matplotlib import pyplot as plt
#Create array on disk
fpc = np.memmap("test3.rgb", dtype=np.uint8, mode='w+', shape=(10000,20000,3))
fpc[0:5000] = [255,0,0] #Top red
fpc[5000:10000] = [0,255,0] #Bottom green
plt.subplot(131)
plt.title("Before flip")
plt.imshow(fpc)
#Apply flip function, so green come on top
fpc = np.flip(fpc,0)
plt.subplot(132)
plt.imshow(fpc)
plt.title("After flip")
#Save changes
fpc.flush()
#Reload array
fpc = np.memmap("test3.rgb", dtype=np.uint8, mode='r', shape=(10000,20000,3))
plt.subplot(133)
plt.title("After reload")
plt.imshow(fpc)
plt.show()
Result:
Is it really possible to use memmap with a flip function?
