API Reference¶
Auto-generated from source docstrings. For narrative usage examples see Advanced Features.
PhysiCellConfig¶
PhysiCellConfig
¶
Main PhysiCell configuration class using modular composition.
This class provides a single interface for building PhysiCell XML configurations while delegating functionality to specialized modules for maintainability.
from_xml
classmethod
¶
Create PhysiCellConfig instance from XML file.
Args: filename: Path to PhysiCell XML configuration file
Returns: New PhysiCellConfig instance with loaded configuration
Example: config = PhysiCellConfig.from_xml("PhysiCell_settings.xml")
from_xml_string
classmethod
¶
Create PhysiCellConfig instance from XML string.
Args: xml_content: XML configuration as string
Returns: New PhysiCellConfig instance with loaded configuration
load_xml
¶
Load XML configuration into existing instance.
Args: filename: Path to XML file merge: If True, merge with existing config. If False, replace.
validate_xml_file
¶
Validate that an XML file is a valid PhysiCell configuration.
Args: filename: Path to XML file to validate
Returns: Tuple of (is_valid, error_message)
load_xml_string
¶
Load XML from string into existing instance.
Args: xml_content: XML configuration as string merge: If True, merge with existing config. If False, replace.
copy
¶
Create deep copy of configuration.
Returns: New PhysiCellConfig instance with identical configuration
add_user_parameter
¶
add_user_parameter(name: str, value: Any, units: str = 'dimensionless', description: str = '', parameter_type: str = 'double') -> None
Add a user parameter.
set_number_of_cells
¶
Set the number of cells for initial placement.
Args: count: Number of cells to place initially for each cell type. Set to 0 if using custom cell.csv file for initial conditions.
setup_basic_simulation
¶
setup_basic_simulation(x_range: Tuple[float, float] = (-500, 500), y_range: Tuple[float, float] = (-500, 500), mesh_spacing: float = 20.0, max_time: float = 8640.0) -> None
Setup a basic simulation with common parameters.
add_simple_substrate
¶
add_simple_substrate(name: str, diffusion_coeff: float = 1000.0, decay_rate: float = 0.1, initial_value: float = 0.0) -> None
Add a simple substrate with common parameters.
add_simple_cell_type
¶
add_simple_cell_type(name: str, secretion_substrate: str = None, secretion_rate: float = 0.0, motile: bool = False) -> None
Add a simple cell type with common parameters.
set_parallel_settings
¶
Set parallel processing settings.
Modules¶
CellTypeModule¶
CellTypeModule
¶
Bases: BaseModule
Manage multiple cell types and their phenotypes.
add_cell_type
¶
Create a new cell type entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique identifier for the cell type. |
required |
parent_type
|
str
|
Name of the parent type to inherit from, usually |
'default'
|
template
|
str
|
Template key from |
'default'
|
set_cycle_model
¶
Assign a predefined cell cycle model to cell_type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type to modify. |
required |
model
|
str
|
One of the models available via :func: |
required |
set_cycle_transition_rate
¶
Set a specific transition rate between cycle phases.
set_cycle_phase_durations
¶
Set cycle phase durations for a cell type.
This clears any transition rates so the XML output uses
<phase_durations> instead of <phase_transition_rates>.
Both formats are valid in PhysiCell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type to modify. |
required |
durations
|
list
|
List of dicts, each with keys |
required |
Example
config.cell_types.set_cycle_phase_durations('default', [ ... {'index': 0, 'duration': 300.0, 'fixed_duration': False}, ... {'index': 1, 'duration': 480.0, 'fixed_duration': True}, ... {'index': 2, 'duration': 240.0, 'fixed_duration': True}, ... {'index': 3, 'duration': 60.0, 'fixed_duration': True}, ... ])
set_death_rate
¶
Set death rate for a cell type.
set_death_parameters
¶
Set death model sub-parameters for a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
death_type
|
str
|
|
required |
**params
|
Keyword arguments corresponding to death model parameter names.
Valid keys: |
{}
|
Example
config.cell_types.set_death_parameters('default', 'necrosis', ... unlysed_fluid_change_rate=0.05, ... cytoplasmic_biomass_change_rate=0.0166667, ... )
set_death_phase_durations
¶
Set death model phase durations (removes any phase_transition_rates).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
death_type
|
str
|
|
required |
durations
|
list
|
List of dicts with |
required |
Example
config.cell_types.set_death_phase_durations('Treg', 'apoptosis', [ ... {'index': 0, 'duration': 0.0, 'fixed_duration': True}, ... ])
set_death_phase_transition_rates
¶
Set death model phase transition rates (removes any phase_durations).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
death_type
|
str
|
|
required |
rates
|
list
|
List of dicts with |
required |
Example
config.cell_types.set_death_phase_transition_rates( ... 'M0 macrophage', 'necrosis', [ ... {'start_index': 0, 'end_index': 1, 'rate': 9e9, 'fixed_duration': False}, ... {'start_index': 1, 'end_index': 2, 'rate': 1.15741e-05, 'fixed_duration': True}, ... ])
set_cell_adhesion_affinities
¶
Set per-cell-type adhesion affinities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type to modify. |
required |
affinities
|
dict
|
Dictionary mapping target cell type names to affinity values.
Replaces any existing affinities (including the placeholder
|
required |
Example
config.cell_types.set_cell_adhesion_affinities('M0 macrophage', { ... 'malignant epithelial cell': 1.0, ... 'M0 macrophage': 1.0, ... 'effector T cell': 0.5, ... })
update_all_cell_types_for_adhesion_affinities
¶
Populate adhesion affinities so every cell type has an entry for every other.
Existing non-default entries are preserved. The placeholder "default"
key is removed and replaced with explicit per-cell-type entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_affinity
|
float
|
Default affinity value for missing entries. |
1.0
|
set_phagocytosis_rates
¶
set_phagocytosis_rates(cell_type: str, apoptotic: float = None, necrotic: float = None, other_dead: float = None) -> None
Set dead-cell phagocytosis rates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
apoptotic
|
float
|
Rate for phagocytosing apoptotic cells. |
None
|
necrotic
|
float
|
Rate for phagocytosing necrotic cells. |
None
|
other_dead
|
float
|
Rate for phagocytosing other dead cells. |
None
|
Example
config.cell_types.set_phagocytosis_rates('M0 macrophage', ... apoptotic=0.01, necrotic=0.01, other_dead=0.01)
set_attack_rate
¶
Set the attack rate for one cell type attacking another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
The attacking cell type. |
required |
target_cell_type
|
str
|
The cell type being attacked. |
required |
rate
|
float
|
Attack rate in 1/min. |
required |
Example
config.cell_types.set_attack_rate('effector T cell', ... 'malignant epithelial cell', 0.01)
set_attack_parameters
¶
Set attack damage rate and duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
damage_rate
|
float
|
Attack damage rate in 1/min. |
None
|
duration
|
float
|
Attack duration in min. |
None
|
Example
config.cell_types.set_attack_parameters('effector T cell', ... damage_rate=1.0, duration=0.1)
set_transformation_rate
¶
Set the transformation rate from one cell type to another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
The cell type that transforms. |
required |
target_cell_type
|
str
|
The cell type it transforms into. |
required |
rate
|
float
|
Transformation rate in 1/min. |
required |
Example
config.cell_types.set_transformation_rate('M1 macrophage', ... 'M2 macrophage', 0.001)
set_mechanics_parameters
¶
Set mechanics parameters for a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
**params
|
Keyword arguments. Valid keys:
|
{}
|
Example
config.cell_types.set_mechanics_parameters('M0 macrophage', ... cell_cell_adhesion_strength=0.0, ... relative_maximum_adhesion_distance=1.5, ... )
set_custom_data
¶
set_custom_data(cell_type: str, key: str, value, units: str = 'dimensionless', description: str = '', conserved: bool = False) -> None
Add or update a custom data entry for a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
key
|
str
|
Name of the custom data variable. |
required |
value
|
Value of the variable (numeric or string). |
required | |
units
|
str
|
Unit string (default |
'dimensionless'
|
description
|
str
|
Optional description. |
''
|
conserved
|
bool
|
Whether the quantity is conserved. |
False
|
Example
config.cell_types.set_custom_data('M0 macrophage', 'sample', ... value=0.0, units='dimensionless')
clear_custom_data
¶
Remove all custom data entries for a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
set_volume_parameters
¶
set_volume_parameters(cell_type: str, total: float = None, nuclear: float = None, fluid_fraction: float = None) -> None
Set volume parameters for a cell type.
set_motility
¶
set_motility(cell_type: str, speed: float = None, persistence_time: float = None, migration_bias: float = None, enabled: bool = None) -> None
Set motility parameters for a cell type.
set_chemotaxis
¶
Set chemotaxis parameters for a cell type.
Args: cell_type: Name of the cell type substrate: Name of the substrate to follow (must be a real substrate name) enabled: Whether chemotaxis is enabled direction: Direction of chemotaxis (1 for attraction, -1 for repulsion)
set_advanced_chemotaxis
¶
set_advanced_chemotaxis(cell_type: str, substrate_sensitivities: dict, enabled: bool = True, normalize_each_gradient: bool = False) -> None
Set advanced chemotaxis parameters for a cell type.
Args: cell_type: Name of the cell type substrate_sensitivities: Dictionary mapping substrate names to sensitivity values enabled: Whether advanced chemotaxis is enabled normalize_each_gradient: Whether to normalize each gradient
add_secretion
¶
add_secretion(cell_type: str, substrate: str, secretion_rate: float, secretion_target: float = 1.0, uptake_rate: float = 0.0, net_export_rate: float = 0.0) -> None
Add secretion parameters for a substrate.
update_all_cell_types_for_substrates
¶
Update all cell types to include secretion parameters for all substrates.
update_all_cell_types_for_interactions
¶
Populate interaction and transformation rates for all defined cell types.
For each cell type, ensures that live_phagocytosis_rates,
attack_rates, fusion_rates, and transformation_rates
contain an entry for every defined cell type (using 0.0 as the
default rate). Existing non-default entries are preserved.
load_from_xml
¶
Load cell type definitions from XML element.
Args: xml_element: XML element containing cell definitions, or None if missing
SubstrateModule¶
SubstrateModule
¶
Bases: BaseModule
Add substrates, boundary conditions and related options.
set_track_internalized_substrates
¶
Set whether to track internalized substrates in each agent.
set_calculate_gradients
¶
Enable/disable gradient computation in the microenvironment.
add_substrate
¶
add_substrate(name: str, diffusion_coefficient: float = 1000.0, decay_rate: float = 0.1, initial_condition: float = 0.0, dirichlet_enabled: bool = False, dirichlet_value: float = 0.0, units: str = 'dimensionless', initial_units: str = 'mmHg') -> None
Create a new diffusive substrate entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Substrate identifier. |
required |
diffusion_coefficient
|
float
|
Diffusion constant in micron^2/min. |
1000.0
|
decay_rate
|
float
|
First-order decay rate |
0.1
|
initial_condition
|
float
|
Initial concentration value. |
0.0
|
dirichlet_enabled
|
bool
|
Global Dirichlet condition settings. |
False
|
dirichlet_value
|
bool
|
Global Dirichlet condition settings. |
False
|
units
|
str
|
Units for the concentration fields. |
'dimensionless'
|
initial_units
|
str
|
Units for the concentration fields. |
'dimensionless'
|
set_dirichlet_boundary
¶
set_dirichlet_boundary(substrate_name: str, boundary: str, enabled: bool, value: float = 0.0) -> None
Configure boundary-specific Dirichlet settings.
load_from_xml
¶
Load substrate configuration from XML element.
Args: xml_element: XML element containing microenvironment configuration, or None if missing
DomainModule¶
DomainModule
¶
Bases: BaseModule
Manage simulation bounds and mesh spacing.
set_bounds
¶
set_bounds(x_min: float, x_max: float, y_min: float, y_max: float, z_min: float = -10.0, z_max: float = 10.0) -> None
Configure the physical extents of the simulation space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_min
|
float
|
Coordinates describing the box boundaries in microns. |
required |
x_max
|
float
|
Coordinates describing the box boundaries in microns. |
required |
y_min
|
float
|
Coordinates describing the box boundaries in microns. |
required |
y_max
|
float
|
Coordinates describing the box boundaries in microns. |
required |
z_min
|
float
|
Coordinates describing the box boundaries in microns. |
required |
z_max
|
float
|
Coordinates describing the box boundaries in microns. |
required |
set_mesh
¶
Set the Cartesian mesh spacing in each dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dx
|
float
|
Grid spacing in microns. |
required |
dy
|
float
|
Grid spacing in microns. |
required |
dz
|
float
|
Grid spacing in microns. |
required |
set_2D
¶
Toggle 2‑D simulation mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_2D
|
bool
|
|
True
|
add_to_xml
¶
Append domain settings to the output XML tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Element
|
The root |
required |
load_from_xml
¶
Load domain configuration from XML element.
Args: xml_element: XML element containing domain configuration, or None if missing
OptionsModule¶
OptionsModule
¶
Bases: BaseModule
Configure general simulation options such as time steps.
set_max_time
¶
Define the total simulation duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_time
|
float
|
Final time value. |
required |
units
|
str
|
Time units ( |
'min'
|
set_time_steps
¶
set_time_steps(dt_diffusion: float = None, dt_mechanics: float = None, dt_phenotype: float = None) -> None
Specify numerical integration time steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt_diffusion
|
float
|
Optional overrides for the default time steps. |
None
|
dt_mechanics
|
float
|
Optional overrides for the default time steps. |
None
|
dt_phenotype
|
float
|
Optional overrides for the default time steps. |
None
|
set_virtual_wall
¶
Enable or disable the domain boundary wall.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
|
required |
set_automated_spring_adhesions
¶
Toggle automated spring adhesion feature.
set_legacy_random_points
¶
Use legacy division positioning algorithm.
set_parallel_threads
¶
Set number of OpenMP threads used by the simulation.
load_from_xml
¶
Load options configuration from XML element.
Args: xml_element: XML element containing overall options configuration, or None if missing
load_parallel_from_xml
¶
Load parallel configuration from XML element.
Args: xml_element: XML element containing parallel configuration, or None if missing
load_options_from_xml
¶
Load additional options configuration from XML element.
Args: xml_element: XML element containing additional options configuration, or None if missing
SaveOptionsModule¶
SaveOptionsModule
¶
Bases: BaseModule
Configure data output intervals and formats.
set_full_data_options
¶
set_full_data_options(interval: float = None, enable: bool = None, settings_interval: float = None) -> None
Set full data save options.
set_svg_options
¶
Set SVG save options.
set_svg_plot_substrate
¶
set_svg_plot_substrate(enabled: bool = False, limits: bool = False, substrate: str = 'substrate', colormap: str = 'YlOrRd', min_conc: float = 0, max_conc: float = 1) -> None
Configure plotting of a substrate concentration in SVG outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Turn substrate plots on or off. |
False
|
limits
|
bool
|
Whether min/max concentration limits are enforced. |
False
|
substrate
|
str
|
Name of the substrate to visualise. |
'substrate'
|
colormap
|
str
|
Matplotlib-style colormap name. |
'YlOrRd'
|
min_conc
|
float
|
Colour scale bounds. |
0
|
max_conc
|
float
|
Colour scale bounds. |
0
|
set_svg_legend
¶
Control the presence and contents of the SVG legend.
load_from_xml
¶
Load save options configuration from XML element.
Args: xml_element: XML element containing save options configuration, or None if missing
InitialConditionsModule¶
InitialConditionsModule
¶
Bases: BaseModule
Define initial cell locations and placement files.
add_cell_cluster
¶
add_cell_cluster(cell_type: str, x: float, y: float, z: float = 0.0, radius: float = 100.0, num_cells: int = 100) -> None
Place a spherical cluster of cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Cell type name. |
required |
x
|
float
|
Coordinates of the cluster centre. |
required |
y
|
float
|
Coordinates of the cluster centre. |
required |
z
|
float
|
Coordinates of the cluster centre. |
required |
radius
|
float
|
Sphere radius in microns. |
100.0
|
num_cells
|
int
|
Number of cells to generate. |
100
|
add_single_cell
¶
Place one cell in the simulation domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Cell type name. |
required |
x
|
float
|
Coordinates of the cell. |
required |
y
|
float
|
Coordinates of the cell. |
required |
z
|
float
|
Coordinates of the cell. |
required |
add_rectangular_region
¶
add_rectangular_region(cell_type: str, x_min: float, x_max: float, y_min: float, y_max: float, z_min: float = -5.0, z_max: float = 5.0, density: float = 0.8) -> None
Fill a rectangular region with randomly placed cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type. |
required |
x_min
|
float
|
Bounds of the region. |
required |
x_max
|
float
|
Bounds of the region. |
required |
y_min
|
float
|
Bounds of the region. |
required |
y_max
|
float
|
Bounds of the region. |
required |
z_min
|
float
|
Bounds of the region. |
required |
z_max
|
float
|
Bounds of the region. |
required |
density
|
float
|
Fraction of the region volume filled with cells (0-1). |
0.8
|
add_csv_file
¶
Specify an external CSV file for cell positions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
CSV file name. |
required |
folder
|
str
|
Folder containing the file. |
'./config'
|
enabled
|
bool
|
Whether PhysiCell should load the file. |
False
|
load_from_xml
¶
Load initial conditions configuration from XML element.
Args: xml_element: XML element containing initial conditions configuration, or None if missing
get_conditions
¶
Return a copy of all currently defined explicit placements.
CellRulesModule¶
CellRulesModule
¶
Bases: BaseModule
Handles cell rules configuration for PhysiCell simulations.
This module manages both sides of PhysiCell's cell-rules system:
- XML side – the
<cell_rules><rulesets>section that tells PhysiCell which CSV files to load at runtime (:meth:add_ruleset, :meth:add_to_xml). - CSV content side – the actual rules written into those CSV files
(:meth:
add_rule, :meth:save_rules_to_csv/ :meth:generate_csv).
An embedded registry of known signals and behaviors is loaded on
construction and used for soft validation (warnings, not hard errors).
Call :meth:update_context_from_config (or access through
PhysiCellConfig) to keep the registry context in sync with the
cell types and substrates defined in your configuration.
update_context_from_config
¶
Sync available cell types and substrates from config.
Call this whenever you add new cell types or substrates so that the validation warnings stay accurate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
PhysiCellConfig
|
The :class: |
required |
get_available_signals
¶
Return available signals, optionally filtered by type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_by_type
|
Optional[str]
|
If given, only signals whose |
None
|
get_available_behaviors
¶
Return available behaviors, optionally filtered by type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_by_type
|
Optional[str]
|
If given, only behaviors whose |
None
|
get_context
¶
Return current context (cell types, substrates, custom variables).
get_signal_by_name
¶
Look up a signal by its human-readable name.
Returns:
| Type | Description |
|---|---|
dict or None
|
Signal metadata dict (including |
get_behavior_by_name
¶
Look up a behavior by its human-readable name.
Returns:
| Type | Description |
|---|---|
dict or None
|
Behavior metadata dict (including |
add_ruleset
¶
add_ruleset(name: str, folder: str = './config', filename: str = 'rules.csv', enabled: bool = True) -> None
Register a CSV ruleset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Identifier for the ruleset. |
required |
folder
|
str
|
Folder where the CSV file resides. |
'./config'
|
filename
|
str
|
Name of the CSV file containing the rules. |
'rules.csv'
|
enabled
|
bool
|
Whether the ruleset should be loaded by PhysiCell. |
True
|
add_rule
¶
add_rule(cell_type: str, signal: str, direction: str, behavior: str, saturation_value: float = 0.0, half_max: float = 0.5, hill_power: float = 4.0, apply_to_dead: int = 0) -> None
Add a single rule following the PhysiCell CBHG v3.0 CSV format.
Hard errors are raised for invalid direction or apply_to_dead values. Unrecognised signal/behavior names produce a warning (the registry may not cover every custom name you define).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type
|
str
|
Name of the cell type this rule applies to. |
required |
signal
|
str
|
Signal that triggers the behavior (e.g. |
required |
direction
|
str
|
|
required |
behavior
|
str
|
The behavior being modulated (e.g. |
required |
saturation_value
|
float
|
Value of the behavior when the signal is at saturation. |
0.0
|
half_max
|
float
|
Signal value at which the behavior is halfway between its base value and the saturation value. |
0.5
|
hill_power
|
float
|
Exponent of the Hill function controlling the response curve. |
4.0
|
apply_to_dead
|
int
|
|
0
|
load_rules_from_csv
¶
Read rule definitions from a PhysiCell rules CSV file.
The CSV is expected to have no header row and follow the CBHG v3.0 column order::
cell_type,signal,direction,behavior,saturation_value,half_max,hill_power,apply_to_dead
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path to the CSV file. |
required |
save_rules_to_csv
¶
Write all currently stored rules to a PhysiCell-compatible CSV file.
The output has no header row and follows the CBHG v3.0 column order::
cell_type,signal,direction,behavior,saturation_value,half_max,hill_power,apply_to_dead
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Destination path for the generated CSV. |
required |
generate_csv
¶
Alias for :meth:save_rules_to_csv that returns the filename.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Destination path for the generated CSV. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The filename that was written. |
remove_rule
¶
Remove a rule by its list index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Zero-based index of the rule to remove. |
required |
Raises:
| Type | Description |
|---|---|
IndexError
|
If index is out of range. |
validate_rules
¶
Validate all stored rules against the registry.
Returns:
| Type | Description |
|---|---|
list of str
|
Validation warning/error messages. An empty list means all rules passed. |
print_available_signals
¶
Print available signals in a readable format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_by_type
|
Optional[str]
|
Optional signal type to filter by (e.g. |
None
|
print_available_behaviors
¶
Print available behaviors in a readable format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_by_type
|
Optional[str]
|
Optional behavior type to filter by (e.g. |
None
|
print_context
¶
Print the current context (cell types, substrates, custom variables).
add_to_xml
¶
Serialize cell rules into the PhysiCell XML tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Element
|
Parent XML element representing |
required |
load_from_xml
¶
Load cell rules configuration from XML element.
Args: xml_element: XML element containing cell rules configuration, or None if missing
get_rulesets
¶
Return a copy of the registered rulesets.
PhysiBoSSModule¶
PhysiBoSSModule
¶
Bases: BaseModule
Configure PhysiBoSS integration for per-cell-type intracellular models.
add_intracellular_model
¶
add_intracellular_model(cell_type_name: str, model_type: str = 'maboss', bnd_filename: str = '', cfg_filename: str = '') -> None
Add intracellular model to a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type_name
|
str
|
Name of the cell type |
required |
model_type
|
str
|
Type of intracellular model (default: 'maboss') |
'maboss'
|
bnd_filename
|
str
|
Boolean network file name |
''
|
cfg_filename
|
str
|
Configuration file name |
''
|
set_intracellular_settings
¶
set_intracellular_settings(cell_type_name: str, intracellular_dt: float = None, time_stochasticity: int = None, scaling: float = None, start_time: float = None, inheritance_global: bool = None) -> None
Set intracellular model settings for a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type_name
|
str
|
Name of the cell type |
required |
intracellular_dt
|
float
|
Intracellular time step |
None
|
time_stochasticity
|
int
|
Time stochasticity parameter |
None
|
scaling
|
float
|
Scaling factor |
None
|
start_time
|
float
|
Start time |
None
|
inheritance_global
|
bool
|
Global inheritance setting |
None
|
add_intracellular_initial_value
¶
Set initial value for an intracellular node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type_name
|
str
|
Name of the cell type |
required |
intracellular_name
|
str
|
Name of the intracellular node |
required |
value
|
float
|
Initial value |
required |
add_intracellular_input
¶
add_intracellular_input(cell_type_name: str, physicell_name: str, intracellular_name: str, action: str = 'activation', threshold: float = 1, smoothing: int = 0) -> None
Add an input mapping for the intracellular model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type_name
|
str
|
Name of the cell type |
required |
physicell_name
|
str
|
PhysiCell variable name |
required |
intracellular_name
|
str
|
Intracellular variable name |
required |
action
|
str
|
Action type (default: 'activation') |
'activation'
|
threshold
|
float
|
Threshold value (default: 1) |
1
|
smoothing
|
int
|
Smoothing parameter (default: 0) |
0
|
add_intracellular_output
¶
add_intracellular_output(cell_type_name: str, physicell_name: str, intracellular_name: str, action: str = 'activation', value: float = 1000000, base_value: float = 0, smoothing: int = 0) -> None
Add an output mapping for the intracellular model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type_name
|
str
|
Name of the cell type |
required |
physicell_name
|
str
|
PhysiCell variable name |
required |
intracellular_name
|
str
|
Intracellular variable name |
required |
action
|
str
|
Action type (default: 'activation') |
'activation'
|
value
|
float
|
Output value (default: 1000000) |
1000000
|
base_value
|
float
|
Base value (default: 0) |
0
|
smoothing
|
int
|
Smoothing parameter (default: 0) |
0
|
add_intracellular_mutation
¶
add_intracellular_mutation(cell_type_name: str, intracellular_name: str, value: Union[str, bool]) -> None
Add an intracellular mutation for a cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_type_name
|
str
|
Name of the cell type |
required |
intracellular_name
|
str
|
Name of the intracellular variable |
required |
value
|
Union[str, bool]
|
Value for the mutation |
required |
add_intracellular_xml
¶
Add intracellular model XML elements for a specific cell type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_elem
|
Element
|
Parent XML element (typically phenotype) |
required |
cell_type_name
|
str
|
Name of the cell type |
required |
load_from_xml
¶
Load PhysiBoSS configuration from a cell_definitions XML element.
Detailed per-cell intracellular data is parsed by
CellTypeModule.load_from_xml(); this method only updates the
top-level enabled flag so that :meth:is_enabled stays
consistent when the module is interrogated before cell-type loading
completes.
Args:
xml_element: cell_definitions XML element, or None if
the section is absent.
is_enabled
¶
Check if PhysiBoSS is enabled.
Returns True if any cell type has intracellular models configured.
ConfigLoader¶
ConfigLoader
¶
Loader for default PhysiCell configuration snippets.
The loader uses embedded Python data structures instead of JSON files to provide convenience methods for retrieving common phenotype or substrate templates.
get_cycle_model
¶
Get cycle model configuration by name.
get_death_model
¶
Get death model configuration by name.
get_mechanics_defaults
¶
Get default mechanics parameters.
get_secretion_defaults
¶
Get default secretion parameters.
get_cell_interactions_defaults
¶
Get default cell interactions parameters.
get_cell_transformations_defaults
¶
Get default cell transformations parameters.
get_cell_integrity_defaults
¶
Get default cell integrity parameters.
get_custom_data_defaults
¶
Get default custom data parameters.
get_initial_parameter_distributions_defaults
¶
Get default initial parameter distributions.
get_intracellular_defaults
¶
Get default intracellular parameters.
get_cell_type_template
¶
Get cell type template configuration.
get_substrate_defaults
¶
Get default substrate parameters.
get_default_phenotype
¶
Create a complete default phenotype based on template.
BaseModule¶
BaseModule
¶
Bases: ABC
Base class for all configuration modules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
PhysiCellConfig
|
Parent :class: |
required |
load_from_xml
abstractmethod
¶
Load module configuration from XML element.
Args: xml_element: XML element containing module data, or None if section missing
merge_from_xml
¶
Merge XML configuration with existing module data.
Default implementation calls load_from_xml. Override for custom merge logic.
Args: xml_element: XML element containing module data, or None if section missing