https://fiona1729.com/posts/imaging-squarewaves/