# Path: discretize/utils/code_utils.py
# def is_scalar(f):
#     """Determine if the input argument is a scalar.
# 
#     The function **is_scalar** returns *True* if the input is an integer,
#     float or complex number. The function returns *False* otherwise.
# 
#     Parameters
#     ----------
#     f :
#         Any input quantity
# 
#     Returns
#     -------
#     bool :
# 
#         - *True* if the input argument is an integer, float or complex number
#         - *False* otherwise
# 
# 
#     """
# 
#     if isinstance(f, SCALARTYPES):
#         return True
#     elif isinstance(f, np.ndarray) and f.size == 1 and isinstance(f[0], SCALARTYPES):
#         return True
#     return False
# 
# Path: discretize/utils/code_utils.py
# def deprecate_function(new_function, old_name, removal_version=None, future_warn=False):
#     if future_warn:
#         Warning = FutureWarning
#     else:
#         Warning = DeprecationWarning
#     new_name = new_function.__name__
#     if removal_version is not None:
#         tag = f" It will be removed in version {removal_version} of discretize."
#     else:
#         tag = " It will be removed in a future version of discretize."
# 
#     def dep_function(*args, **kwargs):
#         warnings.warn(
#             f"{old_name} has been deprecated, please use {new_name}." + tag,
#             Warning,
#         )
#         return new_function(*args, **kwargs)
# 
#     doc = f"""
#     `{old_name}` has been deprecated. See `{new_name}` for documentation
# 
#     See Also
#     --------
#     {new_name}
#     """
#     dep_function.__doc__ = doc
#     return dep_function


import numpy as np
import scipy.ndimage as ndi
import scipy.sparse as sp
import discretize
import warnings
from discretize.utils.code_utils import is_scalar
from scipy.spatial import cKDTree, Delaunay
from scipy import interpolate
from discretize.utils.code_utils import deprecate_function
        The unpacked list with all widths in order

    Examples
    --------
    Time stepping for time-domain codes can be represented in condensed form, e.g.:

    >>> from discretize.utils import unpack_widths
    >>> dt = [ (1e-5, 10), (1e-4, 4), 1e-3 ]

    The above means to take 10 steps at a step width of 1e-5 s and then
    4 more at 1e-4 s, and then one step of 1e-3 s. When unpacked, the output is
    of length 15 and is given by:

    >>> unpack_widths(dt)
    array([1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05,
           1.e-05, 1.e-05, 1.e-04, 1.e-04, 1.e-04, 1.e-04, 1.e-03])

    Each axis of a tensor mesh can also be defined as a condensed list of floats
    and/or tuples. When a third number is defined in any tuple, the width value
    is successively expanded by that factor, e.g.:

    >>> dt = [ 6., 8., (10.0, 3), (8.0, 4, 2.) ]
    >>> unpack_widths(dt)
    array([  6.,   8.,  10.,  10.,  10.,  16.,  32.,  64., 128.])
    """
    if type(value) is not list:
        raise Exception("unpack_widths must be a list of scalars and tuples.")

    proposed = []
    for v in value:

# Path: discretize/utils/code_utils.py
# def is_scalar(f):
#     """Determine if the input argument is a scalar.
# 
#     The function **is_scalar** returns *True* if the input is an integer,
#     float or complex number. The function returns *False* otherwise.
# 
#     Parameters
#     ----------
#     f :
#         Any input quantity
# 
#     Returns
#     -------
#     bool :
# 
#         - *True* if the input argument is an integer, float or complex number
#         - *False* otherwise
# 
# 
#     """
# 
#     if isinstance(f, SCALARTYPES):
#         return True
#     elif isinstance(f, np.ndarray) and f.size == 1 and isinstance(f[0], SCALARTYPES):
#         return True
#     return False
# 
# Path: discretize/utils/code_utils.py
# def deprecate_function(new_function, old_name, removal_version=None, future_warn=False):
#     if future_warn:
#         Warning = FutureWarning
#     else:
#         Warning = DeprecationWarning
#     new_name = new_function.__name__
#     if removal_version is not None:
#         tag = f" It will be removed in version {removal_version} of discretize."
#     else:
#         tag = " It will be removed in a future version of discretize."
# 
#     def dep_function(*args, **kwargs):
#         warnings.warn(
#             f"{old_name} has been deprecated, please use {new_name}." + tag,
#             Warning,
#         )
#         return new_function(*args, **kwargs)
# 
#     doc = f"""
#     `{old_name}` has been deprecated. See `{new_name}` for documentation
# 
#     See Also
#     --------
#     {new_name}
#     """
#     dep_function.__doc__ = doc
#     return dep_function


# Path: discretize/utils/mesh_utils.py
import numpy as np
import scipy.ndimage as ndi
import scipy.sparse as sp
import discretize
import warnings
from discretize.utils.code_utils import is_scalar
from scipy.spatial import cKDTree, Delaunay
from scipy import interpolate
from discretize.utils.code_utils import deprecate_function

        The unpacked list with all widths in order

    Examples
    --------
    Time stepping for time-domain codes can be represented in condensed form, e.g.:

    >>> from discretize.utils import unpack_widths
    >>> dt = [ (1e-5, 10), (1e-4, 4), 1e-3 ]

    The above means to take 10 steps at a step width of 1e-5 s and then
    4 more at 1e-4 s, and then one step of 1e-3 s. When unpacked, the output is
    of length 15 and is given by:

    >>> unpack_widths(dt)
    array([1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05, 1.e-05,
           1.e-05, 1.e-05, 1.e-04, 1.e-04, 1.e-04, 1.e-04, 1.e-03])

    Each axis of a tensor mesh can also be defined as a condensed list of floats
    and/or tuples. When a third number is defined in any tuple, the width value
    is successively expanded by that factor, e.g.:

    >>> dt = [ 6., 8., (10.0, 3), (8.0, 4, 2.) ]
    >>> unpack_widths(dt)
    array([  6.,   8.,  10.,  10.,  10.,  16.,  32.,  64., 128.])
    """
    if type(value) is not list:
        raise Exception("unpack_widths must be a list of scalars and tuples.")

    proposed = []
    for v in value:

        if is_scalar(v):