Posts

Showing posts with the label python

Signal boost: Voronoi diagrams with SciPy

Image
[Link] Voronoi diagrams with SciPy  I was a bit confused by SciPy's documentation for its Voronoi class and wondering how I could easily draw the "infinite" regions from the output. After getting a somewhat verbose answer from ChatGPT, I decided to Google the question and found Voronoi diagrams with SciPy , by Martin McBride , which solved my problem. The solution is not different in spirit to ChatGPT's but it's simpler in my mind, so I went with it. The idea is to add the points of a very far off bounding box, then simply ignore regions with -1 vertices.

JIT and GIL removal are not even my most anticipated Python 3.13 features

     Fun story: I came to Python through data analysis - so I wasn't a "python/programming expert" - and for an unreasonably long time used exclusively csv, parquet (thanks to pandas) and later JSON to persist data from my projects (local projects, of course. Mongo, RDS and Athena were always there). At work this was 100% enough (mostly parquet), but it always felt a little clunky to use JSON for a quick cache, especially when said cache grew larger for longer running processes or longer projects. Opening, parsing then serializing back again becomes slow surprisingly fast.      Then after a few years I decided to start using SQLite. I knew it existed, but always felt like it was a bit of a hassle to define a schema and "get" and "set" functions in all projects just to have a basic persistent k-v functionality. It was OK and had the extra benefit of allowing me to safely check this cache on a different jupyter notebook process when running longer proce...