python/README.md

Python Communication

We provide examples of customizing data generation in causl and calling the function in Python.

Requirements

Ensure you have installed the Python package rpy2. If it’s not already installed, run:

pip install rpy2

Necessary files

You’ll need two files: 1. An .R file that defines and wraps the data-generation process. - Make sure the function returns the simulated data. - Expose any parameters you’d like to customize as function arguments so you can specify them when calling from Python. - See data_causl.R in this folder for an example.

  1. A .py file that defines the Python function for passing those parameters.
  2. We assume all data formats in Python use NumPy.
  3. Convert incoming NumPy arrays to the corresponding R types before calling your R function.
  4. See data_causl.py in this folder for an example.


rje42/causl documentation built on June 1, 2025, 2:50 p.m.