Git Product home page Git Product logo

windowfunctions.jl's Introduction

WindowFunctions

Motivation

In both digital filter design and spectral estimation, the choice of a windowing function can play an important role in determining the quality of overall results. The main role of the window is to damp out the effects of the Gibbs phenomenon that resulted from truncation of an infinite series.

Methods

Function Window Type
barthann Modified Bartlett-Hann
bartlett Bartlett
blackman Blackman
blackmanharris Minimum four-term Blackman-Harris
bohman Bohman
cheb Chebyshev
flattop Flat top weighted
hamming Hamming
hanning Hann (Hanning)
nuttall Nuttall-defined minimum 4-term Blackman-Harris
parzen Parzen (de la Vallée Poussin)
rectangular Rectangular
triangular Triangular
tukey Tukey (tapered cosine)
taylor Taylor
gauss Gaussian
kaiser Kaiser
enbw Equivalent noise bandwidth

Installation

To install the released stable version, run

using Pkg
Pkg.add("WindowFunctions")

Example

using Plots
using WindowFunctions

kaiser5(N; dtype::DataType=Float32) = kaiser(N, 5.0, 10, dtype=dtype)

winlist = [barthann,
           bartlett,
           blackman,
           blackmanharris,
           bohman,
           flattop,
           hamming,
           hanning,
           nuttall,
           parzen,
           rectangular,
           triangular,
           gauss,
           tukey,
           kaiser5]

for win in winlist
    plot(win(256, dtype=Float32),
         label=string(win),
         fillrange = 0,
         fillalpha = 0.3,
         show=true)
    ylims!(-0.13,1.18)
    xlims!(1-20,256+20)
    sleep(1)
end

windowfunctions.jl's People

Contributors

sonosole avatar

Stargazers

 avatar  avatar

Watchers

 avatar

windowfunctions.jl's Issues

ERROR: Unsatisfiable requirements detected for package WindowFunctions [f8d1b8c8]

I cannot install "WindowFunctions" under:

Julia Version 1.8.0
Commit 5544a0fab7 (2022-08-17 13:38 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)

error message is:

(@v1.8) pkg> add WindowFunctions
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package WindowFunctions [f8d1b8c8]:
 WindowFunctions [f8d1b8c8] log:
 ├─possible versions are: 0.1.0 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 0.1.0
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left

Do you have any suggestions?

example code: ERROR: MethodError: no method matching barthann(::Int64; dtype=Float32)

Hi,

please check your example code, the execution fails on my computer with the following error message.

Regards,

Stefan

ERROR: MethodError: no method matching barthann(::Int64; dtype=Float32)
Closest candidates are:
  barthann(::Int64) at /home/stefan/.julia/packages/WindowFunctions/fYhHv/src/1-unary.jl:12 got unsupported keyword argument "dtype"
Stacktrace:
 [1] top-level scope
   @ /media/stefan/DATA/data/julia/tmp/test_windowfunctions.jl:20

Compatibility to RC

Please could you have a look? - It seems, as if there is a compatibility issue with your package and Julia v1.9.0RC2:

julia> import Pkg; Pkg.add("WindowFunctions")
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package WindowFunctions [f8d1b8c8]:
 WindowFunctions [f8d1b8c8] log:
 ├─possible versions are: 0.1.0-0.1.1 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-0.1.1
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left
Stacktrace:
  [1] propagate_constraints!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; log_events::Bool)
    @ Pkg.Resolve C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Resolve\graphtype.jl:1072
  [2] propagate_constraints! (repeats 2 times)
    @ C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Resolve\graphtype.jl:1008 [inlined]
  [3] simplify_graph!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; clean_graph::Bool)
    @ Pkg.Resolve C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Resolve\graphtype.jl:1533
  [4] simplify_graph! (repeats 2 times)
    @ C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Resolve\graphtype.jl:1532 [inlined]
  [5] resolve_versions!(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber, installed_only::Bool)
    @ Pkg.Operations C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:408
  [6] targeted_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
    @ Pkg.Operations C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1356
  [7] tiered_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber, try_all_installed::Bool)
    @ Pkg.Operations C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1345
  [8] _resolve(io::Base.TTY, env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
    @ Pkg.Operations C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1366
  [9] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
    @ Pkg.Operations C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1383
 [10] add
    @ C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1372 [inlined]
 [11] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
    @ Pkg.API C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:275
 [12] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:156
 [13] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:145
 [14] #add#25
    @ C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:144 [inlined]
 [15] add
    @ C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:144 [inlined]
 [16] #add#24
    @ C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:143 [inlined]
 [17] add(pkg::String)
    @ Pkg.API C:\bin\juliaRC\share\julia\stdlib\v1.9\Pkg\src\API.jl:143
 [18] top-level scope
    @ REPL[18]:1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.