Skip to content

Add findall_window - #225

Draft
timholy wants to merge 1 commit into
masterfrom
teh/findall_window
Draft

Add findall_window#225
timholy wants to merge 1 commit into
masterfrom
teh/findall_window

Conversation

@timholy

@timholy timholy commented Sep 3, 2021

Copy link
Copy Markdown
Member

Continued from #223

Closes #224

@timholy
timholy marked this pull request as draft September 3, 2021 09:34
@codecov

codecov Bot commented Sep 3, 2021

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.29%. Comparing base (02407fa) to head (7179644).
⚠️ Report is 44 commits behind head on master.

Files with missing lines Patch % Lines
src/findall_window.jl 0.00% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #225      +/-   ##
==========================================
- Coverage   91.60%   90.29%   -1.32%     
==========================================
  Files          11       12       +1     
  Lines        1513     1535      +22     
==========================================
  Hits         1386     1386              
- Misses        127      149      +22     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timholy timholy mentioned this pull request Sep 4, 2021
@johnnychen94

Copy link
Copy Markdown
Member

I haven't checked it very carefully, but maybe this is related to the performance gap to findlocalmaxima

function sum_window_mean_ver1(X)
    out = zero(float(eltype(X)))
    R = CartesianIndices(X)
    Δ = oneunit(eltype(R))
    @inbounds @simd for p in R
        window = max(p-Δ, first(R)):min(p+Δ, last(R))
        out += mean(view(X, window))
    end
    return out
end

function sum_window_mean_ver2(X)
    out = zero(float(eltype(X)))
    R = CartesianIndices(X)
    Δ = oneunit(eltype(R))
    @inbounds @simd for p in R
        window = max(p-Δ, first(R)):min(p+Δ, last(R))
        mean_val = zero(eltype(out))
        for q in window
            mean_val += X[q]
        end
        out += mean_val/length(window)
    end
    return out
end
julia> @btime sum_window_mean_ver1($X);
  164.748 μs (0 allocations: 0 bytes)
julia> @btime sum_window_mean_ver2($X)
  64.137 μs (0 allocations: 0 bytes)

@timholy

timholy commented Sep 13, 2021

Copy link
Copy Markdown
Member Author

Did you try creating your own mean function in case it's something about the one in Statistics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

introduce a findall version of mapwindow

2 participants