RSSAmplifier

Blog

Hessam's blog

hessammehr.github.ioRSS feed ↗20 posts

Latest posts

Ancestral sampling with variational relaxation

This post is an interactive HTML document. Read it on Hessam's blog.

Exploration: Flow matching, NeuTraHMC and normalizing flow guides in NumPyro

This post is an interactive HTML document. Read it on Hessam's blog.

First bee sighting of 2026

First bee sighting of 2026 Honey bee on Waterloo bridge I was crossing the Waterloo bridge to go to a seminar when I saw my first bee of 2026. Most years this would be a big fuzzy bumble bee but this time it’s a honey bee. What a wonderful little friend to see; it made my day. :)

Nice strange attractor visualisation

Nice strange attractor visualisation Strange attractor visualisation using THREE.js Zensical is a new static site generator implemented in Python that I heard mentioned on the Talk Python to Me podcast. The website features a stunning mathematical visualisation that I was able to extract into a GitHub pages website , using Claude Opus 4.6 (low) via Pi . The parameters involved in the differential…

Draft: Evolving interactions with AI in 2026

Draft: Evolving interactions with AI in 2026 My 2025 year in summary according to ChatGPT Living through the first couple of weeks of 2026 it is clear, whether I like it or not, that it will be yet another year dominated by AI. I have to be honest, looking back, this growing presence is something I’ve had mixed feelings about, having gone through the usual cycles of excitement, epiphany,…

Draft: Thinking about aerosols probabilistically — Part 1: Evaporation

This post is an interactive HTML document. Read it on Hessam's blog.

A little snippet for nicer plots using matplotlib

A little snippet for nicer plots using matplotlib If you’ve seen previous blog posts (or read any of our group papers ) you may have noticed the plots have a consistent look. import seaborn as sns from matplotlib import pyplot as plt The default matplotlib look plt.plot([1,2,5,3]) [<matplotlib.lines.Line2D at 0x11530e960>] png Not bad but try the following now from matplotlib_inline.backend_inline…

3D-printed mathematical lampshades

3D-printed mathematical lampshades Finished lampshade I’ve been playing with translucent PLA for lighting projects at home. Earlier this year, I built a diffuser/housing for our Lidl LED strip, since the light from the exposed LEDs was too cool and jarring. The design files are on OnShape , although they might need tweaking for the exact strip and required installation area. A few viral videos…

Using `uv` projects on a network share

Using uv projects on a network share The wondeful uv has a strong preference for virtual environments that are placed within a project tree rather than kept centrally a la conda. One unfortunate consequence of this is for projects stored on network shares, for us usually data analysis scripts and Jupyter/marimo notebooks for visualisation and as dashboards. Simply uv add ing numpy alone will dump…

Reparameterizing distributions in numpyro

Reparameterizing distributions in numpyro Every single time I’ve tried to “chance” it with probabilistic methods I am once again reminded that you can’t treat them like a black box. The following is a self-contained example of a pathological case so simple it almost feels like it should just work, and yet it fails miserably without intervention (in this case by reparameterizing the distributions).…

Live variational inference

Live variational inference This is mostly to show two possibilities: The ability to update the data going into a model in the course of running variational inference. Imagine you are accumulating data as you go, or (this is more technical/hacky) you find that your multimodal distributions get locked into a specific mode that the optimiser cannot escape and are looking for a way to “ease into” the…

Amortized probabilistic models for chemical microscopy

Amortized probabilistic models for chemical microscopy Can we used an amortized model to speed up inference in our droplet microscopy model? My last go using a probabilistic model to analyze a microscope image seemed to work well enough, but I wanted to take a more flexible approach to modelling the appearance of droplets without having to roll out a more sophisticated physical model. Also, it…

Trialing generative processes for chemical microscopy (part 2)

Trialing generative processes for chemical microscopy (part 2) Last time we used a very rigid generative model (droplets modeled as gaussians). This time we’ll use a learned representation of droplets. import jax import jax.numpy as jnp import matplotlib.pyplot as plt import numpy as np import numpyro.distributions as dist import seaborn as sns from numpyro import deterministic, plate, sample from…

Trialing generative processes for chemical microscopy (part 1)

Trialing generative processes for chemical microscopy (part 1) Is it possible to use a generative process to model microscope images like this (and is it worth the effort?) import jax import jax.numpy as jnp import matplotlib.pyplot as plt import numpy as np import numpyro.distributions as dist import seaborn as sns from numpyro import deterministic, plate, sample from numpyro.infer import MCMC,…

Simple generation of locally constrained values in `numpyro`

Simple generation of locally constrained values in numpyro Just a simple experiment using numpyro to simulate values from a function with locally constrained values. This is often achieved using Gaussian processed but I thought it would be interesting to try something a bit more intuitive, plus priors on the points themselves and their interdependence can be anything, not just normal…

A rant against macros

A rant against macros I used to be a huge fan of macros. I remember reading SICP and being amazed that you could use the language to generate and transform code. How cool is that? First a couple of examples: Clojure’s core.async library includes a go macro that lets you launch goroutine-like tasks without having to change the language. ;…

The case for lazy computation and interactive optimization

The case for lazy computation and interactive optimization Since 2018, my colleague Dario and I have been working on a probabilistic model of chemical reactivity. In a nutshell, this model can take reactivity observations between a bunch of compounds and interpret them as manifestations of properties and their mutual reactivities. The Markov chain Monte carlo implementation of this model in PyMC3…

Fertile land at the confluence of staged programming and (typed) logic programming — Part 1

Fertile land at the confluence of staged programming and (typed) logic programming — Part 1 I recently started sketching out a logic programming library called Logic.jl (it really is very much a sketch at the moment). As the name might imply, the library is implemented in Julia, which seems like an odd choice of implementation language. Choosing Julia and the twist on logic programming that I am…

Funny

Funny … Likewise, claiming JS is homoiconic because you can eval strings of code is nonsense. If that’s the only criteria for homoiconicity, then C is too, since you can treat an array of bytes as code and jump to it. From here .

A new way of doing chemistry

A new way of doing chemistry I’ve been thinking about a new way of doing chemistry. Take for example the case of growing crystals. In the more difficult cases, this involves trial and error using a number of educated guesses about the solvents and conditions. What if we had an algorithm that would decide the best procedure based on a database of molecular metrics, e.g., dipole moment, molecular…