API¶
Main tellurium entry point.
The module tellurium provides support routines. As part of this module an ExendedRoadRunner class is defined which provides helper methods for model export, plotting or the Jarnac compatibility layer.
-
tellurium.tellurium.
addFileToCombineArchive
(archive_path, file_name, entry_location, file_format, master, out_archive_path)[source]¶ Add a file to an existing COMBINE archive on disk and save the result as a new archive.
Parameters: - archive_path – The path to the archive.
- file_name – The name of the file to add.
- entry_location – The location to store the entry in the archive.
- file_format – The format of the file. Can use tecombine.KnownFormats.lookupFormat for common formats.
- master – Whether the file should be marked master.
- out_archive_path – The path to the output archive.
-
tellurium.tellurium.
addFilesToCombineArchive
(archive_path, file_names, entry_locations, file_formats, master_attributes, out_archive_path)[source]¶ Add multiple files to an existing COMBINE archive on disk and save the result as a new archive.
Parameters: - archive_path – The path to the archive.
- file_names – List of extra files to add.
- entry_locations – List of destination locations for the files in the output archive.
- file_format – List of formats for the resp. files.
- master_attributes – List of true/false values for the resp. master attributes of the files.
- out_archive_path – The path to the output archive.
-
tellurium.tellurium.
antimonyToCellML
(ant)[source]¶ Convert Antimony to CellML string.
Parameters: ant (str | file) – Antimony string or file Returns: CellML Return type: str
-
tellurium.tellurium.
antimonyToSBML
(ant)[source]¶ Convert Antimony to SBML string.
Parameters: ant (str | file) – Antimony string or file Returns: SBML Return type: str
-
tellurium.tellurium.
cellmlToAntimony
(cellml)[source]¶ Convert CellML to antimony string.
Parameters: cellml (str | file) – CellML string or file Returns: antimony Return type: str
-
tellurium.tellurium.
cellmlToSBML
(cellml)[source]¶ Convert CellML to SBML string.
Parameters: cellml (str | file) – CellML string or file Returns: SBML Return type: str
-
tellurium.tellurium.
colorCycle
(color, polyNumber)[source]¶ Adjusts contents of self.color as needed for plotting methods.
-
tellurium.tellurium.
convertAndExecuteCombineArchive
(location)[source]¶ Read and execute a COMBINE archive.
Parameters: location – Filesystem path to the archive.
-
tellurium.tellurium.
convertCombineArchive
(location)[source]¶ Read a COMBINE archive and convert its contents to an inline Omex.
Parameters: location – Filesystem path to the archive.
-
tellurium.tellurium.
createCombineArchive
(archive_path, file_names, entry_locations, file_formats, master_attributes, description=None)[source]¶ Create a new COMBINE archive containing the provided entries and locations.
Parameters: - archive_path – The path to the archive.
- file_names – List of extra files to add.
- entry_locations – List of destination locations for the files in the output archive.
- file_format – List of formats for the resp. files.
- master_attributes – List of true/false values for the resp. master attributes of the files.
- out_archive_path – The path to the output archive.
- description – A libcombine description structure to be assigned to the combine archive, if desired.
-
tellurium.tellurium.
executeInlineOmex
(inline_omex, comp=False)[source]¶ Execute inline phrasedml and antimony.
Parameters: inline_omex – String containing inline phrasedml and antimony.
-
tellurium.tellurium.
executeInlineOmexFromFile
(filepath)[source]¶ Execute inline OMEX with simulations described in phrasedml and models described in antimony.
Parameters: filepath – Path to file containing inline phrasedml and antimony.
-
tellurium.tellurium.
exportInlineOmex
(inline_omex, export_location)[source]¶ Export an inline OMEX string to a COMBINE archive.
Parameters: - inline_omex – String containing inline OMEX describing models and simulations.
- export_location – Filepath of Combine archive to create.
-
tellurium.tellurium.
extractFileFromCombineArchive
(archive_path, entry_location)[source]¶ Extract a single file from a COMBINE archive and return it as a string.
-
tellurium.tellurium.
getDefaultPlottingEngine
()[source]¶ Get the default plotting engine. Options are ‘matplotlib’ or ‘plotly’. :return:
-
tellurium.tellurium.
getEigenvalues
(m)[source]¶ Eigenvalues of matrix.
Convenience method for computing the eigenvalues of a matrix m Uses numpy eig to compute the eigenvalues.
Parameters: m – numpy array Returns: numpy array containing eigenvalues
-
tellurium.tellurium.
getTelluriumVersion
()[source]¶ Version number of tellurium.
Returns: version Return type: str
-
tellurium.tellurium.
getTestModel
(string)[source]¶ SBML of given test model as a string.
# load test model as SBML sbml = te.getTestModel('feedback.xml') r = te.loadSBMLModel(sbml) # simulate r.simulate(0, 100, 20)
Returns: SBML string of test model
-
tellurium.tellurium.
getVersionInfo
()[source]¶ Returns version information for tellurium included packages.
Returns: list of tuples (package, version)
-
tellurium.tellurium.
inIPython
()[source]¶ Checks if tellurium is used in IPython.
Returns true if tellurium is being using in an IPython environment, false otherwise. :return: boolean
-
tellurium.tellurium.
listTestModels
()[source]¶ List roadrunner SBML test models.
print(te.listTestModels())
Returns: list of test model paths
-
tellurium.tellurium.
loadAntimonyModel
(ant)[source]¶ Load Antimony model with tellurium.
See also:
loada()
r = te.loadAntimonyModel('S1 -> S2; k1*S1; k1=0.1; S1=10.0; S2 = 0.0')
Parameters: ant (str | file) – Antimony model Returns: RoadRunner instance with model loaded Return type: roadrunner.ExtendedRoadRunner
-
tellurium.tellurium.
loadCellMLModel
(cellml)[source]¶ Load CellML model with tellurium.
Parameters: cellml (str | file) – CellML model Returns: RoadRunner instance with model loaded Return type: roadrunner.ExtendedRoadRunner
-
tellurium.tellurium.
loadSBMLModel
(sbml)[source]¶ Load SBML model from a string or file.
Parameters: sbml (str | file) – SBML model Returns: RoadRunner instance with model loaded Return type: roadrunner.ExtendedRoadRunner
-
tellurium.tellurium.
loadTestModel
(string)[source]¶ Loads particular test model into roadrunner.
rr = te.loadTestModel('feedback.xml')
Returns: RoadRunner instance with test model loaded
-
tellurium.tellurium.
loada
(ant)[source]¶ Load model from Antimony string.
See also:
loadAntimonyModel()
r = te.loada('S1 -> S2; k1*S1; k1=0.1; S1=10.0; S2 = 0.0')
Parameters: ant (str | file) – Antimony model Returns: RoadRunner instance with model loaded Return type: roadrunner.ExtendedRoadRunner
-
tellurium.tellurium.
loads
(ant)[source]¶ Load SBML model with tellurium
See also:
loadSBMLModel()
Parameters: ant (str | file) – SBML model Returns: RoadRunner instance with model loaded Return type: roadrunner.ExtendedRoadRunner
-
tellurium.tellurium.
model
(model_name)[source]¶ Retrieve a model which has already been loaded.
Parameters: model_name (str) – the name of the model
-
tellurium.tellurium.
noticesOff
()[source]¶ Switch off the generation of notices to the user. Call this to stop roadrunner from printing warning message to the console.
See also
noticesOn()
-
tellurium.tellurium.
noticesOn
()[source]¶ Switch on notice generation to the user.
See also
noticesOff()
-
tellurium.tellurium.
plotArray
(result, loc='upper right', show=True, resetColorCycle=True, xlabel=None, ylabel=None, title=None, xlim=None, ylim=None, xscale='linear', yscale='linear', grid=False, labels=None, **kwargs)[source]¶ Plot an array.
Parameters: - result – Array to plot, first column of the array must be the x-axis and remaining columns the y-axis
- loc (str) – Location of legend box. Valid strings ‘best’ | upper right’ | ‘upper left’ | ‘lower left’ | ‘lower right’ | ‘right’ | ‘center left’ | ‘center right’ | ‘lower center’ | ‘upper center’ | ‘center’ |
- color (str) – ‘red’, ‘blue’, etc. to use the same color for every curve
- labels – A list of labels for the legend, include as many labels as there are curves to plot
- xlabel (str) – x-axis label
- ylabel (str) – y-axis label
- title (str) – Add plot title
- xlim – Limits on x-axis (tuple [start, end])
- ylim – Limits on y-axis
- xscale – ‘linear’ or ‘log’ scale for x-axis
- yscale – ‘linear’ or ‘log’ scale for y-axis
- grid (bool) – Show grid
- show – show=True (default) shows the plot, use show=False to plot multiple simulations in one plot
- resetColorCycle (bool) – If true, resets color cycle on given figure (works with show=False to plot multiple simulations on a single plot)
- kwargs – Additional matplotlib keywords like linewidth, linestyle…
import numpy as np, tellurium as te result = np.array([[1,2,3], [7.2,6.5,8.8], [9.8, 6.5, 4.3]]) te.plotArray(result, title="My graph", xlim=((1, 5)), labels=["Label 1", "Label 2"], yscale='log', linestyle='dashed')
-
tellurium.tellurium.
plotWithLegend
(r, result=None, loc='upper right', show=True)[source]¶ Plot an array and include a legend. The first argument must be a roadrunner variable. The second argument must be an array containing data to plot. The first column of the array will be the x-axis and remaining columns the y-axis. Returns a handle to the plotting object.
plotWithLegend (r)
-
tellurium.tellurium.
printVersionInfo
()[source]¶ Prints version information for tellurium included packages.
see also:
getVersionInfo()
-
tellurium.tellurium.
sbmlToAntimony
(sbml)[source]¶ Convert SBML to antimony string.
Parameters: sbml (str | file) – SBML string or file Returns: Antimony Return type: str
-
tellurium.tellurium.
sbmlToCellML
(sbml)[source]¶ Convert SBML to CellML string.
Parameters: sbml (str | file) – SBML string or file Returns: CellML Return type: str
-
tellurium.tellurium.
setDefaultPlottingEngine
(engine)[source]¶ Set the default plotting engine. Overrides current value.
Parameters: engine – A string describing which plotting engine to use. Valid values are ‘matplotlib’ and ‘plotly’.