If you read a few lines further, you'll see that many of the ``elif`` clauses build on the ramp filter. My motivation for placing the ``np.abs`` call outside the ``if`` blocks was to avoid code duplication.