From 423146f981caf0d9e83401ae51785049aa584128 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Sun, 10 May 2020 14:37:50 +0900 Subject: [PATCH] rm unused tests --- test/documents/FIR_design.jl | 80 ------------- test/documents/FIR_design_ref.md | 112 ------------------ .../output/gadfly_formats_test_ref.txt | 56 --------- test/documents/publish/publish_test.html.ref | 23 ---- test/documents/publish/publish_tex.tex.ref | 26 ---- test/documents/publish_test.jmd | 17 --- test/documents/pyplot_formats.txt | 29 ----- test/documents/pyplot_formats_ref | 74 ------------ test/documents/pyplot_formats_ref.md | 64 ---------- test/documents/pyplot_formats_ref.rst | 85 ------------- test/documents/pyplot_formats_ref.tex | 59 --------- test/gadfly_formats.jl | 2 +- test/publish_test.jl | 17 --- test/pyplot_formats.jl | 33 ------ 14 files changed, 1 insertion(+), 676 deletions(-) delete mode 100644 test/documents/FIR_design.jl delete mode 100644 test/documents/FIR_design_ref.md delete mode 100644 test/documents/output/gadfly_formats_test_ref.txt delete mode 100644 test/documents/publish/publish_test.html.ref delete mode 100644 test/documents/publish/publish_tex.tex.ref delete mode 100644 test/documents/publish_test.jmd delete mode 100644 test/documents/pyplot_formats.txt delete mode 100644 test/documents/pyplot_formats_ref delete mode 100644 test/documents/pyplot_formats_ref.md delete mode 100644 test/documents/pyplot_formats_ref.rst delete mode 100644 test/documents/pyplot_formats_ref.tex delete mode 100644 test/publish_test.jl delete mode 100644 test/pyplot_formats.jl diff --git a/test/documents/FIR_design.jl b/test/documents/FIR_design.jl deleted file mode 100644 index 1daa97b..0000000 --- a/test/documents/FIR_design.jl +++ /dev/null @@ -1,80 +0,0 @@ -#' % FIR filter design with Julia -#' % Matti Pastell -#' % 21th April 2016 - -#' # Introduction - -#' This an example of a julia script that can be published using -#' [Weave](http://mpastell.github.io/Weave.jl/latest/usage/). -#' The script can be executed normally using Julia -#' or published to HTML or pdf with Weave. -#' Text is written in markdown in lines starting with "`#'` " and code -#' is executed and results are included in the published document. - -#' Notice that you don't need to define chunk options, but you can using -#' `#+`. just before code e.g. `#+ term=True, caption='Fancy plots.'`. -#' If you're viewing the published version have a look at the -#' [source](FIR_design.jl) to see the markup. - - -#' # FIR Filter Design - -#' We'll implement lowpass, highpass and ' bandpass FIR filters. If -#' you want to read more about DSP I highly recommend [The Scientist -#' and Engineer's Guide to Digital Signal -#' Processing](http://www.dspguide.com/) which is freely available -#' online. - -#' ## Calculating frequency response - -#' DSP.jl package doesn't (yet) have a method to calculate the -#' the frequency response of a FIR filter so we define it: - -using Gadfly, DSP - -function FIRfreqz(b::Array, w = range(0, stop=π, length=1024)) - n = length(w) - h = Array{ComplexF32}(n) - sw = 0 - for i = 1:n - for j = 1:length(b) - sw += b[j]*exp(-im*w[i])^-j - end - h[i] = sw - sw = 0 - end - return h -end - - -#' ## Design Lowpass FIR filter - -#' Designing a lowpass FIR filter is very simple to do with DSP.jl, all you -#' need to do is to define the window length, cut off frequency and the -#' window. We will define a lowpass filter with cut off frequency at 5Hz for a signal -#' sampled at 20 Hz. -#' We will use the Hamming window, which is defined as: -#' $w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and $\beta=0.46$ - - -fs = 20 -f = digitalfilter(Lowpass(5, fs = fs), FIRWindow(hamming(61))) -w = range(0, stop=pi, length=1024) -h = FIRfreqz(f, w) - -#' ## Plot the frequency and impulse response - -h_db = log10(abs(h)) -ws = w/pi*(fs/2) - -#' The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax. -#+ term=true - -plot(y = h_db, x = ws, Geom.line, - Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)")) - -#' And again with default options - -h_phase = unwrap(-atan(imag(h),real(h))) -plot(y = h_phase, x = ws, Geom.line, - Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Phase (radians)")) diff --git a/test/documents/FIR_design_ref.md b/test/documents/FIR_design_ref.md deleted file mode 100644 index 2090477..0000000 --- a/test/documents/FIR_design_ref.md +++ /dev/null @@ -1,112 +0,0 @@ -% FIR filter design with Julia -% Matti Pastell -% 21th April 2016 - -# Introduction - -This an example of a julia script that can be published using -[Weave](http://mpastell.github.io/Weave.jl/latest/usage/). -The script can be executed normally using Julia -or published to HTML or pdf with Weave. -Text is written in markdown in lines starting with "`#'` " and code -is executed and results are included in the published document. - -Notice that you don't need to define chunk options, but you can using -`#+`. just before code e.g. `#+ term=True, caption='Fancy plots.'`. -If you're viewing the published version have a look at the -[source](FIR_design.jl) to see the markup. - - -# FIR Filter Design - -We'll implement lowpass, highpass and ' bandpass FIR filters. If -you want to read more about DSP I highly recommend [The Scientist -and Engineer's Guide to Digital Signal -Processing](http://www.dspguide.com/) which is freely available -online. - -## Calculating frequency response - -DSP.jl package doesn't (yet) have a method to calculate the -the frequency response of a FIR filter so we define it: - - -~~~~{.julia} -using Gadfly, DSP - -function FIRfreqz(b::Array, w = linspace(0, π, 1024)) - n = length(w) - h = Array{Complex64}(n) - sw = 0 - for i = 1:n - for j = 1:length(b) - sw += b[j]*exp(-im*w[i])^-j - end - h[i] = sw - sw = 0 - end - return h -end -~~~~~~~~~~~~~ - - - - -## Design Lowpass FIR filter - -Designing a lowpass FIR filter is very simple to do with DSP.jl, all you -need to do is to define the window length, cut off frequency and the -window. We will define a lowpass filter with cut off frequency at 5Hz for a signal -sampled at 20 Hz. -We will use the Hamming window, which is defined as: -$w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and $\beta=0.46$ - - - -~~~~{.julia} -fs = 20 -f = digitalfilter(Lowpass(5, fs = fs), FIRWindow(hamming(61))) -w = linspace(0, pi, 1024) -h = FIRfreqz(f, w) -~~~~~~~~~~~~~ - - - - -## Plot the frequency and impulse response - - -~~~~{.julia} -h_db = log10(abs(h)) -ws = w/pi*(fs/2) -~~~~~~~~~~~~~ - - - - -The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax. - -~~~~{.julia} -julia> plot(y = h_db, x = ws, Geom.line, - Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)")) -Plot(...) - -~~~~~~~~~~~~~ - - -![](figures/FIR_design_4_1.png)\ - - - -And again with default options - - -~~~~{.julia} -h_phase = unwrap(-atan2(imag(h),real(h))) -plot(y = h_phase, x = ws, Geom.line, - Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Phase (radians)")) -~~~~~~~~~~~~~ - - -![](figures/FIR_design_5_1.png)\ - diff --git a/test/documents/output/gadfly_formats_test_ref.txt b/test/documents/output/gadfly_formats_test_ref.txt deleted file mode 100644 index 24f7026..0000000 --- a/test/documents/output/gadfly_formats_test_ref.txt +++ /dev/null @@ -1,56 +0,0 @@ -[source,julia] --------------------------------------- -using Gadfly -x = linspace(0, 2π, 200) -plot(x=x, y = sin(x), Geom.line) --------------------------------------- - - -image::figures/gadfly_formats_test_sin_fun_1.png[width=600,title="sin(x) function."] -image::figures/gadfly_formats_test_2_1.png[width=600,title="cos(x) function."] -image::figures/gadfly_formats_test_cos2_fun_1.png[width=600] - -[source,julia] --------------------------------------- -julia> x = linspace(0, 2π, 200) -200-element LinSpace{Float64}: - 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 - -julia> plot(x=x, y = sin(x), Geom.line) -Plot(...) - --------------------------------------- - - -image::figures/gadfly_formats_test_4_1.png[width=600] - -[source,julia] --------------------------------------- -julia> y = 20 -20 - -julia> plot(x=x, y = cos(x), Geom.line) -Plot(...) - --------------------------------------- - - -image::figures/gadfly_formats_test_4_2.png[width=600] - -[source,julia] --------------------------------------- -x = linspace(0, 2π, 200) -plot(x=x, y = sin(x), Geom.line) --------------------------------------- - - -image::figures/gadfly_formats_test_5_1.png[width=15cm] - -[source,julia] --------------------------------------- -y = 20 -plot(x=x, y = cos(x), Geom.line) --------------------------------------- - - -image::figures/gadfly_formats_test_5_2.png[width=15cm] diff --git a/test/documents/publish/publish_test.html.ref b/test/documents/publish/publish_test.html.ref deleted file mode 100644 index 92d86bf..0000000 --- a/test/documents/publish/publish_test.html.ref +++ /dev/null @@ -1,23 +0,0 @@ - -

Header

- -
-using Plots
-gr()
-scatter(1:10)
-
- - - - - -
-plot(1:10)
-
- - -
- -
Hello
-
- diff --git a/test/documents/publish/publish_tex.tex.ref b/test/documents/publish/publish_tex.tex.ref deleted file mode 100644 index 032db3d..0000000 --- a/test/documents/publish/publish_tex.tex.ref +++ /dev/null @@ -1,26 +0,0 @@ - -\section{Header} - -\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia} - -using Plots -gr() -scatter(1:10) - -\end{minted} - -\includegraphics[width=\linewidth]{figures/publish_test_1_1.pdf} - -\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia} - -plot(1:10) - -\end{minted} - -\begin{figure}[!h] -\center -\includegraphics[width=\linewidth]{figures/publish_test_somefig_1.pdf} -\caption{Hello} -\label{fig:somefig} -\end{figure} - diff --git a/test/documents/publish_test.jmd b/test/documents/publish_test.jmd deleted file mode 100644 index 164e6a2..0000000 --- a/test/documents/publish_test.jmd +++ /dev/null @@ -1,17 +0,0 @@ ---- -title : Test -author: Matti Pastell -date : today ---- - -# Header - -```julia -using Plots -gr() -scatter(1:10) -``` - -```julia; fig_cap = "Hello"; label = "somefig" -plot(1:10) -``` diff --git a/test/documents/pyplot_formats.txt b/test/documents/pyplot_formats.txt deleted file mode 100644 index 30b3b64..0000000 --- a/test/documents/pyplot_formats.txt +++ /dev/null @@ -1,29 +0,0 @@ - - - - -<>= -using PyPlot -x = linspace(0, 2π, 200) -plot(x, sin(x)) -@ - -<>= -plot(x, cos(x)) -@ - -<>= -plot(x, cos(2x)) -@ - -<>= -x = linspace(0, 2π, 200) -plot(x, sin(x)) -y = 20 -plot(x, cos(x)) -@ - -<>= -x = randn(100, 100) -contourf(x) -@ diff --git a/test/documents/pyplot_formats_ref b/test/documents/pyplot_formats_ref deleted file mode 100644 index 409a7d7..0000000 --- a/test/documents/pyplot_formats_ref +++ /dev/null @@ -1,74 +0,0 @@ - - - - -````julia -using PyPlot -x = linspace(0, 2π, 200) -plot(x, sin(x)) -```` - - -```` -1-element Array{Any,1}: - PyObject -```` - - -![sin(x) function.](figures/pyplot_formats_sin_fun_1.png) - - - -```` -1-element Array{Any,1}: - PyObject -```` - - -![cos(x) function.](figures/pyplot_formats_2_1.png) - - - -```` -1-element Array{Any,1}: - PyObject -```` - - -![](figures/pyplot_formats_cos2_fun_1.png) - - - -````julia -julia> x = linspace(0, 2π, 200) - -linspace(0.0,6.283185307179586,200) -julia> plot(x, sin(x)) - -1-element Array{Any,1}: - PyObject -julia> y = 20 - -20 -julia> plot(x, cos(x)) -1-element Array{Any,1}: - PyObject -```` - - -![](figures/pyplot_formats_4_1.png) - - - -````julia -x = randn(100, 100) -contourf(x) -```` - - -```` -PyObject -```` - - -![](figures/pyplot_formats_5_1.png) diff --git a/test/documents/pyplot_formats_ref.md b/test/documents/pyplot_formats_ref.md deleted file mode 100644 index bd96550..0000000 --- a/test/documents/pyplot_formats_ref.md +++ /dev/null @@ -1,64 +0,0 @@ -````julia -using PyPlot -x = range(0, stop=2π, length=200) -plot(x, sin(x)) -```` - - -```` -1-element Array{Any,1}: - PyObject -```` - - -![sin(x) function.](figures/pyplot_formats_sin_fun_1.png) - -```` -1-element Array{Any,1}: - PyObject -```` - - -![cos(x) function.](figures/pyplot_formats_2_1.png) - -```` -1-element Array{Any,1}: - PyObject -```` - - -![](figures/pyplot_formats_cos2_fun_1.png) - -````julia -julia> x = range(0, stop=2π, length=200) -200-element LinSpace{Float64}: - 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 - -julia> plot(x, sin(x)) -1-element Array{Any,1}: - PyObject - -julia> y = 20 -20 - -julia> plot(x, cos(x)) -1-element Array{Any,1}: - PyObject - -```` - - -![](figures/pyplot_formats_4_1.png) - -````julia -x = randn(100, 100) -contourf(x) -```` - - -```` -PyObject -```` - - -![](figures/pyplot_formats_5_1.png) diff --git a/test/documents/pyplot_formats_ref.rst b/test/documents/pyplot_formats_ref.rst deleted file mode 100644 index 7d6f834..0000000 --- a/test/documents/pyplot_formats_ref.rst +++ /dev/null @@ -1,85 +0,0 @@ -.. code-block:: julia - - using PyPlot - x = linspace(0, 2π, 200) - plot(x, sin(x)) - - - -:: - - 1-element Array{Any,1}: - PyObject - - - -.. figure:: figures/pyplot_formats_sin_fun_1.svg - :width: 15 cm - - sin(x) function. - - -:: - - 1-element Array{Any,1}: - PyObject - - - -.. figure:: figures/pyplot_formats_2_1.svg - :width: 15 cm - - cos(x) function. - - -:: - - 1-element Array{Any,1}: - PyObject - - - -.. image:: figures/pyplot_formats_cos2_fun_1.svg - :width: 15 cm - - -.. code-block:: julia - -julia> x = linspace(0, 2π, 200) -200-element LinSpace{Float64}: - 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 - -julia> plot(x, sin(x)) -1-element Array{Any,1}: - PyObject - -julia> y = 20 -20 - -julia> plot(x, cos(x)) -1-element Array{Any,1}: - PyObject - - - - -.. image:: figures/pyplot_formats_4_1.svg - :width: 15 cm - - -.. code-block:: julia - - x = randn(100, 100) - contourf(x) - - - -:: - - PyObject - - - -.. image:: figures/pyplot_formats_5_1.svg - :width: 15cm - diff --git a/test/documents/pyplot_formats_ref.tex b/test/documents/pyplot_formats_ref.tex deleted file mode 100644 index 4d9e3c1..0000000 --- a/test/documents/pyplot_formats_ref.tex +++ /dev/null @@ -1,59 +0,0 @@ -\begin{juliacode} -using PyPlot -x = linspace(0, 2π, 200) -plot(x, sin(x)) -\end{juliacode} -\begin{juliaout} -1-element Array{Any,1}: - PyObject -\end{juliaout} -\begin{figure}[ht] -\center -\includegraphics[width=\linewidth]{figures/pyplot_formats_sin_fun_1.pdf} -\caption{sin(x) function.} -\label{fig:sin_fun} -\end{figure} - -\begin{juliaout} -1-element Array{Any,1}: - PyObject -\end{juliaout} -\begin{figure}[htpb] -\center -\includegraphics[width=\linewidth]{figures/pyplot_formats_2_1.pdf} -\caption{cos(x) function.} -\end{figure} - -\begin{juliaout} -1-element Array{Any,1}: - PyObject -\end{juliaout} -\includegraphics[width=\linewidth]{figures/pyplot_formats_cos2_fun_1.pdf} - -\begin{juliaterm} -julia> x = linspace(0, 2π, 200) -200-element LinSpace{Float64}: - 0.0,0.0315738,0.0631476,0.0947214,0.126295,…,6.18846,6.22004,6.25161,6.28319 - -julia> plot(x, sin(x)) -1-element Array{Any,1}: - PyObject - -julia> y = 20 -20 - -julia> plot(x, cos(x)) -1-element Array{Any,1}: - PyObject - -\end{juliaterm} -\includegraphics[width=\linewidth]{figures/pyplot_formats_4_1.pdf} - -\begin{juliacode} -x = randn(100, 100) -contourf(x) -\end{juliacode} -\begin{juliaout} -PyObject -\end{juliaout} -\includegraphics[width=15cm]{figures/pyplot_formats_5_1.pdf} diff --git a/test/gadfly_formats.jl b/test/gadfly_formats.jl index d2a32b2..b666ea0 100644 --- a/test/gadfly_formats.jl +++ b/test/gadfly_formats.jl @@ -1,6 +1,6 @@ # Test for Gadfly with different chunk options and figure formatsusing Weave -using Gadfly +using Gadfly, Cairo function test_gadfly(doctype, fig_ext) diff --git a/test/publish_test.jl b/test/publish_test.jl deleted file mode 100644 index d3404ec..0000000 --- a/test/publish_test.jl +++ /dev/null @@ -1,17 +0,0 @@ -using Weave -using Test -import Plots - -function publish_test(outfile, format) - outfile = joinpath("documents/publish", outfile) - infile = "documents/publish_test.jmd" - weave(infile, doctype = format, out_path = outfile, template = "templates/mini.tpl") - result = read(outfile, String) - ref = read(outfile * ".ref", String) - @test result == ref - rm(outfile) -end - -#Test formatters -publish_test("publish_tex.tex", "md2tex") -#!is_windows() && publish_test("publish_test.html", "md2html") diff --git a/test/pyplot_formats.jl b/test/pyplot_formats.jl deleted file mode 100644 index a81c10c..0000000 --- a/test/pyplot_formats.jl +++ /dev/null @@ -1,33 +0,0 @@ -using Weave -using Test - -cleanup = true - -weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="tex") -result = read("documents/pyplot_formats.tex", String) -ref = read("documents/pyplot_formats_ref.tex", String) -result = replace(result, r"\s*PyObject.*\n", "\n") #Remove PyObjects, because they change -ref = replace(ref, r"\s*PyObject.*\n", "\n") -@test result == ref - -weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="github") -result = read("documents/pyplot_formats.md", String) -ref = read("documents/pyplot_formats_ref.md", String) -result = replace(result, r"\s*PyObject.*\n", "") -ref = replace(ref, r"\s*PyObject.*\n", "") -@test result == ref - - -weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="rst", fig_ext=".svg") -result = read("documents/pyplot_formats.rst", String) -ref = read("documents/pyplot_formats_ref.rst", String) -result = replace(result, r"\s*PyObject.*\n", "") -ref = replace(ref, r"\s*PyObject.*\n", "") -@test result == ref - -if cleanup - rm("documents/pyplot_formats.tex") - rm("documents/pyplot_formats.rst") - rm("documents/pyplot_formats.md") - rm("documents/figures", recursive = true) -end