Skip to content

Conversation

@rohan-bansal
Copy link
Contributor

Hello!

I did a deep dive into the GTSAM codebase and translated some examples from C++ to Python that haven't been done already - I also did my best to explain them in notebook format.

Additionally, I updated the README to check off files I saw implemented already.

Converted examples:

  • CreateSFMExampleData.cpp -> CreateSFMExampleData.ipynb
  • DiscreteBayesNetExample.cpp -> DiscreteBayesNetExample.ipynb
  • FisheyeExample.cpp -> FisheyeExample.ipynb
  • HMMExample.cpp -> HMMExample.ipynb
  • Pose2SLAMwSPCG.cpp -> Pose2SLAMwSPCG.ipynb
  • Pose2SLAMStressTest.cpp -> Pose2SLAMStressTest.ipynb

One thing I noticed were that ExpressionFactorGraph (and maybe some of the auto differentiation framework) is not exposed yet in Python, so I wasn't able to convert that example. I noted this in the README and would be happy to tackle adding this in the future. Other than Pose2SLAMExampleExpressions and Pose2SLAMExample_lago, all the Pose2 examples are now translated.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. Many thanks !!!!
Three requests:

  • the copyright cells are nice, but please add a cell tag "remove-cell" with the ... menu.
  • It would be nice the have an "Open in colab" button, like this in this example
  • That file also has a cell, again not shown on website as it has a "remove-cell" tag, that says:
try:
    import google.colab
    %pip install --quiet gtsam-develop
except ImportError:
    pass

Can you add that as well for Colab?
The easiest way is probably to copy the json and work in raw json, copying from the example I gave.

@rohan-bansal rohan-bansal changed the title Translated 6 More Python Examples 6 More Python Examples + Standardized Notebook Format Oct 19, 2025
@rohan-bansal
Copy link
Contributor Author

@dellaert I made the requested changes. I added a script python/gtsam/notebooks/standardize_notebooks.py, which, when run on a directory of python notebooks, will add the license (with remove-cell tag), the gtsam-develop import (with remove-cell tag), and the "Open in Colab" button!

I ran the script on all the notebooks in the example directory for now.

@rohan-bansal
Copy link
Contributor Author

Updated, script has been run on all of gtsam/*/doc/*

@dellaert
Copy link
Member

Incredible! Merging. (CI is irrelevant here)

@dellaert dellaert merged commit 67c921b into borglab:develop Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants