docs: def norm(a, ref1, ref2):
      """
      Normalize `a` with min/max values of `ref1`, using all elements of
      `ref1` where the `ref1` and `ref2` are not nan or inf"""
      ref = ref1[valid(ref1, ref2)]
      return (a-ref.min())/(ref.max()-ref.min())