:py:mod:`pytmosph3r.util.memory` ================================ .. py:module:: pytmosph3r.util.memory Module Contents --------------- .. py:class:: MemoryUtils This class is inherited from :class:`Logger`. .. py:attribute:: margin :value: 1 Margin (in ratio wrt available memory) that we can allow to allocate (to avoid swapping). .. py:method:: check_memory(to_check, name=None) Check if memory of :py:attr:`to_check` is lower than available memory. :param to_check: If an array, calculate its theoretical memory based on its shape and dtype. If the :type to_check: array, int :param number of elements: :type number of elements: for example before creating an array :param name: Name to print in message. Defaults to None. If :py:attr:`to_check` is an array, :type name: str, optional :param it will try to retrieve the variable name.: .. py:method:: available_memory(to_check, obj_type=float) Returns how much of the available memory an object is consuming. :param to_check: If an array, calculate its theoretical memory based on its shape and dtype. If the :type to_check: array, int :param number of elements: :type number of elements: for example before creating an array :param obj_type: Type of :py:attr:`to_check` (to use only if it's a number, not an array). :type obj_type: type, optional :param Defaults to `float`.: .. py:function:: memory_usage(pattern='VmR') Returns overall memory usage of process. (Linux only)