funman.model package

Subpackages

Submodules

funman.model.bilayer module

Inheritance diagram of funman.model.bilayer

pydantic model funman.model.bilayer.BilayerDynamics

Bases: BilayerGraph

The BilayerDynamics class represents a state update (dynamics) model for a set of variables. The graph consists of:

  • state nodes (current state),

  • tangent nodes (next state), and

  • flux nodes (causal relationships).

Show JSON schema
{
   "title": "BilayerDynamics",
   "description": "The BilayerDynamics class represents a state update (dynamics) model for a set of variables.  The graph consists of:\n\n* state nodes (current state),\n\n* tangent nodes (next state), and\n\n* flux nodes (causal relationships).",
   "type": "object",
   "properties": {
      "json_graph": {
         "title": "Json Graph",
         "type": "object"
      }
   },
   "required": [
      "json_graph"
   ]
}

Fields:

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

to_dot(values={})

Create a dot object for visualizing the graph.

Returns:

The graph represented by self.

Return type:

graphviz.Digraph

pydantic model funman.model.bilayer.BilayerEdge

Bases: BaseModel

Show JSON schema
{
   "title": "BilayerEdge",
   "type": "object",
   "properties": {
      "src": {
         "$ref": "#/$defs/BilayerNode"
      },
      "tgt": {
         "$ref": "#/$defs/BilayerNode"
      }
   },
   "$defs": {
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      },
      "BilayerNode": {
         "description": "Node in a BilayerGraph.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerNode",
         "type": "object"
      }
   },
   "required": [
      "src",
      "tgt"
   ]
}

Fields:
field src: BilayerNode [Required]
field tgt: BilayerNode [Required]
to_dot(dot)

Create a dot object for visualizing the edge.

Parameters:

dot (graphviz.Graph) – Graph to add the edge.

pydantic model funman.model.bilayer.BilayerFluxNode

Bases: BilayerNode

BilayerNode representing a flux.

Show JSON schema
{
   "title": "BilayerFluxNode",
   "description": "BilayerNode representing a flux.",
   "type": "object",
   "properties": {
      "index": {
         "title": "Index",
         "type": "integer"
      },
      "parameter": {
         "title": "Parameter",
         "type": "string"
      },
      "metadata": {
         "anyOf": [
            {
               "$ref": "#/$defs/BilayerMetadata"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      }
   },
   "required": [
      "index",
      "parameter"
   ]
}

Fields:
field index: int [Required]
field metadata: BilayerMetadata | None = None
field parameter: str [Required]
pydantic model funman.model.bilayer.BilayerGraph

Bases: ABC, BaseModel

Abstract representation of a Bilayer graph.

Show JSON schema
{
   "title": "BilayerGraph",
   "description": "Abstract representation of a Bilayer graph.",
   "type": "object",
   "properties": {
      "json_graph": {
         "title": "Json Graph",
         "type": "object"
      }
   },
   "required": [
      "json_graph"
   ]
}

Fields:
field json_graph: Dict [Required]
model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pydantic model funman.model.bilayer.BilayerMeasurement

Bases: BilayerGraph, BaseModel

The BilayerMeasurement class represents measurements taken on the BilayerNode state nodes of a BilayerDynamics object. The graph consists of:

  • state nodes (current state),

  • observation nodes, and

  • flux nodes (causal relationships).

Show JSON schema
{
   "title": "BilayerMeasurement",
   "description": "The BilayerMeasurement class represents measurements taken on the BilayerNode state nodes of a BilayerDynamics object.  The graph consists of:\n\n* state nodes (current state),\n\n* observation nodes, and\n\n* flux nodes (causal relationships).",
   "type": "object",
   "properties": {
      "json_graph": {
         "title": "Json Graph",
         "type": "object"
      },
      "state": {
         "additionalProperties": {
            "$ref": "#/$defs/BilayerStateNode"
         },
         "default": {},
         "title": "State",
         "type": "object"
      },
      "flux": {
         "additionalProperties": {
            "$ref": "#/$defs/BilayerFluxNode"
         },
         "default": {},
         "title": "Flux",
         "type": "object"
      },
      "observable": {
         "additionalProperties": {
            "$ref": "#/$defs/BilayerStateNode"
         },
         "default": {},
         "title": "Observable",
         "type": "object"
      },
      "input_edges": {
         "$ref": "#/$defs/BilayerEdge",
         "default": []
      },
      "output_edges": {
         "$ref": "#/$defs/BilayerEdge",
         "default": []
      }
   },
   "$defs": {
      "BilayerEdge": {
         "properties": {
            "src": {
               "$ref": "#/$defs/BilayerNode"
            },
            "tgt": {
               "$ref": "#/$defs/BilayerNode"
            }
         },
         "required": [
            "src",
            "tgt"
         ],
         "title": "BilayerEdge",
         "type": "object"
      },
      "BilayerFluxNode": {
         "description": "BilayerNode representing a flux.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerFluxNode",
         "type": "object"
      },
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      },
      "BilayerNode": {
         "description": "Node in a BilayerGraph.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerNode",
         "type": "object"
      },
      "BilayerStateNode": {
         "description": "BilayerNode representing a state variable.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerStateNode",
         "type": "object"
      }
   },
   "required": [
      "json_graph"
   ]
}

Fields:
field flux: Dict[int, BilayerFluxNode] = {}
field input_edges: BilayerEdge = []
field observable: Dict[int, BilayerStateNode] = {}
field output_edges: BilayerEdge = []
field state: Dict[int, BilayerStateNode] = {}
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

to_dot(values={})

Create a dot object for visualizing the graph.

Returns:

The graph represented by self.

Return type:

graphviz.Digraph

pydantic model funman.model.bilayer.BilayerMetadata

Bases: BaseModel

Metadata for a BilayerNode

Show JSON schema
{
   "title": "BilayerMetadata",
   "description": "Metadata for a BilayerNode",
   "type": "object",
   "properties": {
      "ref": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Ref"
      },
      "type": {
         "anyOf": [
            {
               "enum": [
                  "float",
                  "int"
               ],
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Type"
      },
      "initial_value": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Initial Value"
      },
      "lb": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Lb"
      },
      "ub": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Ub"
      }
   }
}

Fields:
field initial_value: float | int | None = None
field lb: float | int | None = None
field ref: str | None = None
field type: Literal['float', 'int'] | None = None
field ub: float | int | None = None
pydantic model funman.model.bilayer.BilayerModel

Bases: FunmanModel

A BilayerModel is a complete specification of a Model that uses a BilayerDynamics graph to represent dynamics. It includes the attributes:

  • bilayer: the BilayerDynamics graph

  • measurements: the BilayerMeasurement graph (used to derive additional variables from the state nodes)

  • init_values: a dict mapping from state variables and flux parameters to initial value

  • identical_parameters: a list of lists of flux parameters that have identical values

  • parameter_bounds: a list of lower and upper bounds on parameters

Show JSON schema
{
   "title": "BilayerModel",
   "description": "A BilayerModel is a complete specification of a Model that uses a BilayerDynamics graph to represent dynamics. It includes the attributes:\n\n* bilayer: the BilayerDynamics graph\n\n* measurements: the BilayerMeasurement graph (used to derive additional variables from the state nodes)\n\n* init_values: a dict mapping from state variables and flux parameters to initial value\n\n* identical_parameters: a list of lists of flux parameters that have identical values\n\n* parameter_bounds: a list of lower and upper bounds on parameters",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "bilayer": {
         "$ref": "#/$defs/BilayerDynamics"
      },
      "measurements": {
         "$ref": "#/$defs/BilayerMeasurement",
         "default": null
      },
      "identical_parameters": {
         "default": [],
         "items": {
            "items": {
               "type": "string"
            },
            "type": "array"
         },
         "title": "Identical Parameters",
         "type": "array"
      }
   },
   "$defs": {
      "BilayerDynamics": {
         "description": "The BilayerDynamics class represents a state update (dynamics) model for a set of variables.  The graph consists of:\n\n* state nodes (current state),\n\n* tangent nodes (next state), and\n\n* flux nodes (causal relationships).",
         "properties": {
            "json_graph": {
               "title": "Json Graph",
               "type": "object"
            }
         },
         "required": [
            "json_graph"
         ],
         "title": "BilayerDynamics",
         "type": "object"
      },
      "BilayerEdge": {
         "properties": {
            "src": {
               "$ref": "#/$defs/BilayerNode"
            },
            "tgt": {
               "$ref": "#/$defs/BilayerNode"
            }
         },
         "required": [
            "src",
            "tgt"
         ],
         "title": "BilayerEdge",
         "type": "object"
      },
      "BilayerFluxNode": {
         "description": "BilayerNode representing a flux.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerFluxNode",
         "type": "object"
      },
      "BilayerMeasurement": {
         "description": "The BilayerMeasurement class represents measurements taken on the BilayerNode state nodes of a BilayerDynamics object.  The graph consists of:\n\n* state nodes (current state),\n\n* observation nodes, and\n\n* flux nodes (causal relationships).",
         "properties": {
            "json_graph": {
               "title": "Json Graph",
               "type": "object"
            },
            "state": {
               "additionalProperties": {
                  "$ref": "#/$defs/BilayerStateNode"
               },
               "default": {},
               "title": "State",
               "type": "object"
            },
            "flux": {
               "additionalProperties": {
                  "$ref": "#/$defs/BilayerFluxNode"
               },
               "default": {},
               "title": "Flux",
               "type": "object"
            },
            "observable": {
               "additionalProperties": {
                  "$ref": "#/$defs/BilayerStateNode"
               },
               "default": {},
               "title": "Observable",
               "type": "object"
            },
            "input_edges": {
               "$ref": "#/$defs/BilayerEdge",
               "default": []
            },
            "output_edges": {
               "$ref": "#/$defs/BilayerEdge",
               "default": []
            }
         },
         "required": [
            "json_graph"
         ],
         "title": "BilayerMeasurement",
         "type": "object"
      },
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      },
      "BilayerNode": {
         "description": "Node in a BilayerGraph.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerNode",
         "type": "object"
      },
      "BilayerStateNode": {
         "description": "BilayerNode representing a state variable.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerStateNode",
         "type": "object"
      }
   },
   "required": [
      "bilayer"
   ]
}

Config:
  • allow_inf_nan: bool = True

Fields:
field bilayer: BilayerDynamics [Required]
field identical_parameters: List[List[str]] = []
field measurements: BilayerMeasurement = None
calculate_normalization_constant(scenario: AnalysisScenario, config: FUNMANConfig) float
default_encoder(config: FUNMANConfig, scenario: AnalysisScenario) Encoder

Return the default Encoder for the model

Returns:

SMT encoder for model

Return type:

Encoder

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.model.bilayer.BilayerNegativeEdge

Bases: BilayerEdge

Class representing a positive influence between a FluxNode and a StateNode.

Show JSON schema
{
   "title": "BilayerNegativeEdge",
   "description": "Class representing a positive influence between a FluxNode and a StateNode.",
   "type": "object",
   "properties": {
      "src": {
         "$ref": "#/$defs/BilayerNode"
      },
      "tgt": {
         "$ref": "#/$defs/BilayerNode"
      }
   },
   "$defs": {
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      },
      "BilayerNode": {
         "description": "Node in a BilayerGraph.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerNode",
         "type": "object"
      }
   },
   "required": [
      "src",
      "tgt"
   ]
}

Fields:
field src: BilayerNode [Required]
field tgt: BilayerNode [Required]
to_dot(dot)

Create a dot object for visualizing the edge.

Parameters:

dot (graphviz.Graph) – Graph to add the edge.

pydantic model funman.model.bilayer.BilayerNode

Bases: BaseModel

Node in a BilayerGraph.

Show JSON schema
{
   "title": "BilayerNode",
   "description": "Node in a BilayerGraph.",
   "type": "object",
   "properties": {
      "index": {
         "title": "Index",
         "type": "integer"
      },
      "parameter": {
         "title": "Parameter",
         "type": "string"
      },
      "metadata": {
         "anyOf": [
            {
               "$ref": "#/$defs/BilayerMetadata"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      }
   },
   "required": [
      "index",
      "parameter"
   ]
}

Fields:
field index: int [Required]
field metadata: BilayerMetadata | None = None
field parameter: str [Required]
to_dot(dot, values={})
pydantic model funman.model.bilayer.BilayerPositiveEdge

Bases: BilayerEdge

Class representing a positive influence between a FluxNode and a StateNode.

Show JSON schema
{
   "title": "BilayerPositiveEdge",
   "description": "Class representing a positive influence between a FluxNode and a StateNode.",
   "type": "object",
   "properties": {
      "src": {
         "$ref": "#/$defs/BilayerNode"
      },
      "tgt": {
         "$ref": "#/$defs/BilayerNode"
      }
   },
   "$defs": {
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      },
      "BilayerNode": {
         "description": "Node in a BilayerGraph.",
         "properties": {
            "index": {
               "title": "Index",
               "type": "integer"
            },
            "parameter": {
               "title": "Parameter",
               "type": "string"
            },
            "metadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BilayerMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "index",
            "parameter"
         ],
         "title": "BilayerNode",
         "type": "object"
      }
   },
   "required": [
      "src",
      "tgt"
   ]
}

Fields:
field src: BilayerNode [Required]
field tgt: BilayerNode [Required]
pydantic model funman.model.bilayer.BilayerStateNode

Bases: BilayerNode

BilayerNode representing a state variable.

Show JSON schema
{
   "title": "BilayerStateNode",
   "description": "BilayerNode representing a state variable.",
   "type": "object",
   "properties": {
      "index": {
         "title": "Index",
         "type": "integer"
      },
      "parameter": {
         "title": "Parameter",
         "type": "string"
      },
      "metadata": {
         "anyOf": [
            {
               "$ref": "#/$defs/BilayerMetadata"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "BilayerMetadata": {
         "description": "Metadata for a BilayerNode",
         "properties": {
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ref"
            },
            "type": {
               "anyOf": [
                  {
                     "enum": [
                        "float",
                        "int"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "initial_value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initial Value"
            },
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Ub"
            }
         },
         "title": "BilayerMetadata",
         "type": "object"
      }
   },
   "required": [
      "index",
      "parameter"
   ]
}

Fields:
field index: int [Required]
field metadata: BilayerMetadata | None = None
field parameter: str [Required]

funman.model.decapode module

Inheritance diagram of funman.model.decapode

pydantic model funman.model.decapode.DecapodeDynamics

Bases: BaseModel

Show JSON schema
{
   "title": "DecapodeDynamics",
   "type": "object",
   "properties": {
      "json_graph": {
         "additionalProperties": {
            "items": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "string"
                     }
                  ]
               },
               "type": "object"
            },
            "type": "array"
         },
         "title": "Json Graph",
         "type": "object"
      }
   },
   "required": [
      "json_graph"
   ]
}

Fields:
field json_graph: Dict[str, List[Dict[str, int | str]]] [Required]
pydantic model funman.model.decapode.DecapodeModel

Bases: FunmanModel

Show JSON schema
{
   "title": "DecapodeModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "decapode": {
         "$ref": "#/$defs/DecapodeDynamics"
      }
   },
   "$defs": {
      "DecapodeDynamics": {
         "properties": {
            "json_graph": {
               "additionalProperties": {
                  "items": {
                     "additionalProperties": {
                        "anyOf": [
                           {
                              "type": "integer"
                           },
                           {
                              "type": "string"
                           }
                        ]
                     },
                     "type": "object"
                  },
                  "type": "array"
               },
               "title": "Json Graph",
               "type": "object"
            }
         },
         "required": [
            "json_graph"
         ],
         "title": "DecapodeDynamics",
         "type": "object"
      }
   },
   "required": [
      "decapode"
   ]
}

Config:
  • allow_inf_nan: bool = True

Fields:
field decapode: DecapodeDynamics [Required]
default_encoder(config: FUNMANConfig, scenario: AnalysisScenario) Encoder

Return the default Encoder for the model

Returns:

SMT encoder for model

Return type:

Encoder

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

funman.model.encoded module

Inheritance diagram of funman.model.encoded

pydantic model funman.model.encoded.EncodedModel

Bases: FunmanModel

Model that holds an SMT formula encoding a model. This class is meant to wrap hand-coded SMT formulas.

Show JSON schema
{
   "title": "EncodedModel",
   "description": "Model that holds an SMT formula encoding a model.  This class is meant to wrap hand-coded SMT formulas.",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "parameters": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/ModelParameter"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Parameters"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   }
}

Config:
  • allow_inf_nan: bool = True

  • arbitrary_types_allowed: bool = True

Fields:
field parameters: List[ModelParameter] | None = None
default_encoder(config: FUNMANConfig, scenario: AnalysisScenario) Encoder

EncodedModel uses EncodedEncoder as the default.

Returns:

the EncodedEncoder

Return type:

Encoder

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

funman.model.ensemble module

Inheritance diagram of funman.model.ensemble

pydantic model funman.model.ensemble.EnsembleModel

Bases: FunmanModel

Show JSON schema
{
   "title": "EnsembleModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "models": {
         "items": {
            "$ref": "#/$defs/FunmanModel"
         },
         "title": "Models",
         "type": "array"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      }
   },
   "required": [
      "models"
   ]
}

Config:
  • allow_inf_nan: bool = True

Fields:
field models: List[FunmanModel] [Required]
calculate_normalization_constant(scenario: AnalysisScenario, config: FUNMANConfig) float
default_encoder(config: FUNMANConfig, scenario: AnalysisScenario) Encoder

Return the default Encoder for the model

Returns:

SMT encoder for model

Return type:

Encoder

gradient(y, t, *p)
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

to_dot(values={})

Create a dot object for visualizing the graph.

Returns:

The graph represented by self.

Return type:

graphviz.Digraph

funman.model.gromet module

funman.model.model module

Inheritance diagram of funman.model.model

This module represents the abstract base classes for models.

pydantic model funman.model.model.FunmanModel

Bases: ABC, BaseModel

The abstract base class for Models.

Show JSON schema
{
   "title": "FunmanModel",
   "description": "The abstract base class for Models.",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      }
   }
}

Config:
  • allow_inf_nan: bool = True

Fields:
field init_values: Dict[str, float] = {}
field name: str = 'model_a6f04917-34c0-45e0-a42c-128947736090'
field parameter_bounds: Dict[str, List[float]] = {}
calculate_normalization_constant(scenario: AnalysisScenario, config: FUNMANConfig) float
compartmental_constraints(populuation: int, noise: float)
model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

observables()
variables(include_next_state=False)

Get all initial values and parameters.

funman.model.model.is_observable(var_string, model: FunmanModel, time_pattern: str = '[\\d]+$') bool
funman.model.model.is_state_variable(var_string, model: FunmanModel, time_pattern: str = '[\\d]+$') bool

funman.model.petrinet module

Inheritance diagram of funman.model.petrinet

pydantic model funman.model.petrinet.AbstractPetriNetModel

Bases: FunmanModel

Show JSON schema
{
   "title": "AbstractPetriNetModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      }
   }
}

Config:
  • allow_inf_nan: bool = True

Fields:

calculate_normalization_constant(scenario: AnalysisScenario, config: FUNMANConfig) float
compartmental_constraints(population: float | int, noise: float) List[Constraint]
derivative(var_name, t, values, params, var_to_value, param_to_value, get_lambda=False)
gradient(t, y, *p)
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

to_dot(values={})

Create a dot object for visualizing the graph.

Returns:

The graph represented by self.

Return type:

graphviz.Digraph

pydantic model funman.model.petrinet.GeneratedPetriNetModel

Bases: AbstractPetriNetModel

Show JSON schema
{
   "title": "GeneratedPetriNetModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "petrinet": {
         "$ref": "#/$defs/Model"
      }
   },
   "$defs": {
      "Distribution": {
         "additionalProperties": true,
         "properties": {
            "type": {
               "title": "Type",
               "type": "string"
            },
            "parameters": {
               "title": "Parameters",
               "type": "object"
            }
         },
         "required": [
            "type",
            "parameters"
         ],
         "title": "Distribution",
         "type": "object"
      },
      "Grounding": {
         "additionalProperties": false,
         "properties": {
            "identifiers": {
               "title": "Identifiers",
               "type": "object"
            },
            "modifiers": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Modifiers"
            }
         },
         "required": [
            "identifiers"
         ],
         "title": "Grounding",
         "type": "object"
      },
      "Header": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "schema": {
               "format": "uri",
               "minLength": 1,
               "title": "Schema",
               "type": "string"
            },
            "schema_name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Schema Name"
            },
            "description": {
               "title": "Description",
               "type": "string"
            },
            "model_version": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Model Version"
            }
         },
         "required": [
            "name",
            "schema",
            "description"
         ],
         "title": "Header",
         "type": "object"
      },
      "Initial": {
         "properties": {
            "target": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Target"
            },
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "expression_mathml": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression Mathml"
            }
         },
         "title": "Initial",
         "type": "object"
      },
      "Model": {
         "additionalProperties": true,
         "properties": {
            "header": {
               "$ref": "#/$defs/Header"
            },
            "properties": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Properties"
            },
            "model": {
               "$ref": "#/$defs/Model1"
            },
            "semantics": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Semantics"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Information specific to a given semantics (e.g., ODEs) associated with a model."
            },
            "metadata": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "(Optional) Information not useful for execution of the model, but that may be useful to some consumer in the future. E.g. creation timestamp or source paper's author.",
               "title": "Metadata"
            }
         },
         "required": [
            "header",
            "model"
         ],
         "title": "Model",
         "type": "object"
      },
      "Model1": {
         "additionalProperties": false,
         "properties": {
            "states": {
               "$ref": "#/$defs/States"
            },
            "transitions": {
               "$ref": "#/$defs/Transitions"
            }
         },
         "required": [
            "states",
            "transitions"
         ],
         "title": "Model1",
         "type": "object"
      },
      "Observable": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "expression_mathml": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression Mathml"
            }
         },
         "required": [
            "id"
         ],
         "title": "Observable",
         "type": "object"
      },
      "OdeSemantics": {
         "properties": {
            "rates": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Rate"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Rates"
            },
            "initials": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Initial"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Initials"
            },
            "parameters": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Parameter"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Parameters"
            },
            "observables": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Observable"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Observables"
            },
            "time": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Time"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "OdeSemantics",
         "type": "object"
      },
      "Parameter": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "distribution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Distribution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "units": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Unit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id"
         ],
         "title": "Parameter",
         "type": "object"
      },
      "Properties": {
         "additionalProperties": true,
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "name"
         ],
         "title": "Properties",
         "type": "object"
      },
      "Rate": {
         "properties": {
            "target": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Target"
            },
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "expression_mathml": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression Mathml"
            }
         },
         "title": "Rate",
         "type": "object"
      },
      "Semantics": {
         "properties": {
            "ode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/OdeSemantics"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "typing": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TypingSemantics"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "(Optional) Information for aligning models for stratification"
            },
            "span": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/TypingSemantics"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "(Optional) Legs of a span, each of which are a full ASKEM Petri Net",
               "title": "Span"
            }
         },
         "title": "Semantics",
         "type": "object"
      },
      "State": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "units": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Unit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id"
         ],
         "title": "State",
         "type": "object"
      },
      "States": {
         "items": {
            "$ref": "#/$defs/State"
         },
         "title": "States",
         "type": "array"
      },
      "Time": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "units": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Unit"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id"
         ],
         "title": "Time",
         "type": "object"
      },
      "Transition": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "input": {
               "items": {
                  "type": "string"
               },
               "title": "Input",
               "type": "array"
            },
            "output": {
               "items": {
                  "type": "string"
               },
               "title": "Output",
               "type": "array"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "properties": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Properties"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id",
            "input",
            "output"
         ],
         "title": "Transition",
         "type": "object"
      },
      "Transitions": {
         "items": {
            "$ref": "#/$defs/Transition"
         },
         "title": "Transitions",
         "type": "array"
      },
      "TypingSemantics": {
         "properties": {
            "system": {
               "$ref": "#/$defs/Model",
               "description": "A Petri net representing the 'type system' that is necessary to align states and transitions across different models during stratification."
            },
            "map": {
               "description": "A map between the (state and transition) nodes of the model and the (state and transition) nodes of the type system",
               "items": {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               "title": "Map",
               "type": "array"
            }
         },
         "required": [
            "system",
            "map"
         ],
         "title": "TypingSemantics",
         "type": "object"
      },
      "Unit": {
         "additionalProperties": true,
         "properties": {
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "expression_mathml": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression Mathml"
            }
         },
         "title": "Unit",
         "type": "object"
      }
   },
   "required": [
      "petrinet"
   ]
}

Config:
  • allow_inf_nan: bool = True

  • arbitrary_types_allowed: bool = True

Fields:
field petrinet: Model [Required]
abstract(state_abstraction: Dict[str, str])
contract_parameters(parameter_bounds: Dict[str, Interval]) Model
default_encoder(config: FUNMANConfig, scenario: AnalysisScenario) Encoder

Return the default Encoder for the model

Returns:

SMT encoder for model

Return type:

Encoder

formulate_bounds()
is_timed_observable(observation_id)
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

observable_expression(observation_id)
observables()
stratified_parameter_id(parameter, index, strata)
stratified_state_id(state_var, index, strata)
stratified_trans_id(transition, index, strata)
stratify(state_var: str, strata: List[str], strata_parameters: List[str] | None = None, strata_transitions=[], self_strata_transition=False)

Generate a new model that stratifies self. The ‘state_var’ will be replaced by one copy per entry in the ‘strata’ list. The ‘strata_parameters’, if specified, will be replaced by a fresh copy that corresponds to each element of the strata list in each transition involving the ‘state_var’. The ‘strata_transitions’ list includes all transitions involving ‘state_var’ to allow transitioning between the elements of ‘strata’, if possible (e.g., if ‘state_var’ is both and input and an output of the transition). The ‘self_strata_transition’ flag adds transitions between all pairs of entries in ‘strata’. When either ‘strata_transitions’ or ‘self_strata_transition’ are specified, the rates will incorporate a new parameter that defines the probability of transitioning between elements of the strata list. The transition probability parameters are assigned a value of 1/len(‘strata’), treating the transitions as a uniform probability distribution.

Parameters:
  • self (PetrinetModel) – _description_

  • state_var (str) – _description_

  • strata (List[str]) – _description_

  • strata_parameters (Optional[List[str]], optional) – _description_, by default None

  • strata_transitions (list, optional) – _description_, by default []

  • self_strata_transition (bool, optional) – _description_, by default False

Returns:

_description_

Return type:

_type_

stratify_transition(transition: Transition, state_var: str, strata: List[str], strata_parameters: List[str] | None = None, strata_transition=False)
pydantic model funman.model.petrinet.PetrinetDynamics

Bases: BaseModel

Show JSON schema
{
   "title": "PetrinetDynamics",
   "type": "object",
   "properties": {
      "json_graph": {
         "additionalProperties": {
            "items": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "additionalProperties": {
                           "anyOf": [
                              {
                                 "type": "string"
                              },
                              {
                                 "type": "boolean"
                              },
                              {
                                 "type": "number"
                              },
                              {
                                 "type": "null"
                              }
                           ]
                        },
                        "type": "object"
                     },
                     {
                        "type": "integer"
                     },
                     {
                        "type": "string"
                     },
                     {
                        "type": "number"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "type": "object"
            },
            "type": "array"
         },
         "title": "Json Graph",
         "type": "object"
      }
   },
   "required": [
      "json_graph"
   ]
}

Fields:
field json_graph: Dict[str, List[Dict[str, Dict[str, str | bool | float | None] | int | str | float | None]]] [Required]
pydantic model funman.model.petrinet.PetrinetModel

Bases: AbstractPetriNetModel

Show JSON schema
{
   "title": "PetrinetModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "petrinet": {
         "$ref": "#/$defs/PetrinetDynamics"
      }
   },
   "$defs": {
      "PetrinetDynamics": {
         "properties": {
            "json_graph": {
               "additionalProperties": {
                  "items": {
                     "additionalProperties": {
                        "anyOf": [
                           {
                              "additionalProperties": {
                                 "anyOf": [
                                    {
                                       "type": "string"
                                    },
                                    {
                                       "type": "boolean"
                                    },
                                    {
                                       "type": "number"
                                    },
                                    {
                                       "type": "null"
                                    }
                                 ]
                              },
                              "type": "object"
                           },
                           {
                              "type": "integer"
                           },
                           {
                              "type": "string"
                           },
                           {
                              "type": "number"
                           },
                           {
                              "type": "null"
                           }
                        ]
                     },
                     "type": "object"
                  },
                  "type": "array"
               },
               "title": "Json Graph",
               "type": "object"
            }
         },
         "required": [
            "json_graph"
         ],
         "title": "PetrinetDynamics",
         "type": "object"
      }
   },
   "required": [
      "petrinet"
   ]
}

Config:
  • allow_inf_nan: bool = True

Fields:
field petrinet: PetrinetDynamics [Required]
default_encoder(config: FUNMANConfig) Encoder

Return the default Encoder for the model

Returns:

SMT encoder for model

Return type:

Encoder

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

funman.model.query module

Inheritance diagram of funman.model.query

This module defines all Query classes. Queries are combined with Model objects in Scenarios to determine whether the model satisfies the query.

pydantic model funman.model.query.Query

Bases: BaseModel

Abstract base class for queries.

Show JSON schema
{
   "title": "Query",
   "description": "Abstract base class for queries.",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      }
   }
}

Fields:
field model: FunmanModel | None = None
pydantic model funman.model.query.QueryAnd

Bases: Query

Conjunction of queries.

Parameters:

queries (List[Query]) – queries to conjoin.

Show JSON schema
{
   "title": "QueryAnd",
   "description": "Conjunction of queries.\n\nParameters\n----------\nqueries : List[Query]\n    queries to conjoin.",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "queries": {
         "items": {
            "anyOf": [
               {
                  "$ref": "#/$defs/QueryLE"
               },
               {
                  "$ref": "#/$defs/QueryGE"
               },
               {
                  "$ref": "#/$defs/QueryEquals"
               },
               {
                  "$ref": "#/$defs/Query"
               }
            ]
         },
         "title": "Queries",
         "type": "array"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      },
      "QueryEquals": {
         "description": "Class to represent a query of the form: var == value, where var is a variable, and value is a constant.\n\nParameters\n----------\nvariable : str\n    model variable name\nvalue : float\n    value\nat_end : bool, optional\n    apply the constraint to the last timepoint of a scenario only, by default False",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Variable"
            },
            "value": {
               "title": "Value",
               "type": "number"
            },
            "at_end": {
               "default": false,
               "title": "At End",
               "type": "boolean"
            }
         },
         "required": [
            "variable",
            "value"
         ],
         "title": "QueryEquals",
         "type": "object"
      },
      "QueryGE": {
         "description": "Class to represent a query of the form: var >= lb, where var is a variable, and lb is a constant lower bound.\n\nParameters\n----------\nvariable : str\n    model variable name\nlb : float\n    lower bound constant\nat_end : bool, optional\n    apply the constraint to the last timepoint of a scenario only, by default False",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Variable"
            },
            "lb": {
               "title": "Lb",
               "type": "number"
            },
            "at_end": {
               "default": false,
               "title": "At End",
               "type": "boolean"
            }
         },
         "required": [
            "variable",
            "lb"
         ],
         "title": "QueryGE",
         "type": "object"
      },
      "QueryLE": {
         "description": "Class to represent a query of the form: var <= ub, where var is a variable, and ub is a constant upper bound.\n\nParameters\n----------\nvariable : str\n    model variable name\nub : float\n    upper bound constant\nat_end : bool, optional\n    apply the constraint to the last timepoint of a scenario only, by default False",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Variable"
            },
            "ub": {
               "title": "Ub",
               "type": "number"
            },
            "at_end": {
               "default": false,
               "title": "At End",
               "type": "boolean"
            }
         },
         "required": [
            "variable",
            "ub"
         ],
         "title": "QueryLE",
         "type": "object"
      }
   },
   "required": [
      "queries"
   ]
}

Fields:
field queries: List[QueryLE | QueryGE | QueryEquals | Query] [Required]
pydantic model funman.model.query.QueryEncoded

Bases: Query

Class to contain a formula that is already encoded by a pysmt FNode.

Show JSON schema
{
   "title": "QueryEncoded",
   "description": "Class to contain a formula that is already encoded by a pysmt FNode.",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

Fields:

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pydantic model funman.model.query.QueryEquals

Bases: Query

Class to represent a query of the form: var == value, where var is a variable, and value is a constant.

Parameters:
  • variable (str) – model variable name

  • value (float) – value

  • at_end (bool, optional) – apply the constraint to the last timepoint of a scenario only, by default False

Show JSON schema
{
   "title": "QueryEquals",
   "description": "Class to represent a query of the form: var == value, where var is a variable, and value is a constant.\n\nParameters\n----------\nvariable : str\n    model variable name\nvalue : float\n    value\nat_end : bool, optional\n    apply the constraint to the last timepoint of a scenario only, by default False",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "variable": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Variable"
      },
      "value": {
         "title": "Value",
         "type": "number"
      },
      "at_end": {
         "default": false,
         "title": "At End",
         "type": "boolean"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "variable",
      "value"
   ]
}

Fields:
field at_end: bool = False
field value: float [Required]
field variable: str | ModelSymbol [Required]
pydantic model funman.model.query.QueryFunction

Bases: Query

This query uses a Python function passed to the constructor to evaluate a query on the results of a scenario.

Show JSON schema
{
   "title": "QueryFunction",
   "description": "This query uses a Python function passed to the constructor to evaluate a query on the results of a scenario.",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "function": {
         "title": "Function",
         "type": "string"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      }
   },
   "required": [
      "function"
   ]
}

Fields:
field function: str [Required]
pydantic model funman.model.query.QueryGE

Bases: Query

Class to represent a query of the form: var >= lb, where var is a variable, and lb is a constant lower bound.

Parameters:
  • variable (str) – model variable name

  • lb (float) – lower bound constant

  • at_end (bool, optional) – apply the constraint to the last timepoint of a scenario only, by default False

Show JSON schema
{
   "title": "QueryGE",
   "description": "Class to represent a query of the form: var >= lb, where var is a variable, and lb is a constant lower bound.\n\nParameters\n----------\nvariable : str\n    model variable name\nlb : float\n    lower bound constant\nat_end : bool, optional\n    apply the constraint to the last timepoint of a scenario only, by default False",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "variable": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Variable"
      },
      "lb": {
         "title": "Lb",
         "type": "number"
      },
      "at_end": {
         "default": false,
         "title": "At End",
         "type": "boolean"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "variable",
      "lb"
   ]
}

Fields:
field at_end: bool = False
field lb: float [Required]
field variable: str | ModelSymbol [Required]
pydantic model funman.model.query.QueryLE

Bases: Query

Class to represent a query of the form: var <= ub, where var is a variable, and ub is a constant upper bound.

Parameters:
  • variable (str) – model variable name

  • ub (float) – upper bound constant

  • at_end (bool, optional) – apply the constraint to the last timepoint of a scenario only, by default False

Show JSON schema
{
   "title": "QueryLE",
   "description": "Class to represent a query of the form: var <= ub, where var is a variable, and ub is a constant upper bound.\n\nParameters\n----------\nvariable : str\n    model variable name\nub : float\n    upper bound constant\nat_end : bool, optional\n    apply the constraint to the last timepoint of a scenario only, by default False",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "variable": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Variable"
      },
      "ub": {
         "title": "Ub",
         "type": "number"
      },
      "at_end": {
         "default": false,
         "title": "At End",
         "type": "boolean"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "variable",
      "ub"
   ]
}

Fields:
field at_end: bool = False
field ub: float [Required]
field variable: str | ModelSymbol [Required]
pydantic model funman.model.query.QueryTrue

Bases: Query

Query that represents logical true. I.e., this query does not place any additional constraints upon a model.

Show JSON schema
{
   "title": "QueryTrue",
   "description": "Query that represents logical true.  I.e., this query does not place any additional constraints upon a model.",
   "type": "object",
   "properties": {
      "model": {
         "anyOf": [
            {
               "$ref": "#/$defs/FunmanModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Config:
  • extra: str = forbid

Fields:
field model: FunmanModel | None = None

funman.model.regnet module

Inheritance diagram of funman.model.regnet

pydantic model funman.model.regnet.AbstractRegnetModel

Bases: FunmanModel

Show JSON schema
{
   "title": "AbstractRegnetModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      }
   }
}

Config:
  • allow_inf_nan: bool = True

Fields:
field init_values: Dict[str, float] = {}
field name: str = 'model_a6f04917-34c0-45e0-a42c-128947736090'
field parameter_bounds: Dict[str, List[float]] = {}
default_encoder(config: FUNMANConfig, scenario: AnalysisScenario) Encoder

Return the default Encoder for the model

Returns:

SMT encoder for model

Return type:

Encoder

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.model.regnet.GeneratedRegnetModel

Bases: AbstractRegnetModel

Show JSON schema
{
   "title": "GeneratedRegnetModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "regnet": {
         "$ref": "#/$defs/Model"
      }
   },
   "$defs": {
      "BaseProperties": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "rate_constant": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ParamOrNumber"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "BaseProperties",
         "type": "object"
      },
      "Distribution": {
         "properties": {
            "type": {
               "title": "Type",
               "type": "string"
            },
            "parameters": {
               "title": "Parameters",
               "type": "object"
            }
         },
         "required": [
            "type",
            "parameters"
         ],
         "title": "Distribution",
         "type": "object"
      },
      "Edge": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "sign": {
               "title": "Sign",
               "type": "boolean"
            },
            "source": {
               "title": "Source",
               "type": "string"
            },
            "target": {
               "title": "Target",
               "type": "string"
            },
            "properties": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BaseProperties"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id",
            "sign",
            "source",
            "target"
         ],
         "title": "Edge",
         "type": "object"
      },
      "Grounding": {
         "additionalProperties": false,
         "properties": {
            "identifiers": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Identifiers"
            },
            "modifiers": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Modifiers"
            }
         },
         "title": "Grounding",
         "type": "object"
      },
      "Header": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "schema": {
               "format": "uri",
               "minLength": 1,
               "title": "Schema",
               "type": "string"
            },
            "schema_name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Schema Name"
            },
            "description": {
               "title": "Description",
               "type": "string"
            },
            "model_version": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Model Version"
            }
         },
         "required": [
            "name",
            "schema",
            "description"
         ],
         "title": "Header",
         "type": "object"
      },
      "Model": {
         "properties": {
            "header": {
               "$ref": "#/$defs/Header"
            },
            "properties": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Properties"
            },
            "model": {
               "$ref": "#/$defs/Model1"
            },
            "metadata": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "(Optional) Information not useful for execution of the model, but that may be useful to some consumer in the future. E.g. creation timestamp or source paper's author.",
               "title": "Metadata"
            }
         },
         "required": [
            "header",
            "model"
         ],
         "title": "Model",
         "type": "object"
      },
      "Model1": {
         "additionalProperties": false,
         "properties": {
            "vertices": {
               "items": {
                  "$ref": "#/$defs/Vertice"
               },
               "title": "Vertices",
               "type": "array"
            },
            "edges": {
               "items": {
                  "$ref": "#/$defs/Edge"
               },
               "title": "Edges",
               "type": "array"
            },
            "parameters": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Parameter"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Parameters"
            }
         },
         "required": [
            "vertices",
            "edges"
         ],
         "title": "Model1",
         "type": "object"
      },
      "ParamOrNumber": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            }
         ],
         "title": "ParamOrNumber"
      },
      "Parameter": {
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "distribution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Distribution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id"
         ],
         "title": "Parameter",
         "type": "object"
      },
      "Vertice": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "grounding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Grounding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "rate_constant": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ParamOrNumber"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "id": {
               "title": "Id",
               "type": "string"
            },
            "sign": {
               "title": "Sign",
               "type": "boolean"
            },
            "initial": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ParamOrNumber"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id",
            "sign"
         ],
         "title": "Vertice",
         "type": "object"
      }
   },
   "required": [
      "regnet"
   ]
}

Config:
  • allow_inf_nan: bool = True

Fields:
field regnet: Model [Required]
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.model.regnet.RegnetDynamics

Bases: BaseModel

Show JSON schema
{
   "title": "RegnetDynamics",
   "type": "object",
   "properties": {
      "json_graph": {
         "additionalProperties": {
            "anyOf": [
               {
                  "type": "string"
               },
               {
                  "additionalProperties": {
                     "items": {
                        "type": "object"
                     },
                     "type": "array"
                  },
                  "type": "object"
               }
            ]
         },
         "title": "Json Graph",
         "type": "object"
      }
   },
   "required": [
      "json_graph"
   ]
}

Fields:
field json_graph: Dict[str, str | Dict[str, List[Dict[str, Any]]]] [Required]
pydantic model funman.model.regnet.RegnetModel

Bases: AbstractRegnetModel

Show JSON schema
{
   "title": "RegnetModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "regnet": {
         "$ref": "#/$defs/RegnetDynamics"
      }
   },
   "$defs": {
      "RegnetDynamics": {
         "properties": {
            "json_graph": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "type": "string"
                     },
                     {
                        "additionalProperties": {
                           "items": {
                              "type": "object"
                           },
                           "type": "array"
                        },
                        "type": "object"
                     }
                  ]
               },
               "title": "Json Graph",
               "type": "object"
            }
         },
         "required": [
            "json_graph"
         ],
         "title": "RegnetDynamics",
         "type": "object"
      }
   },
   "required": [
      "regnet"
   ]
}

Config:
  • allow_inf_nan: bool = True

Fields:
field regnet: RegnetDynamics [Required]
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

to_dot(values={})

Create a dot object for visualizing the graph.

Returns:

The graph represented by self.

Return type:

graphviz.Digraph

funman.model.simulator module

Inheritance diagram of funman.model.simulator

This module defines classes that wrap a simulator to function as a Model.

pydantic model funman.model.simulator.SimulatorModel

Bases: FunmanModel

Show JSON schema
{
   "title": "SimulatorModel",
   "type": "object",
   "properties": {
      "name": {
         "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
         "title": "Name",
         "type": "string"
      },
      "init_values": {
         "additionalProperties": {
            "type": "number"
         },
         "default": {},
         "title": "Init Values",
         "type": "object"
      },
      "parameter_bounds": {
         "additionalProperties": {
            "items": {
               "type": "number"
            },
            "type": "array"
         },
         "default": {},
         "title": "Parameter Bounds",
         "type": "object"
      },
      "main_fn": {
         "default": "",
         "title": "Main Fn",
         "type": "string"
      }
   }
}

Config:
  • allow_inf_nan: bool = True

Fields:
field main_fn: str = ''
default_encoder() Encoder

Simulators do not rely on encodings, so return a generic encoder.

Returns:

_description_

Return type:

Encoder

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

Module contents

This module contains class definitions used to represent and interact with models in FUNMAN. The submodules include:

  • model: abstract classes for representing models

  • query: classes for representing model queries

  • bilayer: classes for bilayer models

  • gromet: classes for GroMet models

  • encoded: classes for models (hand) encoded directly as SMT formulas

  • simulator: classes to wrap simulators as models