anchor.diff:  
     end function stats_mean
   
  -  ! Calculate median
     real(dp) function stats_median(data_arr, mask) result(val)
  -
  +    ! Calculate median
  +    !
  +    ! data_arr :: array of data values
  +    ! mask :: logical masking array
       real(dp), intent(in) :: data_arr(:)
       logical, intent(in), optional :: mask(:)
   
  
positive.code: 
    end function stats_mean_sq_err
  
    ! Calculate variance
    real(dp) function stats_variance(data_arr, mask) result(val)
      real(dp), intent(in) :: data_arr(:)
      logical, intent(in), optional :: mask(:)
  
  
negative.code: 
    end function stats_median
  
    real(dp) function stats_mean_abs_err(resid_arr, mask) result(val)
      ! Calculate mean absolute error from residuals
      !
      ! resid_arr :: residual array
      ! mask :: logical masking array
      real(dp), intent(in) :: resid_arr(:)
      logical, intent(in), optional :: mask(:)
  
  