Committing a working piecewise constant encoder/decoder (both notebook and python code)