RF: refactor imports to standard order

Put imports in standard order; use relative imports where possible.
RF: remove binary_threshold

binary threshold is a one-liner in numpy; use that line instead.