コード例 #1
0
ファイル: __init__.py プロジェクト: ioam/topographica
    _time_type = gmpy.mpq
    _mpq_pickle_support()
except ImportError:
    import topo.misc.fixedpoint as fixedpoint

    param.main.warning("gmpy.mpq not available; using slower fixedpoint.FixedPoint for simulation time.")
    _time_type = fixedpoint_time_type
    # Provide a fake gmpy.mpq (to allow e.g. pickled test data to be
    # loaded).
    # CEBALERT: can we move this into whatever test needs it? I guess
    # it also has to be here to allow snapshots saved using gmpy time
    # type to open on systems where gmpy is not available.
    from topo.misc.util import gmpyImporter
    import sys

    sys.meta_path.append(gmpyImporter())

param.Dynamic.time_fn(val=0.0, time_type=_time_type)
param.Dynamic.time_dependent = True

# Global time_fn (param.Dynamic.time_fn) accessible via topo.sim.time
sim = Simulation()

# numbergen used to be part of topo; import it there for backwards compatibility
# and set the time function to be topo.sim.time()
import sys, numbergen

sys.modules["topo.numbergen"] = numbergen
sys.modules["topo.numbergen.basic"] = numbergen

# imagen used to be part of topo; import its files at their former locations
コード例 #2
0
try:
    import gmpy
    _time_type = gmpy.mpq
    _mpq_pickle_support()
except ImportError:
    import topo.misc.fixedpoint as fixedpoint
    param.main.warning('gmpy.mpq not available; using slower fixedpoint.FixedPoint for simulation time.')
    _time_type = fixedpoint_time_type
    # Provide a fake gmpy.mpq (to allow e.g. pickled test data to be
    # loaded).
    # CEBALERT: can we move this into whatever test needs it? I guess
    # it also has to be here to allow snapshots saved using gmpy time
    # type to open on systems where gmpy is not available.
    from topo.misc.util import gmpyImporter
    import sys
    sys.meta_path.append(gmpyImporter())

param.Dynamic.time_fn(val=0.0, time_type=_time_type)
param.Dynamic.time_dependent = True

# Global time_fn (param.Dynamic.time_fn) accessible via topo.sim.time
sim = Simulation()

# numbergen used to be part of topo; import it there for backwards compatibility
# and set the time function to be topo.sim.time()
import sys,numbergen
sys.modules['topo.numbergen']=numbergen
sys.modules['topo.numbergen.basic']=numbergen

# imagen used to be part of topo; import its files at their former locations
# for backwards compatibility and set the time function to be topo.sim.time()