cadCAD Project Templating for the Labs Platform

cadCAD Project Templating

The cadCAD Command Line Interface (CLI) now supports additional project templates, including native support for the Blockscience Labs specific template. Project templating simplifies creating models with a boilerplate scaffold of an experiment file and directory structure. By using templates, modelers can ensure consistent and dependable cadCAD experiments for their models.

Blockscience Labs Templating

The Blockscience Labs template makes it easy to make sure that the cadCAD models you create run on the Labs platform. With the Labs template, you get a structured model directory and the required labs.py pre-built and ready for you to use. In addition, you also get demo Jupyter notebooks showcasing Labs functionality for pulling results from Labs simulations, importing CSVs into notebooks, and running experiments in notebooks.

Soon, the process of building models using the Labs template will be a few simple clicks within the Labs Platform. Until then, you can start today with the Labs template following the steps in this guide on the cadCAD CLI and scaffold your projects.

Install the cadCAD CLI

You can find the CLI here. Included are installation instructions for your specific operating system.

Scaffold a new project

First, create a new directory for your model:

mkdir my-model

Next, from inside that new directory, invoke the cadCAD CLI by specifying the Labs template:

cadcad-cli --template=https://github.com/blockscience-labs/cadcad-template-labs

Optionally, you can install the Labs template for future use (negating the need to specify the URL with each scaffold):

cadcad-cli --install-template=https://github.com/blockscience-labs/cadcad-template-labs --name=labs

And scaffold with:

cadcad-cli --template=labs

The Labs-ready cadCAD Model

The Labs-ready model you scaffold from our template will be built against cadCAD 0.4.28 and will include the following:

1.     Directory containing a simple Robots and Marbles model

  • Modifiable files provide a starting point for your own model logic
    • config.py
    • psubs.py
    • state.py
    • update.py
  • Configured for 3 monte-carlo runs
  • model_id of ‘default’

2. labs.py

  • Required to run simulations on Blockscience Labs
  • Defines the parent directory containing all your model logic
  • Makes Experiment object available for simulation

3. Offline Execution Demo Jupyter Notebook

  • example-local.ipynb
  • example code demonstrating the offline execution of the model directly from within the notebook itself

4. Results and Import SDK Demo Jupyter Notebook

  • example-labs.ipynb
  • example code demonstrating using the Labs SDK for fetching simulation results directly from the Labs platform
  • an example demonstrating how to use the Labs SDK to import simulation results from an exported CSV file
    • example-data.csv containing pre-generated data that you can experiment with right away