API
Heta Compiler CLI
HetaImporter.heta_version — Function
heta_version()Returns heta-compiler version
HetaImporter.heta_help — Function
heta_help(command::Union{String, Nothing}=nothing)Displays help for heta-compiler CLI
Arguments:
command: command to display. Default isnothingto display general help
HetaImporter.heta_init — Function
heta_init(dir::String; force::Bool=false, silent::Bool=false)Creates template files for Heta-based platform in the specified directory dir
See heta compiler docs for details: https://hetalang.github.io/hetacompiler/cli-references.html#heta-init-command
Arguments:
dir: path to the directory where to create template filesforce: iftruereplace files and directoriessilent: iftrueuse default options without prompt
HetaImporter.heta_build — Function
heta_build(
target_dir::AbstractString;
declaration::String = "platform",
units_check::Bool = false,
log_mode::String = "error",
log_path::String = "build.log",
log_level::String = "info",
debug::Bool = false,
dist_dir::String = "dist",
meta_dir::String = "meta",
source::String = "index.heta",
type::String = "heta",
export_format::Union{String, Nothing} = nothing,
)Builds the models from Heta-based platform
See heta compiler docs for details: https://hetalang.github.io/hetacompiler/cli-references.html#running-heta-build-with-options
Arguments:
target_dir: path to the directory where Heta platform is locateddeclaration: filepath to the platform declaration file. Default is"platform"units_check: if set totrueunits will be checked for the consistencylog_mode: log mode. Default is"error"log_path: path to the log file. Default is"build.log"log_level: log level to display. Default is"info"debug: turn on debug mode. Default isfalsedist_dir: directory path, where to write distributives to. Default is"dist"meta_dir: meta directory path. Default is"meta"source: path to the main heta module. Default is"index.heta"type: type of the source file. Default is"heta"export_format: export the model to the specified format:julia,dynms,{format:SBML,version:L3V1}
Julia File Generation
HetaImporter.build_dynms_file — Function
build_dynms_file(heta_dir; build_dir, kwargs...)Build a Heta platform and write a DynMS JSON file to joinpath(build_dir, DYNMS_MODEL_DIR, DYNMS_MODEL_NAME).
The returned value is the generated DynMS JSON file path.
Arguments:
heta_dir: path to a Heta source directory containing a platform declaration filebuild_dir: directory path where generated files are written. Default isjoinpath(heta_dir, "dist")spaceFilter: filter for namespaces in the Heta model. Can be a string, a vector of symbols, ornothing. Default isnothing- kwargs : other arguments supported by
heta_build
HetaImporter.build_julia_file — Function
build_julia_file(heta_dir; build_dir, ir_format=:julia, kwargs...)Build a Heta platform and write a Julia source file to joinpath(build_dir, JULIA_MODEL_DIR, JULIA_MODEL_NAME).
heta-compiler writes Julia code directly. The only supported ir_format is :julia. To construct a native HetaODESystem, use import_heta.
The returned value is the generated Julia file path.
Arguments:
heta_dir: path to a Heta source directory containing a platform declaration fileir_format: compiler export format. Only:juliais supported.build_dir: directory path where generated files are written. Default isjoinpath(heta_dir, "dist")spaceFilter: filter for namespaces in the Heta model. Can be a string, a vector of symbols, ornothing. Default isnothing- kwargs : other arguments supported by
heta_build
Advanced: Heta Parsing
HetaImporter.parse_heta — Function
parse_heta(heta_dir; build_dir, kwargs...)Parse Heta models into a DynMSModelSet. Additional keyword arguments are forwarded to build_dynms_file.
Advanced: DynMS Parsing
HetaImporter.parse_dynms — Function
parse_dynms(dynms_json::AbstractString)
parse_dynms(data::AbstractDict)Parse a DynMS JSON file or already-loaded JSON dictionary into a DynMSModelSet.
The returned specification contains parsed model definitions, Julia expression trees for mathematical expressions, event definitions, and metadata from the DynMS generator.
HetaImporter.parse_dynms_model — Function
parse_dynms_model(model::AbstractDict)Parse one DynMS model dictionary into a DynMSModel.
This is mainly useful when working with a model entry extracted from a DynMS document. For normal use, prefer parse_dynms.
Heta Import and ODE Construction
HetaImporter.import_heta — Function
import_heta(heta_dir; model_id=nothing, write_to_file=false,
filename=nothing, kwargs...)Compile a Heta project, parse it, and lower the selected model to a native HetaODESystem. Remaining keyword arguments are forwarded to parse_heta.
HetaImporter.import_heta_all — Function
import_heta_all(heta_dir; write_to_file=false, output_dir=".", kwargs...)Compile a Heta project and return every model as an OrderedDict{Symbol,<:HetaODESystem} keyed by model ID. Remaining keyword arguments are forwarded to parse_heta.
When write_to_file=true, readable generated code is written to <output_dir>/<model_id>_ode.jl for each system.
HetaImporter.HetaODESystem — Type
HetaODESystemNative Julia representation of a parsed Heta ODE model. dynms retains the semantic model for inspection and generated_code contains the fixed, uncompiled Julia functions generated once by build_ode_system.
parameter_index indexes the complete flattened parameter container (tunables, derived, then discretes). discrete_index indexes only the discrete portion and is also used as its parameter-timeseries index.
HetaImporter.HetaParameters — Type
HetaParameters(tunable, nderived, ndiscrete, initialize_parameters!)Runtime parameter storage used by the native Julia backend. tunable contains the flat values exposed to optimizers, derived contains values recalculated from tunables at the start of a solve, and discrete contains values that callbacks may mutate during integration.
initialize_parameters!(derived, discrete, tunable) is generated with the model. It is called by the constructor and whenever the Tunable portion is replaced. Replacing only the Discrete portion restores values saved during a simulation without reinitializing them.
HetaImporter.build_ode_system — Function
build_ode_system(model; write_to_file=false, filename=nothing)
build_ode_system(model_set; model_id, kwargs...)Lower a parsed DynMS model to a native HetaODESystem.
When write_to_file=true, readable Julia source for the resulting system is also written to filename.
HetaImporter.write_generated_code — Function
write_generated_code(system, filename)Write the fixed native Julia functions stored in system.generated_code to a readable source file. No code is regenerated.
HetaImporter.equations — Function
Return the state derivative expressions of system, keyed by state name.
HetaImporter.initial_conditions — Function
Return the state initial-condition expressions of system.
HetaImporter.parameters — Function
Return the tunable defaults and derived/discrete initialization expressions.
HetaImporter.observed — Function
Return the assignment-rule expressions available as observed variables.
HetaImporter.events — Function
Return the time, continuous, discrete, and stop event definitions.