Skip to content

Commit 36fc9d7

Browse files
committed
fix broadccasting
1 parent 46f4bb3 commit 36fc9d7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/core.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ abstract type PSFModel{T} <: AbstractMatrix{T} end
2929
# getindex just calls model with reversed indices
3030
Base.getindex(model::PSFModel, idx::Vararg{<:Integer,2}) = model(reverse(idx))
3131
# always inbounds
32-
Base.checkbounds(::Type{Bool}, ::PSFModel, idx::Vararg{Int,2}) = true
32+
Base.checkbounds(::Type{Bool}, ::PSFModel, idx) = true
33+
Base.checkbounds(::Type{Bool}, ::PSFModel, idx...) = true
3334

3435
# broadcasting hack to slurp other axes (doesn't work for numbers)
35-
Broadcast.combine_axes(psf::PSFModel, other::AbstractMatrix) = axes(other)#map(intersect, axes(other), axes(psf))
36-
Broadcast.combine_axes(other::AbstractMatrix, psf::PSFModel) = map(intersect, axes(other), axes(psf))
36+
Broadcast.combine_axes(psf::PSFModel, other::AbstractMatrix) = axes(other)
37+
Broadcast.combine_axes(other::AbstractMatrix, psf::PSFModel) = axes(other)
3738

3839
## get the position depending on the keyword inputs
3940
function _position(nt::NamedTuple{(:r, :theta)})

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function test_model_interface(K)
2121

2222
# broadcasting to an array that's smaller
2323
@test m .* ones(10, 10) ones(10, 10) .* m m[1:10, 1:10]
24-
# broadcasting to a larger array cuts out a stamp
25-
@test m .* ones(30, 30) ones(30, 30) .* m m[1:15, 1:15]
24+
# broadcasting to a larger array
25+
@test m .* ones(30, 30) ones(30, 30) .* m m[1:30, 1:30]
2626

2727
# test new position
2828
m = K(x=12, y=13, fwhm=10)

0 commit comments

Comments
 (0)