Fixed tests to match the new slightly different output

pull/37/head
= 2016-04-27 21:24:44 +03:00
parent e2da54fa54
commit 2681f19c19
15 changed files with 224 additions and 73 deletions

View File

@ -61,6 +61,7 @@ julia> set_chunk_defaults(Dict{Symbol, Any}(:dpi => 200, fig_width => 8))
"""
function set_chunk_defaults(opts::Dict{Symbol, Any})
merge!(rcParams[:chunk_defaults], opts)
return nothing
end
"""

View File

@ -64,11 +64,12 @@ 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
h_db = log10(abs(h))
ws = w/pi*(fs/2)
plot(y = h_db, x = ws, Geom.line,
Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)"))

View File

@ -75,42 +75,25 @@ 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>
h_db = log10(abs(h))
1024-element Array{Float32,1}:
0.0
-1.52727e-6
-6.03147e-6
-1.35386e-5
-2.39452e-5
-3.71738e-5
-5.31213e-5
-7.16583e-5
-9.25781e-5
-0.000115803
-3.21659
-3.18342
-3.15605
-3.13379
-3.11615
-3.10275
-3.09335
-3.08778
-3.08593
julia> ws = w/pi*(fs/2)
linspace(0.0,10.0,1024)
julia> plot(y = h_db, x = ws, Geom.line,
plot(y = h_db, x = ws, Geom.line,
Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)"))
~~~~~~~~~~~~~
![](figures/FIR_design_3_1.png)\
![](figures/FIR_design_4_1.png)\
@ -124,5 +107,5 @@ plot(y = h_phase, x = ws, Geom.line,
~~~~~~~~~~~~~
![](figures/FIR_design_4_1.png)\
![](figures/FIR_design_5_1.png)\

View File

@ -6,8 +6,8 @@ println(f(2))
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
4
~~~~~~~~~~~~~
~~~~

View File

@ -18,9 +18,9 @@ println(y)
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
[2,5,12]
~~~~~~~~~~~~~
~~~~
@ -29,24 +29,24 @@ println(x)
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
[12,10]
~~~~~~~~~~~~~
~~~~
~~~~{.julia}
~~~~
Results without code
~~~~~~~~~~~~~
~~~~
~~~~{.julia}
~~~~
[12,10]
~~~~~~~~~~~~~
~~~~
@ -68,9 +68,9 @@ println(y)
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
1:5
~~~~~~~~~~~~~
~~~~
@ -102,14 +102,14 @@ println(collect(0:10:1000))
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,2
10,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,
400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580
,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77
0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,9
60,970,980,990,1000]
~~~~~~~~~~~~~
~~~~
@ -120,9 +120,9 @@ println(collect(0:10:1000))
~~~~~~~~~~~~~
~~~~{.julia}[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990,1000]
~~~~[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990,1000]
~~~~~~~~~~~~~
~~~~
@ -133,7 +133,7 @@ println(collect(0:10:1000))
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,17
0,180,190,200,210,220,230,240,250,260,270,280,290,300,310,32
0,330,340,350,360,370,380,390,400,410,420,430,440,450,460,47
@ -141,6 +141,6 @@ println(collect(0:10:1000))
0,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77
0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,92
0,930,940,950,960,970,980,990,1000]
~~~~~~~~~~~~~
~~~~

View File

@ -33,7 +33,7 @@ println(x)
````
````julia
````
linspace(0.0,200.0,50)
````
@ -73,7 +73,7 @@ println(x)
````
````julia
````
linspace(0.0,200.0,50)
````

View File

@ -0,0 +1,74 @@
````julia
using PyPlot
x = linspace(0, 2π, 200)
plot(x, sin(x))
````
````
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326a4a290>
````
![sin(x) function.](figures/pyplot_formats_sin_fun_1.png)
````
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326a56c10>
````
![cos(x) function.](figures/pyplot_formats_2_1.png)
````
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326d76350>
````
![](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 <matplotlib.lines.Line2D object at 0x7f5326de8c10>
julia> y = 20
20
julia> plot(x, cos(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326de8e50>
````
![](figures/pyplot_formats_4_1.png)
````julia
x = randn(100, 100)
contourf(x)
````
````
PyObject <matplotlib.contour.QuadContourSet object at 0x7f53346d2910>
````
![](figures/pyplot_formats_5_1.png)

View File

@ -9,14 +9,32 @@ plot(x, sin(x))
````
````
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326a4a290>
````
![sin(x) function.](figures/pyplot_formats_sin_fun_1.png)
````
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326a56c10>
````
![cos(x) function.](figures/pyplot_formats_2_1.png)
````
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f5326d76350>
````
![](figures/pyplot_formats_cos2_fun_1.png)
@ -28,13 +46,13 @@ linspace(0.0,6.283185307179586,200)
julia> plot(x, sin(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe56d2dfef0>
PyObject <matplotlib.lines.Line2D object at 0x7f5326de8c10>
julia> y = 20
20
julia> plot(x, cos(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe56d2e4fd0>
PyObject <matplotlib.lines.Line2D object at 0x7f5326de8e50>
````
@ -48,4 +66,9 @@ contourf(x)
````
````
PyObject <matplotlib.contour.QuadContourSet object at 0x7f53346d2910>
````
![](figures/pyplot_formats_5_1.png)

View File

@ -10,6 +10,13 @@
::
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f9745111450>
.. figure:: figures/pyplot_formats_sin_fun_1.svg
:width: 15 cm
@ -18,6 +25,13 @@
::
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f9777e49990>
.. figure:: figures/pyplot_formats_2_1.svg
:width: 15 cm
@ -26,6 +40,13 @@
::
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7f9777d7b590>
.. image:: figures/pyplot_formats_cos2_fun_1.svg
:width: 15 cm
@ -40,13 +61,13 @@ linspace(0.0,6.283185307179586,200)
julia> plot(x, sin(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe5a9e74b70>
PyObject <matplotlib.lines.Line2D object at 0x7f9777c71190>
julia> y = 20
20
julia> plot(x, cos(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe5a9e7acf8>
PyObject <matplotlib.lines.Line2D object at 0x7f9777c71390>
@ -63,6 +84,12 @@ julia> plot(x, cos(x))
::
PyObject <matplotlib.contour.QuadContourSet object at 0x7f9777ba3510>
.. image:: figures/pyplot_formats_5_1.svg
:width: 15cm

View File

@ -7,6 +7,10 @@ using PyPlot
x = linspace(0, 2π, 200)
plot(x, sin(x))
\end{juliacode}
\begin{juliaout}
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe847179cd0>
\end{juliaout}
\begin{figure}[ht]
\center
\includegraphics[width=\linewidth]{figures/pyplot_formats_sin_fun_1.pdf}
@ -16,6 +20,10 @@ plot(x, sin(x))
\begin{juliaout}
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe846fb2950>
\end{juliaout}
\begin{figure}[htpb]
\center
\includegraphics[width=\linewidth]{figures/pyplot_formats_2_1.pdf}
@ -24,6 +32,10 @@ plot(x, sin(x))
\begin{juliaout}
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe839790510>
\end{juliaout}
\includegraphics[width=\linewidth]{figures/pyplot_formats_cos2_fun_1.pdf}
@ -35,13 +47,13 @@ linspace(0.0,6.283185307179586,200)
julia> plot(x, sin(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe56f7ac978>
PyObject <matplotlib.lines.Line2D object at 0x7fe8396c8110>
julia> y = 20
20
julia> plot(x, cos(x))
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x7fe56f7b29b0>
PyObject <matplotlib.lines.Line2D object at 0x7fe8396c8310>
\end{juliaterm}
\includegraphics[width=\linewidth]{figures/pyplot_formats_4_1.pdf}
@ -51,4 +63,7 @@ julia> plot(x, cos(x))
x = randn(100, 100)
contourf(x)
\end{juliacode}
\begin{juliaout}
PyObject <matplotlib.contour.QuadContourSet object at 0x7fe8395fc390>
\end{juliaout}
\includegraphics[width=15cm]{figures/pyplot_formats_5_1.pdf}

View File

@ -18,9 +18,9 @@ print(x)
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
1:10
~~~~~~~~~~~~~
~~~~
@ -38,9 +38,9 @@ display(x)
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
1:10
~~~~~~~~~~~~~
~~~~
@ -94,10 +94,10 @@ display(x)
~~~~~~~~~~~~~
~~~~{.julia}
~~~~
1:10
1:10
~~~~~~~~~~~~~
~~~~
![](figures/test_hold_3_1.png)\

View File

@ -7,6 +7,7 @@ julia> t = linspace(0, 2*pi, 100)
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
Winston.FramedPlot(...)
````
@ -17,6 +18,7 @@ julia> s = 1:10
1:10
julia> plot(s, "r*")
Winston.FramedPlot(...)
````
@ -49,6 +51,11 @@ display(p)
````
````
warning: sub-optimal solution for plot
````
![](figures/winston_formats_3_1.png)
````julia

View File

@ -8,6 +8,7 @@ julia> t = linspace(0, 2*pi, 100)
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
Winston.FramedPlot(...)
@ -21,6 +22,7 @@ julia> s = 1:10
1:10
julia> plot(s, "r*")
Winston.FramedPlot(...)
@ -60,6 +62,12 @@ julia> plot(s, "r*")
::
warning: sub-optimal solution for plot
.. image:: figures/winston_formats_3_1.png
:width: 15 cm

View File

@ -7,16 +7,18 @@ julia> t = linspace(0, 2*pi, 100)
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
Winston.FramedPlot(...)
\end{juliaterm}
\includegraphics[width=\linewidth]{figures/winston_formats_1_1.pdf}
\includegraphics[width=\linewidth]{figures/winston_formats_1_1.png}
\begin{juliaterm}
julia> s = 1:10
1:10
julia> plot(s, "r*")
Winston.FramedPlot(...)
\end{juliaterm}
\includegraphics[width=\linewidth]{figures/winston_formats_1_2.pdf}
\includegraphics[width=\linewidth]{figures/winston_formats_1_2.png}
@ -24,7 +26,7 @@ julia> plot(s, "r*")
\begin{figure}[htpb]
\center
\includegraphics[width=\linewidth]{figures/winston_formats_random_1.pdf}
\includegraphics[width=\linewidth]{figures/winston_formats_random_1.png}
\caption{Random walk.}
\label{fig:random}
\end{figure}
@ -48,7 +50,10 @@ add(p, Curve(x, s, color="blue"))
display(p)
\end{juliacode}
\includegraphics[width=\linewidth]{figures/winston_formats_3_1.pdf}
\begin{juliaout}
warning: sub-optimal solution for plot
\end{juliaout}
\includegraphics[width=\linewidth]{figures/winston_formats_3_1.png}
\begin{juliacode}
@ -77,4 +82,4 @@ l = Legend(.1, .9, {a,b,s})
add(p, s, a, b, l)
display(p)
\end{juliacode}
\includegraphics[width=\linewidth]{figures/winston_formats_3_2.pdf}
\includegraphics[width=\linewidth]{figures/winston_formats_3_2.png}

View File

@ -7,10 +7,11 @@ julia> t = linspace(0, 2*pi, 100)
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
Winston.FramedPlot(...)
~~~~~~~~~~~~~
![](figures/winston_formats_1_1.svg)\
![](figures/winston_formats_1_1.png)\
~~~~{.julia}
@ -18,17 +19,18 @@ julia> s = 1:10
1:10
julia> plot(s, "r*")
Winston.FramedPlot(...)
~~~~~~~~~~~~~
![](figures/winston_formats_1_2.svg)\
![](figures/winston_formats_1_2.png)\
![Random walk.](figures/winston_formats_random_1.svg)
![Random walk.](figures/winston_formats_random_1.png)
@ -51,7 +53,12 @@ display(p)
~~~~~~~~~~~~~
![](figures/winston_formats_3_1.svg)\
~~~~
warning: sub-optimal solution for plot
~~~~
![](figures/winston_formats_3_1.png)\
~~~~{.julia}
@ -83,5 +90,5 @@ display(p)
~~~~~~~~~~~~~
![](figures/winston_formats_3_2.svg)\
![](figures/winston_formats_3_2.png)\