Visual Studio Code has the ability to debug mixed Python with C++ extensions. In this blog post, I give an example of how to get it working. I’m going to do the example from scratch in five steps: Make virtual environment. Chances are that, if you’re doing this kind of thing, you’ll be wanting to use a virtual environment too. Write code. My toy example … Continue reading Example debugging mixed Python C++ in VS Code
Meryl Theng just had a new paper published in Biological Conservation, where she estimated that 46% of Singapore’s butterfly species have been extirpated since 1854. The special thing about this estimate is that it includes all species that existed, including species that went extinct before we had a chance to discover them. The trick to estimating undiscovered extinctions is the SEUX model. There is a … Continue reading Extinction of undiscovered butterflies
In a recent project, I wanted to create a diagram of a repository for the appendix of a paper, including comments to highlight key files and explain how the folders were organised. I found this answer on Stack Exchange by user Gonzalo Medina, which I tweaked to produce the diagram below. The code is below: Continue reading Pretty diagram of directory structure
Update Jan 2020: E.M. Bray suggests a more elegant solution in the comments, see: https://ask.sagemath.org/question/7867/importing-sage-files/?answer=48947#post-id-48947. — Let’s say that I have created a bunch of Sage code — Sage functions etc. — that I wish to reuse by importing into various Sage scripts. In straight Python, one would put these functions into their own separate file and import them using the usual from foo import … Continue reading Import self-made Sage modules and functions into Sage script?
I’ve recently been working on a qualitative modelling project where I am trying to uncover “truths” about the response of species in an ecosystem to control of invasive species. Long story short, I’ve been looking into various boolean minimisation techniques. I’ve been playing with Python EDA, a Python library that I think provides a front-end to the Robert Brayton and Richard Rudell espresso heuristic logic … Continue reading “ValueError: expected a DNF expression” when trying espresso_exprs example from pyeda docs
The Automatic Differentiation package in Haskell can do some interesting things. Continue reading A reminder for later
I had an issue today where I wanted to create a custom .bst file for Biology Letters that would format as follows: 1. Parmesan C, Yohe G. 2003 A globally coherent fingerprint of climate change impacts across natural systems. Nature 421, 37–42. I was using makebst, incrementally editing my .dbj file, but I couldn’t seem to get that ‘.’ on the end of the author list … Continue reading Add period to end of last author (Biology Letters .bst)
I’ve finished up a draft module for Webworld (Drossel et al. 2001, J. Theor. Biol.) in Python that’s available for download: webworld.py It’s also available bundled with what you’ll need for an example run: webworld.tar.gz. Continue reading Webworld for Python