當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。