New VenPy fork (Vensim + Python)

Use this forum to post Vensim related questions.
Post Reply
tomfid
Administrator
Posts: 3823
Joined: Wed May 24, 2006 4:54 am

New VenPy fork (Vensim + Python)

Post by tomfid »

VenPy is a Python wrapper for the Vensim dll, created by Patrick Breach. We've recently forked and updated the project at https://github.com/VensimOfficial/venpy. The new version supports sensitivity analysis and is a little more forgiving of variable naming, since Vensim is case insensitive.

VenPy takes a model, parameters, and basically anything you can issue as a dll command and returns Pandas dataframes of simulation output. Dataframes are super convenient because you can perform all kinds of analysis, plotting, aggregation, etc. with just a couple lines of code.

Probably of greatest interest is a new sample model+code that demonstrates how to automate a suite of experiments. We used this code to automate the creation of consequence tables for Structured Decision Making (https://www.structureddecisionmaking.or ... equences2/) about Chronic Wasting Disease (https://metasd.com/2022/02/modeling-chr ... g-disease/).

The code specifies a series of runs, with or without uncertainty, and generates heatmapped tables comparing metrics of interest across scenarios:
heatmap.png
heatmap.png (33.88 KiB) Viewed 20903 times
It also demonstrates use of seaborn (https://seaborn.pydata.org/) to visualize uncertainty in the outcomes:
consequence.png
consequence.png (49.7 KiB) Viewed 20903 times
Post Reply