tellurium package

Subpackages

Submodules

tellurium.tellurium module

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.DumpJSONInfo()[source]

Tellurium dist info. Goes into COMBINE archive.

tellurium.tellurium.RoadRunner(*args)[source]
tellurium.tellurium.VersionDict()[source]

Return dict of version strings.

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 libcombine.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.antimonyTosbml(ant)[source]
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.custom_plot(x, y, min_y, max_y, label_name, **kwargs)[source]
tellurium.tellurium.disablePlotting()[source]
tellurium.tellurium.distributed_parameter_scanning(sc, list_of_models, function_name, antimony='antimony')[source]
tellurium.tellurium.distributed_sensitivity_analysis(sc, senitivity_analysis_model, calculation=None)[source]
tellurium.tellurium.distributed_stochastic_simulation(sc, stochastic_model_object, num_simulations, model_type='antimony')[source]
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.getAppDir()[source]
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.getLastReport()[source]

Get the last report generated by SED-ML.

tellurium.tellurium.getPlottingEngine(engine=None)[source]
tellurium.tellurium.getPlottingEngineFactory(engine=None)[source]
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.perform_sampling(mesh)[source]
tellurium.tellurium.plotArray(result, loc='upper right', legendOutside=False, 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 (bool) – 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’ |

  • legendOutside= – Set to true if you want the legend outside the axies

  • 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…

If you wish to set the figure size, called plt.figure (figsize=(w,h)) before calling plotArray

import numpy as np, tellurium as te
import matplotlib.pyplot as plt
result = np.array([[1,2,3], [7.2,6.5,8.8], [9.8, 6.5, 4.3]])
plt.figure (figsize=(10,6))
te.plotArray(result, title="My graph", xlim=((1, 5)), labels=["Label 1", "Label 2"],
             yscale='log', linestyle='dashed')
tellurium.tellurium.plotImage(img)[source]
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.plot_distributed_stochastic(plot_data)[source]
tellurium.tellurium.plot_stochastic_result(result)[source]
tellurium.tellurium.printVersionInfo()[source]

Prints version information for tellurium included packages.

see also: getVersionInfo()

tellurium.tellurium.sample_plot(result)[source]
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’.

tellurium.tellurium.setLastReport(report)[source]

Used by SED-ML to save the last report created (for validation).

tellurium.tellurium.setSavePlotsToPDF(value)[source]

Sets whether plots should be saved to PDF.

tellurium.temiriam module

Helper functions for MIRIAM and identifiers.org.

tellurium.temiriam.getSBMLFromBiomodelsURN(urn)[source]

Get SBML string from given BioModels URN.

Searches for a BioModels identifier in the given urn and retrieves the SBML from biomodels. For example:

Handles redirects of the download page.

Parameters:

urn

Returns:

SBML string for given model urn

tellurium.testcases module

tellurium.testcases.getSupportedTestCases(begin=None, end=None)[source]

Returns the supported SBML test cases between begin and end. Compatibility taken from roadrunner.

Module contents

Tellurium API definition.

The API functions are made available via imports from the respective packages and modules.