SED from Cube code

Made a pull request while I work on this in case you have comments.
There's a few other lines nearby where `np.ones` can simply be removed, I think.