How to use the openpnm.utils.logging function in openpnm

To help you get started, we’ve selected a few openpnm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PMEAL / OpenPNM / openpnm / models / geometry / pore_seed.py View on Github external
r"""

Pore seed models are use to calculate random numbers for each pore, which can
subsequently be used in statistical distributions to calculate actual pore
sizes.

.. autofunction:: openpnm.models.geometry.pore_seed.random
.. autofunction:: openpnm.models.geometry.pore_seed.spatially_correlated

"""

import scipy as _sp
from openpnm.models import misc as _misc
from openpnm.utils import logging as _logging
_logger = _logging.getLogger(__name__)


def random(target, seed=None, num_range=[0, 1]):
    return _misc.random(target, element='pore', seed=seed, num_range=num_range)


random.__doc__ = _misc.random.__doc__


def spatially_correlated(target, weights=None, strel=None):
    r"""
    Generates pore seeds that are spatailly correlated with their neighbors.

    Parameters
    ----------
    target : OpenPNM Object
github PMEAL / OpenPNM / openpnm / algorithms / TransientAdvectionDiffusion.py View on Github external
from openpnm.algorithms import TransientReactiveTransport, AdvectionDiffusion
from openpnm.utils import logging
logger = logging.getLogger(__name__)


class TransientAdvectionDiffusion(TransientReactiveTransport,
                                  AdvectionDiffusion):
    r"""
    A subclass of GenericTransport to perform steady and transient simulations
    of pure diffusion and advection diffusion problems.

    """

    def __init__(self, settings={}, phase=None, **kwargs):
        def_set = {'phase': None,
                   'gui': {'setup':        {'phase': None,
                                            'quantity': '',
                                            'diffusive_conductance': '',
                                            'hydraulic_conductance': '',
github PMEAL / OpenPNM / openpnm / core / ModelsMixin.py View on Github external
import inspect
from networkx import DiGraph, simple_cycles, draw_spectral
from networkx.algorithms.dag import lexicographical_topological_sort
from openpnm.utils import PrintableDict, logging, Workspace
ws = Workspace()
logger = logging.getLogger(__name__)


class ModelsDict(PrintableDict):
    r"""
    This subclassed dictionary is assigned to the ``models`` attribute of
    all objects that inherit from the ``ModelsMixin`` class.  Each dictionary
    entry corresponds to an entry in the target object's dictionary, and
    contains the models and associated parameters for generating the model.

    The main features of this subclass are three methods the help resolve the
    order in which models should be called: ``dependency_list``,
    ``dependency_graph``, and ``dependency_map``.

    """

    def dependency_list(self):
github PMEAL / OpenPNM / openpnm / models / geometry / pore_size.py View on Github external
a model for finding the largest possible sphere that can be placed on each
site.

.. autofunction:: openpnm.models.geometry.pore_size.weibull
.. autofunction:: openpnm.models.geometry.pore_size.normal
.. autofunction:: openpnm.models.geometry.pore_size.random
.. autofunction:: openpnm.models.geometry.pore_size.generic_distribution
.. autofunction:: openpnm.models.geometry.pore_size.largest_sphere
.. autofunction:: openpnm.models.geometry.pore_size.equivalent_diameter

"""

from openpnm.utils import logging as _logging
from openpnm.models import misc as _misc
import numpy as _np
_logger = _logging.getLogger(__name__)


def weibull(target, shape, scale, loc, seeds='pore.seed'):
    return _misc.weibull(target=target, shape=shape, scale=scale, loc=loc,
                         seeds=seeds)


weibull.__doc__ = _misc.weibull.__doc__


def normal(target, scale, loc, seeds='pore.seed'):
    return _misc.normal(target=target, scale=scale, loc=loc,
                        seeds=seeds)


normal.__doc__ = _misc.normal.__doc__
github PMEAL / OpenPNM / openpnm / models / misc / statistical_distributions.py View on Github external
r"""

.. autofunction:: openpnm.models.misc.statistical_distributions.random
.. autofunction:: openpnm.models.misc.statistical_distributions.weibull
.. autofunction:: openpnm.models.misc.statistical_distributions.normal
.. autofunction:: openpnm.models.misc.statistical_distributions.generic_distribution

"""

import numpy as np
import scipy.stats as spts
from openpnm.utils import logging
logger = logging.getLogger(__name__)


def random(target, element, seed=None, num_range=[0, 1]):
    r"""
    Create an array of random numbers of a specified size.

    Parameters
    ----------
    target : OpenPNM Object
        The object which this model is associated with. This controls the
        length of the calculated array, and also provides access to other
        necessary properties.

    seed : int
        The starting seed value to send to Scipy's random number generator.
        The default is None, which means different distribution is returned
github PMEAL / OpenPNM / openpnm / io / HDF5.py View on Github external
from h5py import File as hdfFile
from flatdict import FlatDict
from openpnm.io import Dict, GenericIO
from openpnm.utils import logging
logger = logging.getLogger(__name__)


class HDF5(GenericIO):
    r"""
    The HDF5 (Hierarchical Data Format) file is good for high-peformance, long
    term data storage
    """

    @classmethod
    def to_hdf5(cls, network=None, phases=[], element=['pore', 'throat'],
                filename='', interleave=True, flatten=False, categorize_by=[]):
        r"""
        Creates an HDF5 file containing data from the specified objects,
        and categorized according to the given arguments.

        Parameters
github PMEAL / OpenPNM / openpnm / algorithms / NonNewtonianStokesFlow.py View on Github external
import numpy as np
from openpnm.algorithms import ReactiveTransport
from openpnm.utils import logging
logger = logging.getLogger(__name__)


class NonNewtonianStokesFlow(ReactiveTransport):
    r"""
    A subclass of GenericLinearTransport to simulate viscous flow.  The 2
    main roles of this subclass are to set the default property names and to
    implement a method for calculating the hydraulic permeability of the
    network.

    """

    def __init__(self, settings={}, phase=None, **kwargs):
        def_set = {'phase': None,
                   'quantity': 'pore.pressure',
                   'conductance': 'throat.nonNewtonian_hydraulic_conductance',
                   'tolerance': 1e-5,
github PMEAL / OpenPNM / openpnm / algorithms / TransientChargeConservation.py View on Github external
from openpnm.algorithms import TransientReactiveTransport, ChargeConservation
from openpnm.utils import logging
logger = logging.getLogger(__name__)


class TransientChargeConservation(TransientReactiveTransport,
                                  ChargeConservation):
    r"""
    A subclass of GenericTransport to perform steady and transient simulations
    of pure diffusion and advection-diffusion problems.

    """

    def __init__(self, settings={}, phase=None, **kwargs):
        def_set = {'phase': None,
                   'gui': {'setup':        {'phase': None,
                                            'quantity': '',
                                            'conductance': '',
                                            'charge_conservation': '',
github PMEAL / OpenPNM / openpnm / phases / mixtures / DryAir.py View on Github external
from openpnm.phases.mixtures import GenericMixture, species
from openpnm.models.phases.mixtures import mole_weighted_average
import openpnm.models as mods
from openpnm.utils import logging
logger = logging.getLogger(__name__)


class DryAir(GenericMixture):
    r"""
    """
    def __init__(self, network, **kwargs):
        super().__init__(network=network, components=[], **kwargs)

        N2 = species.gases.N2(network=network, name='N2_'+self.name)
        O2 = species.gases.O2(network=network, name='O2_'+self.name)
        self.settings['components'] = [O2.name, N2.name]
        self.set_mole_fraction(component=N2, values=0.791)
        self.set_mole_fraction(component=O2, values=0.209)
        self.add_model(propname='pore.diffusivity.N2',
                       model=mods.phases.mixtures.fuller_diffusivity)
        self.add_model(propname='pore.diffusivity.O2',
github PMEAL / OpenPNM / openpnm / io / OpenpnmIO.py View on Github external
import pickle
import time
from openpnm.utils import Workspace, Project
from openpnm.utils import logging
from openpnm.io import GenericIO
logger = logging.getLogger(__name__)
ws = Workspace()


class OpenpnmIO(GenericIO):
    r"""
    This class contains methods used for saving and loading OpenPNM Workspaces,
    Projects, and objects.

    Notes
    -----
    The methods in this class use the ``pickle`` module from the standard
    library, which have known security issues.  Do not open '.pnm' files
    from untrusted sources.

    """