# Path: ecell4/util/decorator.py
# def get_model(is_netfree=False, without_reset=False, seeds=None, effective=False):
#     """
#     Generate a model with parameters in the global scope, ``SPECIES_ATTRIBUTES``
#     and ``REACTIONRULES``.
# 
#     Parameters
#     ----------
#     is_netfree : bool, optional
#         Return ``NetfreeModel`` if True, and ``NetworkModel`` if else.
#         Default is False.
#     without_reset : bool, optional
#         Do not reset the global variables after the generation if True.
#         Default is False.
#     seeds : list, optional
#         A list of seed ``Species`` for expanding the model.
#         If this is not None, generate a ``NetfreeModel`` once, and return a
#         ``NetworkModel``, which is an expanded form of that with the given seeds.
#         Default is None.
#     effective : bool, optional
#         See ``NetfreeModel.effective`` and ``Netfree.set_effective``.
#         Only meaningfull with option ``is_netfree=True``.
#         Default is False
# 
#     Returns
#     -------
#     model : NetworkModel, NetfreeModel
# 
#     """
#     try:
#         if seeds is not None or is_netfree:
#             m = ecell4_base.core.NetfreeModel()
#         else:
#             m = ecell4_base.core.NetworkModel()
# 
#         for sp, proceed in SPECIES_ATTRIBUTES:
#             m.add_species_attribute(sp, proceed)
#         for rr in REACTION_RULES:
#             m.add_reaction_rule(rr)
# 
#         if not without_reset:
#             reset_model()
# 
#         if seeds is not None:
#             return m.expand(seeds)
# 
#         if isinstance(m, ecell4_base.core.NetfreeModel):
#             m.set_effective(effective)
#     except Exception as e:
#         reset_model()
#         raise e
# 
#     return m
# 
# Path: ecell4/extra/unit.py
# HAS_PINT = False
# STRICT = False
# HAS_PINT = True
# STRICT = True


import warnings
import copy
import collections.abc
import numbers
import tempfile
import os
import ecell4_base
    import ecell4.extra.ensemble
        import numpy
        import pandas
        import numpy
        import numpy
from .decorator import get_model
from ..extra import unit
        from ..plotting import plot_number_observer
        from ..plotting import plot_number_observer
        from ..extra.ensemble import genseeds
        from ..extra.ensemble import run_ensemble
def get_shape(shape, *args):
    if not isinstance(shape, str):
        raise ValueError("Invalid shape was given [{}]. This must be 'str'".format(repr(shape)))

    shape = shape.lower()
    shape_map = {
        'aabb': ecell4_base.core.AABB,
        # 'affinetransformation': ecell4_base.core.AffineTransformation,
        'cylinder': ecell4_base.core.Cylinder,
        'cylindricalsurface': ecell4_base.core.CylindricalSurface,
        'meshsurface': ecell4_base.core.MeshSurface,
        'planarsurface': ecell4_base.core.PlanarSurface,
        'rod': ecell4_base.core.Rod,
        'rodsurface': ecell4_base.core.RodSurface,
        'sphere': ecell4_base.core.Sphere,
        'sphericalsurface': ecell4_base.core.SphericalSurface,
        # 'complement': ecell4_base.core.Complement,
        # 'union': ecell4_base.core.Union,
        }
    if shape in shape_map:
        args = [
            value.to_base_units().magnitude if isinstance(value, unit._Quantity) else value
            for value in args]
        return shape_map[shape](*args)
    else:
        raise ValueError(
            'unknown shape type was given: ' + repr(shape)
            + '. use {}'.format(', '.join(sorted(shape_map.keys()))))

def get_value(obj, type_and_dim=None):

# Path: ecell4/util/decorator.py
# def get_model(is_netfree=False, without_reset=False, seeds=None, effective=False):
#     """
#     Generate a model with parameters in the global scope, ``SPECIES_ATTRIBUTES``
#     and ``REACTIONRULES``.
# 
#     Parameters
#     ----------
#     is_netfree : bool, optional
#         Return ``NetfreeModel`` if True, and ``NetworkModel`` if else.
#         Default is False.
#     without_reset : bool, optional
#         Do not reset the global variables after the generation if True.
#         Default is False.
#     seeds : list, optional
#         A list of seed ``Species`` for expanding the model.
#         If this is not None, generate a ``NetfreeModel`` once, and return a
#         ``NetworkModel``, which is an expanded form of that with the given seeds.
#         Default is None.
#     effective : bool, optional
#         See ``NetfreeModel.effective`` and ``Netfree.set_effective``.
#         Only meaningfull with option ``is_netfree=True``.
#         Default is False
# 
#     Returns
#     -------
#     model : NetworkModel, NetfreeModel
# 
#     """
#     try:
#         if seeds is not None or is_netfree:
#             m = ecell4_base.core.NetfreeModel()
#         else:
#             m = ecell4_base.core.NetworkModel()
# 
#         for sp, proceed in SPECIES_ATTRIBUTES:
#             m.add_species_attribute(sp, proceed)
#         for rr in REACTION_RULES:
#             m.add_reaction_rule(rr)
# 
#         if not without_reset:
#             reset_model()
# 
#         if seeds is not None:
#             return m.expand(seeds)
# 
#         if isinstance(m, ecell4_base.core.NetfreeModel):
#             m.set_effective(effective)
#     except Exception as e:
#         reset_model()
#         raise e
# 
#     return m
# 
# Path: ecell4/extra/unit.py
# HAS_PINT = False
# STRICT = False
# HAS_PINT = True
# STRICT = True


# Path: ecell4/util/session.py
import warnings
import copy
import collections.abc
import numbers
import tempfile
import os
import ecell4_base
    import ecell4.extra.ensemble
        import numpy
        import pandas
        import numpy
        import numpy
from .decorator import get_model
from ..extra import unit
        from ..plotting import plot_number_observer
        from ..plotting import plot_number_observer
        from ..extra.ensemble import genseeds
        from ..extra.ensemble import run_ensemble

def get_shape(shape, *args):
    if not isinstance(shape, str):
        raise ValueError("Invalid shape was given [{}]. This must be 'str'".format(repr(shape)))

    shape = shape.lower()
    shape_map = {
        'aabb': ecell4_base.core.AABB,
        # 'affinetransformation': ecell4_base.core.AffineTransformation,
        'cylinder': ecell4_base.core.Cylinder,
        'cylindricalsurface': ecell4_base.core.CylindricalSurface,
        'meshsurface': ecell4_base.core.MeshSurface,
        'planarsurface': ecell4_base.core.PlanarSurface,
        'rod': ecell4_base.core.Rod,
        'rodsurface': ecell4_base.core.RodSurface,
        'sphere': ecell4_base.core.Sphere,
        'sphericalsurface': ecell4_base.core.SphericalSurface,
        # 'complement': ecell4_base.core.Complement,
        # 'union': ecell4_base.core.Union,
        }
    if shape in shape_map:
        args = [
            value.to_base_units().magnitude if isinstance(value, unit._Quantity) else value
            for value in args]
        return shape_map[shape](*args)
    else:
        raise ValueError(
            'unknown shape type was given: ' + repr(shape)
            + '. use {}'.format(', '.join(sorted(shape_map.keys()))))

def get_value(obj, type_and_dim=None):

    if unit.HAS_PINT and isinstance(obj, unit._Quantity):