当前位置: 首页>>代码示例>>Python>>正文


Python ScipyOdeSimulator.tout方法代码示例

本文整理汇总了Python中pysb.simulator.ScipyOdeSimulator.tout方法的典型用法代码示例。如果您正苦于以下问题:Python ScipyOdeSimulator.tout方法的具体用法?Python ScipyOdeSimulator.tout怎么用?Python ScipyOdeSimulator.tout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pysb.simulator.ScipyOdeSimulator的用法示例。


在下文中一共展示了ScipyOdeSimulator.tout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_simres_dataframe

# 需要导入模块: from pysb.simulator import ScipyOdeSimulator [as 别名]
# 或者: from pysb.simulator.ScipyOdeSimulator import tout [as 别名]
def test_simres_dataframe():
    """ Test SimulationResult.dataframe() """

    # We don't currently have a Simulator which does multiple simulations at
    # a time, so we fake it to test SimulationResult.dataframe()
    tspan1 = np.linspace(0, 100, 100)
    tspan2 = np.linspace(50, 100, 50)
    tspan3 = np.linspace(100, 150, 100)
    model = tyson_oscillator.model
    sim = ScipyOdeSimulator(model, integrator='lsoda')
    simres1 = sim.run(tspan=tspan1)
    # Check retrieving a single simulation dataframe
    df_single = simres1.dataframe

    # Generate multiple trajectories
    trajectories1 = simres1.species
    trajectories2 = sim.run(tspan=tspan2).species
    trajectories3 = sim.run(tspan=tspan3).species

    # Try a simulation result with two different tspan lengths
    sim.tout = [tspan1, tspan2]
    simres = SimulationResult(sim, [trajectories1, trajectories2])
    df = simres.dataframe

    assert df.shape == (len(tspan1) + len(tspan2),
                        len(model.species) + len(model.observables))

    # Next try a simulation result with two identical tspan lengths, stacked
    # into a single 3D array of trajectories
    sim.tout = [tspan1, tspan3]
    simres2 = SimulationResult(sim, np.stack([trajectories1, trajectories3]))
    df2 = simres2.dataframe

    assert df2.shape == (len(tspan1) + len(tspan3),
                         len(model.species) + len(model.observables))
开发者ID:,项目名称:,代码行数:37,代码来源:


注:本文中的pysb.simulator.ScipyOdeSimulator.tout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。