Skip to content

Models

Core data model classes for representing VCell biomodels.

Biomodel

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

Model

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

Species

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

Compartment

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

Reaction

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

Kinetics

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

KineticsParameter

Bases: Parameter

handler: python options: show_source: false show_signature_annotations: true members_order: source

ModelParameter

Bases: Parameter

handler: python options: show_source: false show_signature_annotations: true members_order: source

Geometry

Bases: VcmlNode

to_segmented_image(resolution: int = 50) -> SegmentedImageGeometry

Build a :class:SegmentedImageGeometry from this geometry.

Parameters:

Name Type Description Default
resolution int

Number of grid points along each axis (analytic geometries only).

50

plot(resolution: int = 50, save_path: str | None = None) -> None

Render the geometry using PyVista.

Parameters:

Name Type Description Default
resolution int

Number of grid points along each axis.

50
save_path str | None

If provided, save the figure to this path before showing.

None

to_cartesian_mesh(mesh_size: tuple[int, int, int] | None = None, resolution: int = 50) -> CartesianMesh

Generate the VCell finite-volume :class:CartesianMesh for this geometry.

Convenience wrapper around :func:pyvcell.vcml.cartesian_mesh_from_geometry; requires the native and solver extras (libvcell + pyvcell-fvsolver).

handler: python options: show_source: false show_signature_annotations: true members_order: source

SubVolume

Bases: GeometryClass

handler: python options: show_source: false show_signature_annotations: true members_order: source

SubVolumeType

Bases: StrEnum

handler: python options: show_source: false show_signature_annotations: true members_order: source

SurfaceClass

Bases: GeometryClass

handler: python options: show_source: false show_signature_annotations: true members_order: source

Image

Bases: VcmlNode

ndarray_3d_u8: NDArray3Du8 property

Decompress and return the image as a (Z, Y, X) uint8 array.

from_ndarray_3d_u8(ndarray_3d_u8: NDArray3Du8, name: str) -> Image staticmethod

Create an Image from a (Z, Y, X) uint8 numpy array.

handler: python options: show_source: false show_signature_annotations: true members_order: source

Application

Bases: VcmlNode

map_species(species: Species | str, init_conc: float | str, diff_coef: float, *, force_continuous: bool = False, init_count: float | str | None = None) -> SpeciesMapping

Map a species into this application.

In a stochastic (Application.stochastic) spatial application, species become Smoldyn particles unless force_continuous is set, which keeps them as PDE fields (a PDE/particle hybrid model). init_count sets a particle species' initial molecule count instead of init_conc.

get_species_mapping(species_name: str) -> SpeciesMapping

Get a species mapping by name.

add_event(name: str, trigger: str, assignments: dict[str, str | float], delay: str | float | None = None, use_values_from_trigger_time: bool = True) -> Event

Add an event that fires on each rising edge of trigger (a condition such as "S1 < 5.0") and, after delay if given, sets each variable in assignments to its expression.

add_ode_sim(name: str, duration: float, output_time_step: float, solver: str = COMBINED_SUNDIALS_SOLVER, absolute_tolerance: float = 1e-09, relative_tolerance: float = 1e-07, max_time_step: float = 0.1) -> Simulation

Add a non-spatial simulation for one of VCell's Sundials ODE solvers (CVODE, IDA, or the default Combined IDA/CVODE, which picks IDA when the math has fast systems), saving every output_time_step. Run it with :func:pyvcell.vcml.simulate_ode. The application must be non-spatial (geometry dimension 0).

add_hybrid_sim(name: str, duration: float, output_time_step: float, mesh_size: tuple[int, int, int], time_step: float, options: SmoldynSimulationOptions | None = None) -> Simulation

Add a simulation for VCell's spatial PDE/particle hybrid solver (finite volume + Smoldyn).

The application must be stochastic with at least one force_continuous species (the fields) and at least one particle species. output_time_step should be a multiple of time_step.

set_moving_boundary_front(velocity_x: float | str = 0.0, velocity_y: float | str = 0.0, velocity_z: float | str = 0.0, surface_name: str | None = None) -> FrontVelocity

Declare the prescribed velocity of the moving-boundary front.

The front is the geometry surface that separates the two subvolumes of a moving-boundary model. The velocity components are VCell expressions in space (x, y, z), time (t), and the volume species. When surface_name is omitted, the geometry's single surface class is used.

add_moving_boundary_sim(name: str, duration: float, output_time_step: float, mesh_size: tuple[int, int, int], options: MovingBoundarySolverOptions | None = None) -> Simulation

Add a simulation configured for the Moving Boundary solver.

Equivalent to :meth:add_sim but sets the solver to MovingB and attaches :class:MovingBoundarySolverOptions (defaults when options is None). The application must also declare a moving front via :meth:set_moving_boundary_front.

handler: python options: show_source: false show_signature_annotations: true members_order: source

Simulation

Bases: VcmlNode

A simulation of an application. Output is saved in exactly one of three ways: every output_time_step (VCML OutputTimeStep), every keep_every solver steps keeping at most keep_at_most points (VCell's default for its ODE solvers), or at the listed output_times. mesh_size is None for a non-spatial (compartmental) simulation.

is_ode: bool property

A non-spatial simulation on one of VCell's Sundials ODE solvers (see :func:pyvcell.vcml.simulate_ode).

handler: python options: show_source: false show_signature_annotations: true members_order: source

SpeciesMapping

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

BoundaryType

Bases: StrEnum

handler: python options: show_source: false show_signature_annotations: true members_order: source

SpeciesReference

Bases: VcmlNode

handler: python options: show_source: false show_signature_annotations: true members_order: source

SpeciesRefType

Bases: StrEnum

handler: python options: show_source: false show_signature_annotations: true members_order: source