-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tlnagy/tn/1.0-update
Update for Julia 1.0
- Loading branch information
Showing
5 changed files
with
73 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
# Hilbert | ||
# Hilbert.jl | ||
|
||
Compute the Hilbert transform of a signal in Julia. | ||
|
||
```julia | ||
julia> using Hilbert | ||
|
||
julia> signal = [1 2 3 4] | ||
1×4 Array{Int64,2}: | ||
1 2 3 4 | ||
|
||
julia> hilbert(signal) | ||
1×4 Array{Complex{Float64},2}: | ||
1.0+1.0im 2.0-1.0im 3.0-1.0im 4.0+1.0im | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
julia 0.4 | ||
julia 0.7 | ||
FFTW |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
using Hilbert | ||
using Base.Test | ||
using Test | ||
|
||
# write your own tests here | ||
@test 1 == 1 | ||
# Example from https://www.mathworks.com/help/signal/ref/hilbert.html | ||
@testset "Real vector" begin | ||
signal = [1 2 3 4] | ||
analytical_signal = hilbert(signal) | ||
@test analytical_signal == [1+1im 2-1im 3-1im 4+im] | ||
end | ||
|
||
@testset "Complex numbers" begin | ||
complex_signal = Complex.([1 2 3 4]) | ||
# verify that the warning is thrown | ||
@test_logs (:warn, "Using real part, ignoring complex part") hilbert(complex_signal) | ||
# verify that the output is correct assuming only the real part is used | ||
analytical_signal = hilbert(complex_signal) | ||
@test analytical_signal == [1+1im 2-1im 3-1im 4+im] | ||
end |