### myokit video command syntax and examples Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Commands for the myokit video tool. The first shows the general syntax, the second a concrete example converting results.zip to movie.mp4, and the third displays the full syntax help. ```bash $ myokit video -dst ``` ```bash $ myokit video results.zip membrane.V -dst movie.mp4 ``` ```bash $ myokit video --help ``` -------------------------------- ### myokit opencl example output Source: https://myokit.readthedocs.io/en/stable/cmd/system.html Example output of the myokit opencl command, showing platform and device details. ```text Platform 0 Current id : 22734896 Name : Intel(R) OpenCL Vendor : Intel(R) Corporation Version : OpenCL 1.2 LINUX Profile : FULL_PROFILE Extensions : cl_khr_fp64 cl_khr_icd Devices : Device 0 Current id : 21277656 Name : Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz Vendor : Intel(R) Corporation Version : OpenCL 1.2 (Build 67279) Driver : 1.2 Clock speed : 2500 MHz Global memory : 7870 MB Local memory : 32 KB Constant memory : 128 KB Max work groups : 1024 Max work items : [1024, 1024, 1024] Max param size : 3840 bytes ``` -------------------------------- ### Example output of myokit version Source: https://myokit.readthedocs.io/en/stable/cmd/system.html Example output of the `myokit version` command, showing the version number with decorative ASCII art. ```text Myokit version 1.21.0 |/\ _______________________________| |______ ``` -------------------------------- ### myokit import: syntax and examples Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Imports a model definition or protocol using any available importer. The syntax is shown, followed by examples with and without an output file. If no output file is specified, the generated mmt file is printed to the screen. ```bash $ myokit import -o ``` ```bash $ myokit import cellml example.cellml ``` ```bash $ myokit import cellml example.cellml test.mmt ``` -------------------------------- ### start() Source: https://myokit.readthedocs.io/en/stable/api_simulations/Protocol.html Returns the time this event starts. ```APIDOC ## start() ### Description Returns the time this event starts. ### Method N/A (method call) ### Endpoint N/A ### Parameters None ### Returns Start time (number) ``` -------------------------------- ### Install shortcut icons with myokit icons Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Installs shortcut icons on Linux or Windows. On Linux, also creates the .mmt mime-type and registers Myokit to handle .mmt and other file types. ```bash $ myokit icons ``` -------------------------------- ### Run myokit compiler Source: https://myokit.readthedocs.io/en/stable/cmd/system.html Tests the locally installed compiler by compiling a small test module that queries the system for the installed compiler. ```bash $ myokit compiler ``` -------------------------------- ### myokit export: syntax and examples Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Exports an mmt file using any available exporter. The syntax is shown, followed by examples for converting to CellML and creating runnable C code. ```bash $ myokit export ``` ```bash $ myokit export cellml example.mmt example.cellml ``` ```bash $ myokit export ansic example.mmt example_in_c ``` -------------------------------- ### Voltage clamp protocol using the 'next' keyword Source: https://myokit.readthedocs.io/en/stable/_sources/syntax/protocol.rst.txt Rewrites the voltage clamp example using 'next' to denote the start time as the end of the previous event. Times specified with 'next' are rounded to 9 digits to avoid floating point summation errors. ```myokit [[protocol]] #level start length period multiplier -80 0 500 0 0 40 next 500 0 0 -80 next 1000 1000 0 ``` -------------------------------- ### keys() example: log entries Source: https://myokit.readthedocs.io/en/stable/api_simulations/DataLog.html Example log entries for keys(). The iterator produces keys in the order shown, with the second index changing fastest. ```text 0.0.membrane.V 1.0.membrane.V 0.1.membrane.V 1.1.membrane.V 0.2.membrane.V 1.2.membrane.V ``` -------------------------------- ### myokit compiler Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Tests the local compiler installation by compiling a small test module that queries the system for the installed compiler. ```APIDOC ## `myokit compiler` ### Description Tests the local compiler installation by compiling a small test module that queries the system for the installed compiler. ### Usage ``` myokit compiler [--debug] ``` ### Options - `--debug` (optional) - Provides more information if compilation is unsuccessful. ### Example ``` $ myokit compiler ``` ### Example Output ``` Compilation successful. Found: GCC 11.2.1 ``` ``` -------------------------------- ### ProgressPrinter output example Source: https://myokit.readthedocs.io/en/stable/api_simulations/LongSimulations.html Example of the output printed to stdout by ProgressPrinter during a simulation. Shows the elapsed time, percentage done, and estimated remaining time. ```text [8.9 minutes] 71.7 % done, estimated 4.2 minutes remaining ``` -------------------------------- ### Run Myokit command line utility Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/index.rst.txt Two equivalent ways to launch the Myokit command line utility: using the Python module invocation or the installed script. The first works from the myokit directory, the second from anywhere if Myokit was installed with pip or setup.py. ```bash $ python -m myokit ``` ```bash $ myokit ``` -------------------------------- ### myokit.OpenCL.info(formatted=False) Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Static method to query the OpenCL installation for available platforms and devices. ```APIDOC ## myokit.OpenCL.info(formatted=False) ### Description Queries the OpenCL installation for the available platforms and devices and returns a `myokit.OpenCLInfo` object. If `formatted=True` is set, a formatted version of the information is returned instead. ### Method Static method ### Signature `myokit.OpenCL.info(formatted=False)` ### Parameters - **formatted** (bool) - Optional - If `True`, a formatted string version of the information is returned instead of an `OpenCLInfo` object. ### Returns - **myokit.OpenCLInfo** - Information about all available OpenCL platforms and devices. - **str** - Formatted string version of the information if `formatted=True`. ``` -------------------------------- ### size() examples: log entries and resulting sizes Source: https://myokit.readthedocs.io/en/stable/api_simulations/DataLog.html Examples for size(). The first two show that size is the number of entries, not the maximum index. The third shows a two-dimensional size (2,3). The last shows a global variable with size (). ```text 0.membrane.V 1.membrane.V 2.membrane.V ``` ```text 0.membrane.V 10.membrane.V 20.membrane.V ``` ```text 0.0.membrane.V 0.1.membrane.V 0.2.membrane.V 1.0.membrane.V 1.1.membrane.V 1.2.membrane.V ``` ```text engine.time ``` -------------------------------- ### myokit.OpenCL.selection_info() Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Static method to get a list of platform/device combinations for selection. ```APIDOC ## myokit.OpenCL.selection_info() ### Description Returns a list of platform/device combinations along with information allowing the user to select one. The returned output is a list of tuples, where each tuple has the form `(platform_name, device_name, specs)`. A preferred device can be selected by passing one of the returned `platform_name, device_name` combinations to `OpenCL.set_preferred_device()`. ### Method Static method ### Signature `myokit.OpenCL.selection_info()` ### Parameters None ### Returns - **list** - A list of tuples `(platform_name, device_name, specs)`. ``` -------------------------------- ### Launch log command Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Launches the Myokit DataLog Viewer. Example usage without arguments. ```console $ myokit log ``` -------------------------------- ### Launch block command Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Launches the DataBlock Viewer. Example usage without arguments. ```console $ myokit block ``` -------------------------------- ### Example log output for a 3-cell simulation Source: https://myokit.readthedocs.io/en/stable/api_simulations/Simulation1d.html Example output log structure when running a 3-cell simulation with the given log arguments. Time-bound variables are logged globally, while per-cell variables are prefixed with the cell index. ```python { 'engine.time' : [...], '0.membrane.V' : [...], '1.membrane.V' : [...], '2.membrane.V' : [...], } ``` -------------------------------- ### Debug overview example: a = 10, b = 5 * a, c = b^2 Source: https://myokit.readthedocs.io/en/stable/_sources/guide/exploring.rst.txt Shows the output of the Ctrl-D debug feature when the cursor points at a variable. The example uses a = 10, b = 5 * a, and c = b^2, and the debug overview for c displays the expressions used to evaluate it. ```text a = 10 b = 5 * a c = b^2 ``` -------------------------------- ### walk() example output Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Shows the depth-first traversal order of the expression tree for `5 + (2 * sqrt(x))`, as returned by the walk() method. The output lists each node in the order visited. ```text 5 + (2 * sqrt(x)) 1) Plus 2) Number(5) 3) Multiply 4) Number(2) 5) Sqrt 6) Name(x) ``` -------------------------------- ### Benchmarker usage example Source: https://myokit.readthedocs.io/en/stable/api_core/tools.html Creates a Benchmarker, runs a simulation, prints the elapsed time, resets the timer, runs again, and prints a formatted time string. ```python m,p,x = myokit.load('example') s = myokit.Simulation(m, p) b = myokit.tools.Benchmarker() s.run() print(b.time()) b.reset() s.run() print(b.format()) ``` -------------------------------- ### Example output of myokit opencl-select Source: https://myokit.readthedocs.io/en/stable/cmd/system.html Shows the output produced by the opencl-select command, including the current selection and a list of available devices with a prompt to select one. ```text Loading Myokit... ====================================================================== Myokit OpenCL device selection ====================================================================== Selected platform: No preference Selected device : No preference ====================================================================== Available devices: ---------------------------------------------------------------------- (1) Select automatically. ---------------------------------------------------------------------- (2) Platform: NVIDIA CUDA Device: GeForce GT 640 901 MHz, 3.9 GB global, 48.0 KB local, 64.0 KB const ---------------------------------------------------------------------- Please select an OpenCL device by typing 1 or 2 Leave blank to keep current selection. Select device: ``` -------------------------------- ### myokit video: generate movies from DataBlock files Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Generates movies from DataBlock1d or DataBlock2d files. Requires moviepy to be installed. The syntax is shown, followed by an example command. ```bash $ myokit video -dst ``` ```bash $ myokit video results.zip membrane.V -dst movie.mp4 ``` -------------------------------- ### Pseudocode for if statement Source: https://myokit.readthedocs.io/en/stable/syntax/model.html Shows the equivalent pseudocode for the `if` function example above. ```pseudocode if V < -50 then x = 0.2 * exp((V - 12) / 4.7) else x = 0.5 * exp((V + 19) / 1.2) ``` -------------------------------- ### myokit compare --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the compare tool. ```bash $ myokit compare --help ``` -------------------------------- ### Check unit conversion with myokit.lib.multi.unit Source: https://myokit.readthedocs.io/en/stable/api_library/multi.html Shows how to use multi.unit to check if a variable's unit can be converted to a target unit and get the conversion factor. In this example, a millivolt is converted to volts, yielding 0.001. Raises myokit.IncompatibleModelError if conversion is not possible. ```python >>> import myokit >>> import myokit.lib.multi as multi >>> m,p,x = myokit.load('example') >>> print(multi.unit(m.label('membrane_potential'), myokit.units.V)) 0.001 ``` -------------------------------- ### Show step help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Displays the full syntax for the step command. ```bash $ myokit step --help ``` -------------------------------- ### Analytical simulation example with myokit.lib.markov Source: https://myokit.readthedocs.io/en/stable/api_library/markov.html Shows how to create a LinearModel from a Myokit model component, create an AnalyticalSimulation, set the membrane potential, run a simulation, and plot the results. Requires a Myokit model file 'clancy-1999.mmt'. ```python import myokit import myokit.lib.markov as markov # Create a linear markov model m = myokit.load_model('clancy-1999.mmt') m = markov.LinearModel.from_component(m.get('ina')) # Create an analytical simulation object s = markov.AnalyticalSimulation(m) # Run a simulation s.set_membrane_potential(-30) d = s.run(10) # Show the results import matplotlib.pyplot as plt plt.figure() plt.subplot(211) for state in m.states(): plt.plot(d.time(), d[state], label=state) plt.legend(loc='center right') plt.subplot(212) plt.plot(d.time(), d[m.current()]) plt.show() ``` -------------------------------- ### Pseudocode for piecewise statement Source: https://myokit.readthedocs.io/en/stable/syntax/model.html Shows the equivalent pseudocode for the `piecewise` example above. ```pseudocode if V < -50 then x = 0.2 * exp((V - 12) / 4.7) else if V < 0 then x = 0.5 * exp((V + 19) / 1.2) else x = 0 ``` -------------------------------- ### Using Component.get() to retrieve variables Source: https://myokit.readthedocs.io/en/stable/api_core/Component.html Shows how to use the get() method on a component to retrieve variables by name. The example loads a model, retrieves the component 'ina', then retrieves variable 'h' using a relative name. Attempting to use a fully qualified name like 'ina.h' raises a KeyError because names are relative to the component. ```python >>> import myokit >>> m = myokit.load_model('example') >>> c = m.get('ina') # Retrieves the component >>> h = c.get('h') # Retrieves the variable >>> x = c.get('ina.h') # Searches for : KeyError! Traceback (most recent call last): File "", line 1, in KeyError: 'ina' ``` -------------------------------- ### myokit import --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the import tool. ```bash $ myokit import --help ``` -------------------------------- ### myokit run --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the run tool. ```bash $ myokit run --help ``` -------------------------------- ### Show myokit ide help Source: https://myokit.readthedocs.io/en/stable/cmd/gui.html Displays the full syntax for the `ide` command. ```bash $ myokit ide --help ``` -------------------------------- ### myokit video --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the video tool. ```bash $ myokit video --help ``` -------------------------------- ### Quantity arithmetic example Source: https://myokit.readthedocs.io/en/stable/api_core/units.html Shows creating quantities from strings, dividing them, and printing the result. Also shows creating a Quantity from a myokit.Number with undefined unit, which becomes dimensionless. ```python >>> from myokit import Quantity as Q >>> a = Q('10 [pA]') >>> b = Q('5 [mV]') >>> c = a / b >>> print(c) 2 [uS] >>> from myokit import Number as N >>> d = myokit.Number(4) >>> print(d.unit()) None >>> e = myokit.Quantity(d) >>> print(e.unit()) [1] ``` -------------------------------- ### Run Myokit unit tests Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Runs Myokit's unit tests. On a successful installation, these should complete without failures. ```bash $ myokit test ``` -------------------------------- ### Plot simulation results in GUI Source: https://myokit.readthedocs.io/en/stable/_sources/guide/matplotlib.rst.txt Example script for running in the GUI: creates a simulation from the model and protocol, runs it for 1000 ms, and plots the membrane potential versus time. ```python [[script]] import myokit import matplotlib.pyplot as plt # Get model & protocol from magic methods m = get_model() p = get_protocol() # Create simulation s = myokit.Simulation(m, p) # Run simulation d = s.run(1000) # Display the result t = d['environment.t'] v = d['membrane.V'] plt.plot(t, v) plt.grid(True) plt.title('Membrane potential versus time') plt.show() ``` -------------------------------- ### PrefixPlus example Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Creates a PrefixPlus expression with a positive number and evaluates it to 10.0. ```python >>> from myokit import * >>> x = PrefixPlus(Number(10)) >>> print(x.eval()) 10.0 ``` -------------------------------- ### Example plot script for the GUI Source: https://myokit.readthedocs.io/en/stable/guide/matplotlib.html Runs a Myokit simulation in the GUI and plots the membrane potential versus time. Uses the magic methods get_model() and get_protocol(). ```python [[script]] import myokit import matplotlib.pyplot as plt # Get model & protocol from magic methods m = get_model() p = get_protocol() # Create simulation s = myokit.Simulation(m, p) # Run simulation d = s.run(1000) # Display the result t = d['environment.t'] v = d['membrane.V'] plt.plot(t, v) plt.grid(True) plt.title('Membrane potential versus time') plt.show() ``` -------------------------------- ### myokit step --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the step tool. ```bash $ myokit step --help ``` -------------------------------- ### Show import help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Displays the full syntax for the import command. ```bash $ myokit import --help ``` -------------------------------- ### Show run help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Displays the full syntax for the run command. ```bash $ myokit run --help ``` -------------------------------- ### Plus example Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Parses the expression '5 + 2' and evaluates it to 7.0. ```python >>> from myokit import * >>> x = parse_expression('5 + 2') >>> print(x.eval()) 7.0 ``` -------------------------------- ### myokit.OpenCL.current_info(formatted=False) Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Static method to get information about the currently selected or default OpenCL platform and device. ```APIDOC ## myokit.OpenCL.current_info(formatted=False) ### Description Returns a `myokit.OpenCLPlatformInfo` object for the platform and device selected by the user, or chosen as default. If `formatted=True` is set, a formatted version of the information is returned instead. ### Method Static method ### Signature `myokit.OpenCL.current_info(formatted=False)` ### Parameters - **formatted** (bool) - Optional - If `True`, a formatted string version of the information is returned instead of an `OpenCLPlatformInfo` object. ### Returns - **myokit.OpenCLPlatformInfo** - Information about the selected platform and device. - **str** - Formatted string version of the information if `formatted=True`. ``` -------------------------------- ### Show Myokit help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/index.rst.txt Displays a full overview of all available Myokit command line subcommands. ```bash $ myokit -h ``` -------------------------------- ### Example SimulationError output Source: https://myokit.readthedocs.io/en/stable/_sources/api_simulations/SimulationErrors.rst.txt Example output from a SimulationError. It shows the time and cell where the error occurred, the state before and during the error, the expression being evaluated, and the operands that caused the invalid value. ```text Encountered numerical error at t=411.054992676 in cell (55) when membrane.V=-77.0. Obtained 4 previous state(s). State before: membrane.V = -77.0 ina.m = 5.76317822560667992e-03 ina.h = 3.50723683834075928e-01 ina.j = 1.33311852812767029e-01 ica.d = 6.89173266291618347e-02 ica.f = 7.21855103969573975e-01 ik.x = 3.83078485727310181e-01 ica.Ca_i = 2.27514933794736862e-03 State during: membrane.V = nan ina.m = 5.75887179002165794e-03 ina.h = 3.50991368293762207e-01 ina.j = 1.33416950702667236e-01 ica.d = 6.88845962285995483e-02 ica.f = 7.21879780292510986e-01 ik.x = 3.83071571588516235e-01 ica.Ca_i = 2.27477238513529301e-03 Evaluating derivatives at state before... invalid value encountered in float_scalars Encountered when evaluating if(membrane.V < -100.0, 1.0, 2.837 * (exp(0.04 * (membrane.V + 77.0)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.0) / ((membrane.V + 77.0) * exp(0.04 * (membrane.V + 35.0)))) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With the following operands: (1) 0.0 (2) 0.0 And the following variables: membrane.V = -77.0 = -77.0 ``` -------------------------------- ### Show myokit opencl help Source: https://myokit.readthedocs.io/en/stable/cmd/system.html Shows the full syntax for the myokit opencl command. ```bash $ myokit opencl --help ``` -------------------------------- ### Compare two Myokit models Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Compares two Myokit models and reports differences. Example output shows missing variables and mismatched RHS. ```bash $ myokit compare model1.mmt model2.mmt ``` ```text Comparing: [1] decker-2009 [2] decker-2009 [1] Missing Variable [x] Mismatched RHS Done 2 differences found ``` -------------------------------- ### Show compare help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Displays the full syntax for the compare command. ```bash $ myokit compare --help ``` -------------------------------- ### Example log output for multi-cell simulation Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Example of the data log structure returned by the OpenCL simulation when logging 'engine.time' and 'membrane.V' for multiple cells. The cell index is prefixed to the variable name. ```python { 'engine.time' : [...], '0.membrane.V' : [...], '1.membrane.V' : [...], '2.membrane.V' : [...], } ``` -------------------------------- ### Show ide help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Displays the full syntax and options for the ``ide`` command. ```console $ myokit ide --help ``` -------------------------------- ### myokit icons Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Installs shortcut icons on Linux or Windows. On Linux, it also creates the `.mmt` mime-type and registers Myokit as a tool to handle `.mmt` and various other file types. ```APIDOC ## `myokit icons` ### Description Installs shortcut icons on Linux or Windows. On Linux, it also creates the `.mmt` mime-type and registers Myokit as a tool to handle `.mmt` and various other file types. ### Usage ``` myokit icons ``` ### Example ``` $ myokit icons ``` ``` -------------------------------- ### myokit step: evaluate derivatives at initial time Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Loads a model and evaluates the derivatives of the state variables at the initial time. The example shows the command and its output, which includes a table of state variables with initial values and derivatives. ```bash $ myokit step example.mmt ``` ```text --------------------------------------------------------------------------- Single test step Reading model from example.mmt... Model LR1991 read successfully Evaluating state vector derivatives... --------------------------------------------------------------------------- Name Initial value Derivative at t=0 --------------------------------------------------------------------------- membrane.V -8.45285999999999973e+01 -5.68008003799787276e-02 ina.m 1.69999999999999991e-03 -4.94961486033834719e-03 ina.h 9.83199999999999963e-01 9.02025299127830887e-06 ina.j 9.95484000000000036e-01 -3.70409866928434243e-04 ica.d 3.00000000000000008e-06 3.68067721821794798e-04 ica.f 1.00000000000000000e+00 -3.55010150519739432e-07 ik.x 5.70000000000000021e-03 -2.04613933160084307e-07 ica.Ca_i 2.00000000000000010e-04 -6.99430692442154227e-06 --------------------------------------------------------------------------- ``` -------------------------------- ### ids() example: log entries and returned ids Source: https://myokit.readthedocs.io/en/stable/api_simulations/DataLog.html Example log entries for a two-dimensional variable and the corresponding ids returned by ids(). The ids are tuples of indices, with the second index changing fastest. ```text 0.0.membrane.V 0.1.membrane.V 0.2.membrane.V 1.0.membrane.V 1.1.membrane.V 1.2.membrane.V ``` ```text [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)] ``` -------------------------------- ### Print system information with myokit system Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Retrieves and prints system information useful for debugging a Myokit installation, including Myokit version, Python version, OS, and installed Python packages. ```bash $ myokit system ``` ```text == System information == Myokit: 1.35.0 Python: 3.11.3 (main, May 24 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] OS: Linux (linux, posix) Linux-6.3.5-100.fc37.x86_64-x86_64-with-glibc2.36 == Python requirements == NumPy: 1.24.3 SciPy: 1.8.1 Matplotlib: 3.6.3 ConfigParser: OK Setuptools: 62.6.0 == Python extras == SymPy: 1.11.1 MoviePy: 1.0.3 ``` -------------------------------- ### Show myokit log help Source: https://myokit.readthedocs.io/en/stable/cmd/gui.html Displays the full syntax for the `log` command. ```bash $ myokit log --help ``` -------------------------------- ### Show log help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Displays the full syntax and options for the ``log`` command. ```console $ myokit log --help ``` -------------------------------- ### Capture context manager basic example Source: https://myokit.readthedocs.io/en/stable/api_core/tools.html Uses the capture context manager to redirect stdout and stderr and capture printed output. ```python with myokit.tools.capture() as a: print('This will be captured') ``` -------------------------------- ### default_state_sensitivities() Source: https://myokit.readthedocs.io/en/stable/api_simulations/Simulation.html Method to get default sensitivities. ```APIDOC ## default_state_sensitivities() ### Description Returns the default sensitivities with respect to state variables, or None if sensitivities are not enabled. ### Method default_state_sensitivities() ### Returns - **sensitivities** (object or None) - The default sensitivities, or None. ``` -------------------------------- ### Shorthand variable syntax with units, binding, label, comment Source: https://myokit.readthedocs.io/en/stable/_sources/syntax/model.rst.txt Illustrates the shorthand syntax for variable definitions. The order is: units, binding, label, and description. This example sets units to milliseconds, binds to 'time', labels as 'special', and adds a comment. ```myokit x = 15 in [ms] bind time label special : comment ``` -------------------------------- ### Pre-pace and reset simulation Source: https://myokit.readthedocs.io/en/stable/_sources/guide/simulations.rst.txt Shows how to pre-pace a simulation for 100 beats (100,000 ms) and then run two identical 1000 ms simulations from the same starting point using reset(). ```python # Run the same simulation twice import myokit m, p, x = myokit.load('example.mmt') s = myokit.Simulation(m, p) # Pre-pace for a 100 beats s.pre(100 * 1000) # Run the same simulation twice d1 = s.run(1000) s.reset() d2 = s.run(1000) ``` -------------------------------- ### myokit export --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the export tool. ```bash $ myokit export --help ``` -------------------------------- ### importers Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Function to get available importers. ```APIDOC ## importers() ### Description Returns a dict of all importers available in this module. ### Returns - `dict` - A dictionary of importers. ``` -------------------------------- ### AtfFile.filename Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the ATF filename. ```APIDOC ## filename() ### Description Returns this ATF's filename. ### Returns - `str` - The filename of the ATF file. ``` -------------------------------- ### Channel.unit Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the channel units. ```APIDOC ## unit() ### Description Returns the units this channel is in. ### Returns - `myokit.Unit` - The units of the channel. ``` -------------------------------- ### Channel.name Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the channel name. ```APIDOC ## name() ### Description Returns the name set for this channel. ### Returns - `str` - The name of the channel. ``` -------------------------------- ### Defining equations example for state and ordinary variables Source: https://myokit.readthedocs.io/en/stable/_sources/guide/model.rst.txt Shows a state variable with two defining equations (initial value and derivative) and an ordinary variable defined directly. Used to illustrate variable definitions in Myokit models. ```python # State variable, two defining equations x = 1 dot(x) = 0.5 * sqrt(x) # Ordinary variable, defined directly y = 4 * x ``` -------------------------------- ### Show myokit block help Source: https://myokit.readthedocs.io/en/stable/cmd/gui.html Displays the full syntax for the `block` command. ```bash $ myokit block --help ``` -------------------------------- ### Channel.index Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the channel index. ```APIDOC ## index() ### Description Returns the index set for this channel. ### Returns - `int` - The index of the channel. ``` -------------------------------- ### version Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the version number. ```APIDOC ## version() ### Description Returns a string representation of this file's version number. ### Returns - `str` - The version number as a string. ``` -------------------------------- ### Step with reference and initial values Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Tests with different initial values by including an additional file. ```bash $ myokit step example.mmt -ref ref_step.txt -ini ref_init.txt ``` -------------------------------- ### time_unit Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the time unit. ```APIDOC ## time_unit() ### Description Returns the time unit used in this source. ### Returns - `myokit.Unit` - The time unit. ``` -------------------------------- ### sweep_count Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the number of sweeps. ```APIDOC ## sweep_count() ### Description Returns the number of sweeps. Note that a source with zero recorded channels may still report a non-zero number of sweeps if it can provide D/A outputs. Similarly, formats like WCP can report zero sweeps but have a non-zero channel count (if no data was recorded). ### Returns - `int` - The number of sweeps. ``` -------------------------------- ### Launch Myokit IDE with myokit ide Source: https://myokit.readthedocs.io/en/stable/cmd/gui.html Launches the Myokit IDE with no arguments. ```bash $ myokit ide ``` -------------------------------- ### meta_str Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get metadata as a string. ```APIDOC ## meta_str(_show_header=False_) ### Description Returns a multi-line string with meta data about this file. The optional argument `show_header` can be used to add the full header contents to the output. ### Parameters - **show_header** (bool) - Optional - If `True`, include the full header contents. Default is `False`. ### Returns - `str` - Multi-line string with meta data. ``` -------------------------------- ### Load a file with ide Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Launches the Myokit IDE and loads the specified model file. ```console $ myokit ide br-1977.mmt ``` -------------------------------- ### state() Source: https://myokit.readthedocs.io/en/stable/api_core/Model.html Deprecated method to get the model state. ```APIDOC ## state() ### Description Deprecated method, use `initial_values(as_floats=True)` instead. ### Method state ``` -------------------------------- ### AtfFile.path Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the path to the ATF file. ```APIDOC ## path() ### Description Returns the path to this ATF file. ### Returns - `str` - The path to the ATF file. ``` -------------------------------- ### Show export help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/util.rst.txt Displays the full syntax for the export command. ```bash $ myokit export --help ``` -------------------------------- ### AtfFile.info Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get ATF header/meta data. ```APIDOC ## info() ### Description Returns this ATF's header/meta data. ### Returns - `dict` - The header/meta data. ``` -------------------------------- ### Load a file with log Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Launches the Myokit DataLog Viewer and loads the specified results file. ```console $ myokit log results.csv ``` -------------------------------- ### Channel.values Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the data axis values. ```APIDOC ## values() ### Description Returns a copy of the values on the data axis. ### Returns - `array` - A copy of the data values. ``` -------------------------------- ### Channel.times Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the time axis values. ```APIDOC ## times() ### Description Returns a copy of the values on the time axis. ### Returns - `array` - A copy of the time values. ``` -------------------------------- ### Test compiler with myokit compiler Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Compiles a small test module to verify the locally installed compiler. On success, prints 'Compilation successful. Found: GCC 11.2.1'. Use --debug for more information if compilation fails. ```bash $ myokit compiler ``` ```text Compilation successful. Found: GCC 11.2.1 ``` ```bash $ myokit compiler --debug ``` -------------------------------- ### path Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the path to the ABF file. ```APIDOC ## path() ### Description Returns the path to the underlying ABF file. ### Returns - `str` - The path to the ABF file. ``` -------------------------------- ### myokit step: test with different initial values Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Runs the step tool with both a reference file and a file containing different initial values using the -ini flag. ```bash $ myokit step example.mmt -ref ref_step.txt -ini ref_init.txt ``` -------------------------------- ### filename Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the filename of the ABF file. ```APIDOC ## filename() ### Description Returns this ABF file's filename. ### Returns - `str` - The filename of the ABF file. ``` -------------------------------- ### Create DataLog instances Source: https://myokit.readthedocs.io/en/stable/api_simulations/DataLog.html Shows three ways to create a DataLog: empty, cloning another log, and from a dictionary with a time key. ```python # Create an empty DataLog: d = myokit.DataLog() d['time'] = [1, 2, 3] d['data'] = [2, 4, 5] d.set_time_key('time') # Create a clone of d e = myokit.DataLog(d) # Create a DataLog based on a dictionary d = myokit.DataLog({'time':[1, 2, 3], 'data':[2, 4, 5]}, time='time') ``` -------------------------------- ### Typical periodic stimulus protocol Source: https://myokit.readthedocs.io/en/stable/_sources/syntax/protocol.rst.txt Defines a periodic stimulus of level 1.0, starting at t=10ms, lasting 0.5ms, with a period of 1000ms and infinite repetition (multiplier 0). The comment line shows the column order: level, start, length, period, multiplier. ```myokit [[protocol]] #level start length period multiplier 1.0 10 0.5 1000 0 ``` -------------------------------- ### myokit.OpenCL.load_selection() Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Static method to load a saved platform/device selection from disk. ```APIDOC ## myokit.OpenCL.load_selection() ### Description Loads a platform/device selection from disk and returns a tuple `(platform, device)`. Each entry in the tuple is either a string with the platform/device name, or `None` if no preference was set. ### Method Static method ### Signature `myokit.OpenCL.load_selection()` ### Parameters None ### Returns - **tuple** - A tuple `(platform, device)` where each entry is a string with the platform/device name or `None`. ``` -------------------------------- ### Show block help Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Displays the full syntax and options for the ``block`` command. ```console $ myokit block --help ``` -------------------------------- ### View a file with block Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/gui.rst.txt Launches the DataBlock Viewer and loads the specified results file. ```console $ myokit block results.zip ``` -------------------------------- ### LinearModel.default_state Source: https://myokit.readthedocs.io/en/stable/api_library/markov.html Method to get the default state values of the LinearModel. ```APIDOC ## LinearModel.default_state ### Description Returns this markov model's default state values. ### Method `default_state()` ### Returns - **dict** - The default state values. ``` -------------------------------- ### Launch DataBlock Viewer with myokit block Source: https://myokit.readthedocs.io/en/stable/cmd/gui.html Launches the DataBlock Viewer with no arguments. ```bash $ myokit block ``` -------------------------------- ### LinearModel.default_parameters Source: https://myokit.readthedocs.io/en/stable/api_library/markov.html Method to get the default parameter values of the LinearModel. ```APIDOC ## LinearModel.default_parameters ### Description Returns this markov model's default parameter values. ### Method `default_parameters()` ### Returns - **dict** - The default parameter values. ``` -------------------------------- ### Launch DataLog Viewer with myokit log Source: https://myokit.readthedocs.io/en/stable/cmd/gui.html Launches the Myokit DataLog Viewer with no arguments. ```bash $ myokit log ``` -------------------------------- ### LinearModel.current Source: https://myokit.readthedocs.io/en/stable/api_library/markov.html Method to get the current variable name of the LinearModel. ```APIDOC ## LinearModel.current ### Description Returns the name of the current variable used by this model, or None if no current variable was specified. ### Method `current()` ### Returns - **str or None** - The name of the current variable. ``` -------------------------------- ### AtfFile.myokit_log Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Deprecated method to get the time series data. ```APIDOC ## myokit_log() ### Description Deprecated alias of `log()`. ### Returns - `myokit.DataLog` - The time series data. ``` -------------------------------- ### AtfFile.meta_str Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get ATF header data as a string. ```APIDOC ## meta_str(_verbose=True_) ### Description Returns this ATF's header data as an unstructured multi-line string. Note that the `verbose` argument doesn't do anything, but provides compatibility with similar methods in other files. ### Parameters - **verbose** (bool) - Optional - Compatibility argument, does nothing. Default is `True`. ### Returns - `str` - Multi-line string with header data. ``` -------------------------------- ### AtfFile.log Source: https://myokit.readthedocs.io/en/stable/api_formats/axon.html Method to get the time series data as a DataLog. ```APIDOC ## log() ### Description Returns this file's time series data as a `myokit.DataLog`. ### Returns - `myokit.DataLog` - The time series data. ``` -------------------------------- ### myokit.And Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Documentation for the myokit.And class, representing a logical AND operation. ```APIDOC ## myokit.And ### Description True if two conditions are true: `x and y`. Both operands must be conditions. ### Constructor `myokit.And(left, right)` ### Parameters - **left** (condition) - Required - Left operand. - **right** (condition) - Required - Right operand. ### Example ``` >>> from myokit import * >>> print(parse_expression('1 == 1 and 2 == 4').eval()) False >>> print(parse_expression('1 == 1 and 4 == 4').eval()) True ``` ``` -------------------------------- ### Divide example Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Parses the expression '5 / 2' and evaluates it to 2.5. ```python >>> from myokit import * >>> x = parse_expression('5 / 2') >>> print(x.eval()) 2.5 ``` -------------------------------- ### Multiply example Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Parses the expression '5 * 2' and evaluates it to 10.0. ```python >>> from myokit import * >>> x = parse_expression('5 * 2') >>> print(x.eval()) 10.0 ``` -------------------------------- ### myokit eval --help: show full syntax Source: https://myokit.readthedocs.io/en/stable/cmd/util.html Displays the full command-line syntax for the eval tool. ```bash $ myokit eval --help ``` -------------------------------- ### Minus example Source: https://myokit.readthedocs.io/en/stable/api_core/expressions.html Parses the expression '5 - 2' and evaluates it to 3.0. ```python >>> from myokit import * >>> x = parse_expression('5 - 2') >>> print(x.eval()) 3.0 ``` -------------------------------- ### Display OpenCL configuration with myokit opencl Source: https://myokit.readthedocs.io/en/stable/_sources/cmd/system.rst.txt Displays information about the current OpenCL configuration, including platform and device details. Use --help for full syntax. ```bash $ myokit opencl ``` ```text Platform 0 Current id : 22734896 Name : Intel(R) OpenCL Vendor : Intel(R) Corporation Version : OpenCL 1.2 LINUX Profile : FULL_PROFILE Extensions : cl_khr_fp64 cl_khr_icd Devices : Device 0 Current id : 21277656 Name : Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz Vendor : Intel(R) Corporation Version : OpenCL 1.2 (Build 67279) Driver : 1.2 Clock speed : 2500 MHz Global memory : 7870 MB Local memory : 32 KB Constant memory : 128 KB Max work groups : 1024 Max work items : [1024, 1024, 1024] Max param size : 3840 bytes ``` ```bash $ myokit opencl --help ``` -------------------------------- ### from_path Source: https://myokit.readthedocs.io/en/stable/api_simulations/Simulation.html Loads a simulation from a zip file created by `Simulation`. ```APIDOC ## from_path(path) ### Description Loads a simulation from the zip file in `path`. The file at `path` must have been created by `Simulation` and on the same platform (e.g. the same operating system, processor architecture, Myokit version etc.). Note that the simulation state (e.g. time, model state, solver tolerance etc.) is not restored. Returns a `Simulation` object. ### Method Static method ### Parameters - **path** (string) - Path to the zip file containing the simulation. ### Returns A `Simulation` object. ``` -------------------------------- ### myokit.Sundials.version() Source: https://myokit.readthedocs.io/en/stable/api_simulations/Simulation.html Static method to detect the Sundials version installed on the system. ```APIDOC ## myokit.Sundials.version() ### Description Returns the detected Sundials version on this system, or None if no version of Sundials was found. ### Method static method ### Endpoint myokit.Sundials.version() ### Parameters None ### Returns - **version** (str or None) - The detected Sundials version, or None if not found. ### Example ```python version = myokit.Sundials.version() ``` ``` -------------------------------- ### Run OpenCL simulation with cell-indexed logging Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Creates an OpenCL simulation with 256 cells and runs it for 1000 time units, logging the time variable and the membrane potential. The resulting log will contain entries like '0.membrane.V', '1.membrane.V', etc., with a prefix indicating the cell index. ```python s = SimulationOpenCL(m, p, ncells=256) d = s.run(1000, log=['engine.time', 'membrane.V'] ``` -------------------------------- ### time Source: https://myokit.readthedocs.io/en/stable/api_simulations/SimulationOpenCL.html Method to get the current simulation time of a SimulationOpenCL simulation. ```APIDOC ## time() ### Description Returns the current simulation time. ### Method time ### Returns - **float** - The current simulation time in milliseconds. ```