org-arl / SignalAnalysis.jl

Signal analysis toolbox for Julia
MIT License
41 stars 10 forks source link

generic types and allocations in wigner #16

Closed baggepinnen closed 3 years ago

baggepinnen commented 3 years ago

This PR makes the computation of the WV spectrogram respect the element type of the input signal as well as reduces the amount of allocations and the runtime.

norm(S1.power - S2.power) was negligeble for S1 computed before the change and S2 after.

using SignalAnalysis, BenchmarkTools
x = randn(Float32, 10_000)
@btime tfd(signal(x, 1kHz), Wigner(nfft=1024, smooth=30, method=:CM1980, window=hamming))

412.963 ms (398649 allocations: 992.15 MiB) # before
227.651 ms (368657 allocations: 341.88 MiB) # after
codecov-io commented 3 years ago

Codecov Report

Merging #16 (cff07c0) into master (2341a66) will decrease coverage by 0.06%. The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
- Coverage   78.87%   78.81%   -0.07%     
==========================================
  Files          10       10              
  Lines         606      609       +3     
==========================================
+ Hits          478      480       +2     
- Misses        128      129       +1     
Impacted Files Coverage Δ
src/tfa.jl 88.09% <94.44%> (-1.65%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2341a66...cff07c0. Read the comment docs.