Example debugging mixed Python C++ in VS Code

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

Extinction of undiscovered butterflies + tutorial

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 + tutorial

Import self-made Sage modules and functions into Sage script?

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?

“ValueError: expected a DNF expression” when trying espresso_exprs example from pyeda docs

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

Add period to end of last author (Biology Letters .bst)

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)