napari.utils¶
Module Attributes
Classes
Colormap that relates intensity values to colors. |
|
alias of |
Functions
-
napari.utils.
resize_dask_cache
(nbytes=None, mem_fraction=None)[source]¶ Create or resize the dask cache used for opportunistic caching.
The cache object is an instance of a
Cache
, (which wraps acachey.Cache
), and is made available atnapari.utils.dask_cache
.See Dask opportunistic caching
- Parameters
nbytes (int, optional) – The desired size of the cache, in bytes. If
None
, the cache size will autodetermined as fraction of the total memory in the system, usingmem_fraction
. Ifnbytes
is 0. The cache is turned off. by default, cache size is autodetermined usingmem_fraction
.mem_fraction (float, optional) – The fraction (from 0 to 1) of total memory to use for the dask cache.
- Returns
dask_cache – An instance of a Dask Cache
- Return type
dask.cache.Cache
Examples
>>> from napari.utils import resize_dask_cache >>> cache = resize_dask_cache() # use 50% of total memory by default
>>> # dask.Cache wraps cachey.Cache >>> assert isinstance(cache.cache, cachey.Cache)
>>> # useful attributes >>> cache.cache.available_bytes # full size of cache >>> cache.cache.total_bytes # currently used bytes