-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(python) Extend steadystate python-interface example | ci(python) F…
…ixes #348 (#349) * doc(python) Extend steadystate python-interface example * feature(python) Add basic plotting functions * ci(python) python3 instead of python3.6 * ci() Disallow failure on osx; update python path * doc(python) make doxygen compatible * ci(osx) add tex path
- Loading branch information
Showing
5 changed files
with
1,194 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""@package amici.plotting Plotting related functions""" | ||
|
||
import matplotlib.pyplot as plt | ||
|
||
def plotStateTrajectories(rdata, state_indices=None, ax = None): | ||
"""Plot state trajectories | ||
Arguments: | ||
rdata: AMICI simulation results as returned by amici.getSimulationResults() | ||
state_indices: Indices of states for which trajectories are to be plotted | ||
ax: matplotlib.axes.Axes instance to plot into | ||
Returns: | ||
Raises: | ||
""" | ||
if not ax: | ||
fig, ax = plt.subplots() | ||
if not state_indices: | ||
state_indices = range(rdata['x'].shape[1]) | ||
for ix in state_indices: | ||
ax.plot(rdata['t'], rdata['x'][:, ix], label='$x_%d$' % ix) | ||
ax.set_xlabel('$t$ (s)') | ||
ax.set_ylabel('$x_i(t)$ (mmol/ml)') | ||
ax.legend() | ||
ax.set_title('State trajectories') | ||
|
||
|
||
def plotObservableTrajectories(rdata, observable_indices=None, ax = None): | ||
"""Plot observable trajectories | ||
Arguments: | ||
rdata: AMICI simulation results as returned by amici.getSimulationResults() | ||
observable_indices: Indices of observables for which trajectories are to be plotted | ||
ax: matplotlib.axes.Axes instance to plot into | ||
Returns: | ||
Raises: | ||
""" | ||
if not ax: | ||
fig, ax = plt.subplots() | ||
if not observable_indices: | ||
observable_indices = range(rdata['y'].shape[1]) | ||
for iy in observable_indices: | ||
ax.plot(rdata['t'], rdata['y'][:, iy], label='$y_%d$' % iy) | ||
ax.set_xlabel('$t$ (s)') | ||
ax.set_ylabel('$y_i(t)$ (AU)') | ||
ax.legend() | ||
ax.set_title('Observables') |
Oops, something went wrong.