Closed ercius closed 4 years ago
getMemmap is also no longer working with on_memory option enabled. I will use the filename rather than the already open file identifier to return a memmap.
This affected both dm.fileDM.getDataset()
and dm.fileDM.getSlice()
. Its possible it is only a Windows issue.
I made it explicit for the data to be loaded into memory using np.array(). See https://github.com/ercius/openNCEM/commit/f6df731a415e9dad0a501f75936169c89be83047 and https://github.com/ercius/openNCEM/commit/f30f10e5f59d11013276f473b78788882fa83739.
Using
on_memory
no longer loads the image data into memory. Python crashes when trying to access the data after the file is closed. This is undesirable, since its suggested to usewith
context management where possible and close the file after reading the data.This seems to be related to the way
dm.fileDM.fromfile
usesnp.frombuffer
. I am using numpy 1.18.1 on Windows 10, and this is now crashing. Maybe the behavior changed in recent versions of numpy?Im going to explicitly load the data using np.array() to overwrite the ['data'] entry in the output dict.
@gonzalorodrigo You improved dm reading using this method. Do you have any suggestions as to why this is happening or a better way to fix it?