Questions tagged [numpy-memmap]

An advanced numpy.memmap() utility to avoid RAM-size limit and reduce final RAM-footprint ( at a reasonable cost of O/S-cached fileIO mediated via a small-size in-RAM proxy-view window into whole array-data ) Creates and handles a memory-map to an array stored in a binary file on disk.

Creates and handles a memory-map to an array stored in a binary file on disk.

Memory-mapped files are used for arranging access to large non-in-RAM arrays via small proxy-segments of an O/S-cached area of otherwise unmanageably large data files.

Leaving most of the data on disk, without reading the entire file into RAM memory and working with data via smart, moving, O/S-cached window-view into the non-in-RAM big file, enables to escape from both O/S RAM-limits and from adverse side-effects of python's memory management painfull reluctance to release once allocated memory-blocks anytime before the python program termination.

numpy's memmap's are array-like objects.

This differs from Python's mmap module, which uses file-like objects.

101 questions
0
votes
2 answers

Can operations on a numpy.memmap be deferred?

Consider this example: import numpy as np a = np.array(1) np.save("a.npy", a) a = np.load("a.npy", mmap_mode='r') print(type(a)) b = a + 2 print(type(b)) which outputs So it seems that b…
bers
  • 4,817
  • 2
  • 40
  • 59
0
votes
1 answer

Edit existing .npy file imported using memmap

I am new to working with numpy.core.memmap objects and am having trouble figuring out how I edit an existing .npy file read into python using numpy.memmap(). For example, following the example from Scipy.org, I can create an object and write to it,…
user44796
  • 1,053
  • 1
  • 11
  • 20
0
votes
2 answers

Reading numpy array from file and parsing very slow

I have a binary file and I am parsing it to a numpy array in Python like the following: bytestream= np.fromfile(path, dtype=np.int16) for a in range(sizeA): for x in range(0, sizeX): for y in range(0, sizeY): …
user4911648
0
votes
1 answer

How to gradually write large amounts of data to memory?

I am performing a signal processing task on a large dataset of images, converting the images into large feature vectors with a certain structure (number_of_transforms, width, height, depth). The feature vectors (or coefficients in my code) are too…
Kappie001
  • 898
  • 2
  • 10
  • 20
0
votes
0 answers

Can I count the number of objects instantiated inside a python function programmatically?

I am writing a unit test. The thing it tests involves numpy memmaps, which, like numpy ndarrays, can be "views" that reference an other memmap's data (and take no time to create) or copies (which take a long time to create). I want to test how many…
Pavel Komarov
  • 1,153
  • 12
  • 26
0
votes
1 answer

Append npy file to another npy file with same number of columns in both files

npy files size are around 5 gb and RAM is around 5gb so cannot load both numpy arrays. How to load one npy file and append its rows to other npy file without loading it
charanReddy
  • 137
  • 1
  • 11
0
votes
1 answer

numpy memmap modify files

I have a problem understanding the way numpy.memmap works. The background is that I need to reduce a large numpy array saved on disc by deleting entries. Reading in the array and building up a new one by copying the desired parts doesn't work - it…
fdiehl
  • 1
0
votes
1 answer

Is there a way with numpy to memmap a big-endian complex number?

I'm trying to load data from very large files that are formatted to be complex64 but in big-endian. Because of their size I want to use memmap. I can load the array as big-endian floats like such: arr = np.memmap(fn, dtype='>f4', shape=(M,N,2)) but…
Craig
  • 901
  • 7
  • 18
0
votes
0 answers

Can not perform Groupby on pandas dataframe of memmap arrays because it's unhashable

I have panada dataframe predictions which consists of three columns. I created this dataframe using three memmap array. predictions = pd.dataframe{'cell': list_1, 'tree': list_2, 'predict': list_3, 'label': list_4} Now I wanna groupby on two…
ga97rasl
  • 307
  • 2
  • 7
  • 15
0
votes
0 answers

Image mean subtraction on memmap array

I have memmap array contains images like this where each image is an array of size (1,784) : np.memmap('/home/usr/ds', dtype='float32', mode='r', shape=(1300, 784)) I want to know how can I do Image mean subtraction to normalize all images.
ga97rasl
  • 307
  • 2
  • 7
  • 15
-1
votes
1 answer

Discrepancy between C mmap and numpy memmap

I have a file containing a large number, N, of 32-bit floats. This file is created using numpys memmap function as follows: mmoutput = np.memmap("filename", dtype='f4', mode='w+', offset=0, shape=N) mmoutput[:] = my_floats mmoutput.flush() When I…
JMzance
  • 1,704
  • 4
  • 30
  • 49
1 2 3 4 5 6
7