Density.to_memmap#

Density.to_memmap()[source]#

Converts Density.data to a numpy.memmap.

Examples

The following outlines how to use the Density.to_memmap() method.

>>> from tme import Density
>>> large_density = Density.from_file("/path/to/large_file.mrc")
>>> large_density.to_memmap()

A more efficient solution to achieve the result outlined above is to provide the use_memmap flag in Density.from_file().

>>> Density.from_file("/path/to/large_file.mrc", use_memmap = True)

In practice, the Density.to_memmap() method finds application, if a large number of Density instances need to be in memory at once, without occupying the full phyiscal memory required to store Density.data.