Skip to content

Commit

Permalink
changed to constant interpolation to agree with the IDL version
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Reefe committed Oct 2, 2024
1 parent 9b426d5 commit 83f5faa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/frebin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function _frebin(image::AbstractArray{T}, nsout::S, nlout::S, total::Bool) where
if (nsout % ns == 0) && (nlout % nl == 0)
xindex = (1:nsout) / (nsout/ns)
if isone(nl) # 1D case, linear interpolation
interpfunc = extrapolate(interpolate(image, BSpline(Linear())), Flat())
interpfunc = extrapolate(interpolate(image, BSpline(Constant())), Flat())
return interpfunc(xindex) * (total ? sbox : 1.)
end
yindex = (1:nlout) / (nlout/nl)
interpfunc = extrapolate(interpolate(image, BSpline(Linear())), Flat())
interpfunc = extrapolate(interpolate(image, BSpline(Constant())), Flat())
return [interpfunc(x, y) for x in xindex, y in yindex] .* (total ? sbox.*lbox : 1.)
end

Expand Down Expand Up @@ -138,7 +138,7 @@ julia> sum(im1)
### Notes ###
If the input image sizes are a multiple of the output image sizes
then `frebin` is equivalent to the julia Interpolations.jl functions for
then `frebin` is equivalent to summing over the grid multiples for
compression, and simple pixel duplication on expansion.
If the number of output pixels are not integers, the output image
Expand Down

0 comments on commit 83f5faa

Please sign in to comment.