Random Thoughts in a Random Universe

Python and numpy Bool Types

This blog post is triggered by a colleague stopping me in the hall and asking “What does ~ do in Python?” She was surprised by the behavior of the ~ operator when applied to Python bool types and I was surprised that it behaved differently on numpy bools than on Python bools ...

Convergence of the Affine Invariant Ensemble Sampler

The Affine-Invariant Ensemble Sampler (AIES) is a Monte-Carlo method particularly popular in astrophysics. The paper describing its widely used Python implementation emcee is highly cited and the method is particularly popular because it has — aside from the number of walkers, i.e., the number of chains — no tunable parameters.

Huijser ...

Fun with Floating Point Precision in numpy

I recently had a bug in my code that obviously was caused by an issue with floating point precision but had me scratching my head how it came about. Here it is:

In [1]:
import numpy as np
from astropy.table import Table
from astropy import cosmology

cosmo = cosmology.WMAP9 ...