[python-pweave] 01/02: Initial debianisation

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Fri Mar 10 11:23:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository python-pweave.

commit dfbab49c404a526efedbf034ed41a4f3af501a74
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Fri Mar 10 11:16:26 2017 +0000

    Initial debianisation
---
 debian/changelog                           |   5 +
 debian/compat                              |   1 +
 debian/control                             |  34 +++++++
 debian/copyright                           |  79 ++++++++++++++++
 debian/gbp.conf                            |   7 ++
 debian/python3-pweave.lintian-overrides    |   8 ++
 debian/rules                               |   9 ++
 debian/source/format                       |   1 +
 debian/source/local-options                |   1 +
 debian/tests/control                       |  25 +++++
 debian/tests/examples/FIR_design.mdw       | 134 +++++++++++++++++++++++++++
 debian/tests/examples/FIR_design.py        | 128 ++++++++++++++++++++++++++
 debian/tests/examples/FIR_design.rstw      | 133 +++++++++++++++++++++++++++
 debian/tests/examples/FIR_design_verb.texw | 143 +++++++++++++++++++++++++++++
 debian/watch                               |   3 +
 15 files changed, 711 insertions(+)

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..37083bc
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+python-pweave (0.25-1) UNRELEASED; urgency=low
+
+  * Initial release. (Closes: #856176)
+
+ -- Ghislain Antony Vaillant <ghisvail at gmail.com>  Fri, 10 Mar 2017 11:14:25 +0000
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..fd279e2
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,34 @@
+Source: python-pweave
+Maintainer: Debian Science Maintainers <debian-science-maintainers at lists.alioth.debian.org>
+Uploaders: Ghislain Antony Vaillant <ghisvail at gmail.com>
+Section: python
+Priority: optional
+Build-Depends: debhelper (>= 10),
+               dh-python,
+               python3-all,
+               python3-setuptools
+Standards-Version: 3.9.8
+Vcs-Browser: https://anonscm.debian.org/git/debian-science/packages/python-pweave.git
+Vcs-Git: https://anonscm.debian.org/git/debian-science/packages/python-pweave.git
+Homepage: http://mpastell.com/pweave/
+X-Python3-Version: >= 3.4
+
+Package: python3-pweave
+Architecture: all
+Depends: ${misc:Depends},
+         ${python3:Depends},
+         python3-ipython,
+         python3-jupyter-client,
+         python3-markdown,
+         python3-nbconvert,
+         python3-nbformat,
+         python3-pygments
+Suggests: pandoc,
+          python3-docutils,
+          texlive-latex-base
+Description: scientific report generator for Python
+ Pweave is a scientific report generator and a literate programming tool for
+ Python. Pweave can capture the results and plots from data analysis and works
+ well with NumPy, SciPy and matplotlib. It is able to run Python code from
+ source document and include the results and capture matplotlib plots in the
+ output.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..47a2526
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,79 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Pweave
+Upstream-Contact: Matti Pastell <matti.pastell at luke.fi>
+Source: https://pypi.python.org/pypi/Pweave
+
+Files: *
+Copyright: 2013 Matti Pastell
+License: BSD-3-Clause
+
+Files: debian/*
+Copyright: 2017 Ghislain Antony Vaillant <ghisvail at gmail.com>
+License: BSD-3-Clause
+
+Files: debian/tests/examples/*
+Copyright: 2013 Matti Pastell
+License: BSD-3-Clause
+Comment: The example files used for CI testing were taken from the upstream
+ documentation located at <http://mpastell.com/pweave/examples/index.html>.
+
+Files: pweave/themes/bootstrap.py
+Copyright: 2011-2015 Twitter, Inc.
+ 2011-2015 Nicolas Gallagher and Jonathan Neal
+License: Expat
+
+Files: pweave/themes/cerulean.py
+ pweave/themes/journal.py
+Copyright: 2012-2015 Thomas Park
+ 2011-2015 Twitter, Inc.
+ 2011-2015 Nicolas Gallagher and Jonathan Neal
+License: Expat
+
+Files: pweave/themes/skeleton.py
+Copyright: 2011-2014 Dave Gamache
+License: Expat
+
+License: BSD-3-Clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ 1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ .
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ 3. Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..f53906f
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,7 @@
+[DEFAULT]
+upstream-branch = upstream
+debian-branch = master
+upstream-tag = upstream/%(version)s
+debian-tag = debian/%(version)s
+sign-tags = True
+pristine-tar = True
diff --git a/debian/python3-pweave.lintian-overrides b/debian/python3-pweave.lintian-overrides
new file mode 100644
index 0000000..9f7ed32
--- /dev/null
+++ b/debian/python3-pweave.lintian-overrides
@@ -0,0 +1,8 @@
+# Upstream does not provide manpages for the console scripts yet,
+# see <https://github.com/mpastell/Pweave/issues/56>.
+binary-without-manpage
+# The Pweave console scripts are tied to the Python version used to execute the
+# code embedded to the weaved documents. Therefore, it is better to let the
+# Python binary package provide both the modules and the console scripts.
+library-package-name-for-application
+application-in-library-section
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..8f37850
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE = 1
+
+export PYBUILD_NAME = pweave
+
+%:
+	dh $@ --with python3 --buildsystem=pybuild
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/local-options b/debian/source/local-options
new file mode 100644
index 0000000..b2b7b88
--- /dev/null
+++ b/debian/source/local-options
@@ -0,0 +1 @@
+extend-diff-ignore="^[^/]+\.egg-info/"
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..c75f536
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,25 @@
+Test-Command: set -e
+ ; cp debian/tests/examples/FIR_* "$AUTOPKGTEST_TMP"
+ ; cd "$AUTOPKGTEST_TMP"
+ ; echo "Testing texw => tex => pdf:"
+ ; pweave -f tex FIR_design_verb.texw
+ ; pdflatex FIR_design_verb.tex
+ ; echo "Testing rstw => rst => html:"
+ ; pweave -f rst FIR_design.rstw
+ ; rst2html FIR_design.rst FIR_design_rst.html
+ ; echo "Testing mdw => html (via python-markdown):"
+ ; pweave -f md2html FIR_design.mdw
+ ; echo "Testing mdw => md => html (via pandoc):"
+ ; pweave -f pandoc FIR_design.mdw
+ ; pandoc -s --mathjax FIR_design.md -o FIR_design_pandoc.html
+ ; echo "Testing mdw => tex => pdf:"
+ ; pweave -f pandoc2latex FIR_design.mdw
+ ; pdflatex FIR_design.tex
+Depends: pandoc,
+         python3-docutils,
+         python3-matplotlib,
+         python3-pweave,
+         python3-scipy,
+         texlive-fonts-recommended,
+         texlive-generic-extra,
+         texlive-latex-recommended
diff --git a/debian/tests/examples/FIR_design.mdw b/debian/tests/examples/FIR_design.mdw
new file mode 100644
index 0000000..a5876b7
--- /dev/null
+++ b/debian/tests/examples/FIR_design.mdw
@@ -0,0 +1,134 @@
+% FIR filter design with Python and SciPy
+% Matti Pastell
+% 15th April 2013
+
+# Introduction
+
+This an example of a script that can be published using
+[Pweave](http://mpastell.com/pweave). The script can be executed
+normally using Python or published to HTML with Pweave
+Text is written in markdown in lines starting with "`#'` " and code
+is executed and results are included in the published document.
+The concept is similar to
+publishing documents with [MATLAB](http://mathworks.com) or using
+stitch with [Knitr](http://http://yihui.name/knitr/demo/stitch/).
+
+Notice that you don't need to define chunk options (see
+[Pweave docs](http://mpastell.com/pweave/usage.html#code-chunk-options)
+),
+but you do need one line of whitespace between text and code.
+If you want to define options you can do it on using a line starting with
+`#+`. just before code e.g. `#+ term=True, caption='Fancy plots.'`. 
+If you're viewing the HTML version have a look at the
+[source](FIR_design.py) to see the markup.
+
+The code and text below comes mostly
+from my blog post [FIR design with SciPy](http://mpastell.com/2010/01/18/fir-with-scipy/),
+but I've updated it to reflect new features in SciPy. 
+
+# 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.
+
+## Functions for frequency, phase, impulse and step response
+
+Let's first define functions to plot filter
+properties.
+
+
+<<>>=
+from pylab import *
+import scipy.signal as signal
+    
+#Plot frequency and phase response
+def mfreqz(b,a=1):
+    w,h = signal.freqz(b,a)
+    h_dB = 20 * log10 (abs(h))
+    subplot(211)
+    plot(w/max(w),h_dB)
+    ylim(-150, 5)
+    ylabel('Magnitude (db)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Frequency response')
+    subplot(212)
+    h_Phase = unwrap(arctan2(imag(h),real(h)))
+    plot(w/max(w),h_Phase)
+    ylabel('Phase (radians)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Phase response')
+    subplots_adjust(hspace=0.5)
+
+#Plot step and impulse response
+def impz(b,a=1):
+    l = len(b)
+    impulse = repeat(0.,l); impulse[0] =1.
+    x = arange(0,l)
+    response = signal.lfilter(b,a,impulse)
+    subplot(211)
+    stem(x, response)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Impulse response')
+    subplot(212)
+    step = cumsum(response)
+    stem(x, step)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Step response')
+    subplots_adjust(hspace=0.5)
+@
+
+## Lowpass FIR filter
+
+Designing a lowpass FIR filter is very simple to do with SciPy, all you
+need to do is to define the window length, cut off frequency and the
+window.
+
+The Hamming window is defined as:
+$w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and $\beta=0.46$ 
+
+The next code chunk is executed in term mode, see the [Python script](FIR_design.py) for syntax.
+Notice also that Pweave can now catch multiple figures/code chunk.
+
+
+<<term=True>>=
+n = 61
+a = signal.firwin(n, cutoff = 0.3, window = "hamming")
+#Frequency and phase response
+mfreqz(a)
+show()
+#Impulse and step response
+figure(2)
+impz(a)
+show()
+@
+
+## Highpass FIR Filter
+
+Let's define a highpass FIR filter, if you compare to original blog
+post you'll notice that it has become easier since 2009. You don't
+need to do ' spectral inversion "manually" anymore!
+
+
+<<>>=
+n = 101
+a = signal.firwin(n, cutoff = 0.3, window = "hanning", pass_zero=False)
+mfreqz(a)
+show()
+@
+
+## Bandpass FIR filter
+
+Notice that the plot has a caption defined in code chunk options.
+
+
+<<caption="Bandpass FIR filter.">>=
+n = 1001
+a = signal.firwin(n, cutoff = [0.2, 0.5], window = 'blackmanharris', pass_zero = False)
+mfreqz(a)
+show()
+@
diff --git a/debian/tests/examples/FIR_design.py b/debian/tests/examples/FIR_design.py
new file mode 100644
index 0000000..729c8a2
--- /dev/null
+++ b/debian/tests/examples/FIR_design.py
@@ -0,0 +1,128 @@
+#' % FIR filter design with Python and SciPy
+#' % Matti Pastell
+#' % 15th April 2013
+
+#' # Introduction
+
+#' This an example of a script that can be published using
+#' [Pweave](http://mpastell.com/pweave). The script can be executed
+#' normally using Python or published to HTML with Pweave
+#' Text is written in markdown in lines starting with "`#'` " and code
+#' is executed and results are included in the published document.
+#' The concept is similar to
+#' publishing documents with [MATLAB](http://mathworks.com) or using
+#' stitch with [Knitr](http://http://yihui.name/knitr/demo/stitch/).
+
+#' Notice that you don't need to define chunk options (see
+#' [Pweave docs](http://mpastell.com/pweave/usage.html#code-chunk-options)
+#' ),
+#' but you do need one line of whitespace between text and code.
+#' If you want to define options you can do it on using a line starting with
+#' `#+`. just before code e.g. `#+ term=True, caption='Fancy plots.'`. 
+#' If you're viewing the HTML version have a look at the
+#' [source](FIR_design.py) to see the markup.
+
+#' The code and text below comes mostly
+#' from my blog post [FIR design with SciPy](http://mpastell.com/2010/01/18/fir-with-scipy/),
+#' but I've updated it to reflect new features in SciPy. 
+
+#' # 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.
+
+#' ## Functions for frequency, phase, impulse and step response
+
+#' Let's first define functions to plot filter
+#' properties.
+
+from pylab import *
+import scipy.signal as signal
+    
+#Plot frequency and phase response
+def mfreqz(b,a=1):
+    w,h = signal.freqz(b,a)
+    h_dB = 20 * log10 (abs(h))
+    subplot(211)
+    plot(w/max(w),h_dB)
+    ylim(-150, 5)
+    ylabel('Magnitude (db)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Frequency response')
+    subplot(212)
+    h_Phase = unwrap(arctan2(imag(h),real(h)))
+    plot(w/max(w),h_Phase)
+    ylabel('Phase (radians)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Phase response')
+    subplots_adjust(hspace=0.5)
+
+#Plot step and impulse response
+def impz(b,a=1):
+    l = len(b)
+    impulse = repeat(0.,l); impulse[0] =1.
+    x = arange(0,l)
+    response = signal.lfilter(b,a,impulse)
+    subplot(211)
+    stem(x, response)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Impulse response')
+    subplot(212)
+    step = cumsum(response)
+    stem(x, step)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Step response')
+    subplots_adjust(hspace=0.5)
+
+#' ## Lowpass FIR filter
+
+#' Designing a lowpass FIR filter is very simple to do with SciPy, all you
+#' need to do is to define the window length, cut off frequency and the
+#' window.
+
+#' The Hamming window is defined as:
+#' $w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and $\beta=0.46$ 
+
+#' The next code chunk is executed in term mode, see the [Python script](FIR_design.py) for syntax.
+#' Notice also that Pweave can now catch multiple figures/code chunk.
+
+#+ term=True
+n = 61
+a = signal.firwin(n, cutoff = 0.3, window = "hamming")
+#Frequency and phase response
+mfreqz(a)
+show()
+#Impulse and step response
+figure(2)
+impz(a)
+show()
+
+
+#' ## Highpass FIR Filter
+
+#' Let's define a highpass FIR filter, if you compare to original blog
+#' post you'll notice that it has become easier since 2009. You don't
+#' need to do ' spectral inversion "manually" anymore!
+
+n = 101
+a = signal.firwin(n, cutoff = 0.3, window = "hanning", pass_zero=False)
+mfreqz(a)
+show()
+
+#' ## Bandpass FIR filter
+
+#' Notice that the plot has a caption defined in code chunk options.
+
+#+ caption = "Bandpass FIR filter."
+n = 1001
+a = signal.firwin(n, cutoff = [0.2, 0.5], window = 'blackmanharris', pass_zero = False)
+mfreqz(a)
+show()
+
+
+
diff --git a/debian/tests/examples/FIR_design.rstw b/debian/tests/examples/FIR_design.rstw
new file mode 100644
index 0000000..b251347
--- /dev/null
+++ b/debian/tests/examples/FIR_design.rstw
@@ -0,0 +1,133 @@
+=========================================
+ FIR filter design with Python and SciPy
+=========================================
+
+:Author: Matti Pastell <matti.pastell at helsinki.fi>
+:Website: http://mpastell.com
+:Date: May 20th 2013
+
+
+
+Introduction
+============
+
+This an example of a document that can be published using `Pweave
+<http://mpastell.com/pweave>`__. Text is written using
+reStructuredText and code between `<<>>` and `@` is
+executed and results are included in the resulting document.
+
+You can define various options for code chunks to control code
+execution and formatting (see `FIR design with
+SciPy <http://mpastell.com/2010/01/18/fir-with-scipy/>`__
+).
+
+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.
+
+Functions for frequency, phase, impulse and step response
+---------------------------------------------------------
+
+Let's first define functions to plot filter properties.
+
+
+<<>>=
+from pylab import *
+import scipy.signal as signal
+    
+#Plot frequency and phase response
+def mfreqz(b,a=1):
+    w,h = signal.freqz(b,a)
+    h_dB = 20 * log10 (abs(h))
+    subplot(211)
+    plot(w/max(w),h_dB)
+    ylim(-150, 5)
+    ylabel('Magnitude (db)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Frequency response')
+    subplot(212)
+    h_Phase = unwrap(arctan2(imag(h),real(h)))
+    plot(w/max(w),h_Phase)
+    ylabel('Phase (radians)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Phase response')
+    subplots_adjust(hspace=0.5)
+
+#Plot step and impulse response
+def impz(b,a=1):
+    l = len(b)
+    impulse = repeat(0.,l); impulse[0] =1.
+    x = arange(0,l)
+    response = signal.lfilter(b,a,impulse)
+    subplot(211)
+    stem(x, response)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Impulse response')
+    subplot(212)
+    step = cumsum(response)
+    stem(x, step)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Step response')
+    subplots_adjust(hspace=0.5)
+@
+
+Lowpass FIR filter
+------------------
+
+Designing a lowpass FIR filter is very simple to do with SciPy, all you
+need to do is to define the window length, cut off frequency and the
+window.
+
+The Hamming window is defined as:
+:math:`w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}`, where
+:math:`\alpha=0.54` and :math:`\beta=0.46`
+
+The next code chunk is executed in term mode, see the `source document
+<FIR_design.rstw>`_ for syntax. Notice also that Pweave can now catch
+multiple figures/code chunk.
+
+
+<<term=True>>=
+n = 61
+a = signal.firwin(n, cutoff = 0.3, window = "hamming")
+#Frequency and phase response
+mfreqz(a)
+show()
+#Impulse and step response
+figure(2)
+impz(a)
+show()
+@
+
+Highpass FIR Filter
+-------------------
+
+Let's define a highpass FIR filter:
+
+
+<<>>=
+n = 101
+a = signal.firwin(n, cutoff = 0.3, window = "hanning", pass_zero=False)
+mfreqz(a)
+show()
+@
+
+Bandpass FIR filter
+-------------------
+
+Notice that the plot has a caption defined in code chunk options.
+
+
+<<caption="Bandpass FIR filter.">>=
+n = 1001
+a = signal.firwin(n, cutoff = [0.2, 0.5], window = 'blackmanharris', pass_zero = False)
+mfreqz(a)
+show()
+@
diff --git a/debian/tests/examples/FIR_design_verb.texw b/debian/tests/examples/FIR_design_verb.texw
new file mode 100644
index 0000000..8bdfa77
--- /dev/null
+++ b/debian/tests/examples/FIR_design_verb.texw
@@ -0,0 +1,143 @@
+\documentclass[a4paper,11pt,final]{article}
+\usepackage{fancyvrb, color, graphicx, hyperref, amsmath, url}
+\usepackage{palatino}
+\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}
+        
+\hypersetup  
+{   pdfauthor = {Matti Pastell},
+  pdftitle={FIR filter design with Python and SciPy},
+  colorlinks=TRUE,
+  linkcolor=black,
+  citecolor=blue,
+  urlcolor=blue
+}
+
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{1.2ex}
+
+
+        
+\title{FIR filter design with Python and SciPy}
+\author{Matti Pastell \\ \url{http://mpastell.com}}
+\date{15th April 2013}
+
+\begin{document}
+\maketitle
+
+
+\section{Introduction}
+
+This an example of a document that can be published using
+\href{http://mpastell.com/pweave}{Pweave}. Text is written
+using \LaTeX{} and code between \texttt{<<>>} and \texttt{@} is executed
+and results are included in the resulting document.
+
+You can define various options for code chunks to control code
+execution and formatting (see
+\href{http://mpastell.com/pweave/usage.html\#code-chunk-options}{Pweave
+docs}).
+
+\section{FIR Filter Design}
+
+We'll implement lowpass, highpass and ' bandpass FIR filters. If you
+want to read more about DSP I highly recommend
+\href{http://www.dspguide.com/}{The Scientist and Engineer's Guide to
+Digital Signal Processing} which is freely available online.
+
+\subsection{Functions for frequency, phase, impulse and step response}
+
+Let's first define functions to plot filter properties.
+
+
+<<>>=
+from pylab import *
+import scipy.signal as signal
+    
+#Plot frequency and phase response
+def mfreqz(b,a=1):
+    w,h = signal.freqz(b,a)
+    h_dB = 20 * log10 (abs(h))
+    subplot(211)
+    plot(w/max(w),h_dB)
+    ylim(-150, 5)
+    ylabel('Magnitude (db)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Frequency response')
+    subplot(212)
+    h_Phase = unwrap(arctan2(imag(h),real(h)))
+    plot(w/max(w),h_Phase)
+    ylabel('Phase (radians)')
+    xlabel(r'Normalized Frequency (x$\pi$rad/sample)')
+    title(r'Phase response')
+    subplots_adjust(hspace=0.5)
+
+#Plot step and impulse response
+def impz(b,a=1):
+    l = len(b)
+    impulse = repeat(0.,l); impulse[0] =1.
+    x = arange(0,l)
+    response = signal.lfilter(b,a,impulse)
+    subplot(211)
+    stem(x, response)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Impulse response')
+    subplot(212)
+    step = cumsum(response)
+    stem(x, step)
+    ylabel('Amplitude')
+    xlabel(r'n (samples)')
+    title(r'Step response')
+    subplots_adjust(hspace=0.5)
+@
+
+\subsection{Lowpass FIR filter}
+
+Designing a lowpass FIR filter is very simple to do with SciPy, all you
+need to do is to define the window length, cut off frequency and the
+window.
+
+The Hamming window is defined as:
+$w(n) = \alpha - \beta\cos\frac{2\pi n}{N-1}$, where $\alpha=0.54$ and
+$\beta=0.46$
+
+The next code chunk is executed in term mode, see the source document
+for syntax. Notice also that Pweave can now catch multiple
+figures/code chunk.
+
+<<term=True>>=
+n = 61
+a = signal.firwin(n, cutoff = 0.3, window = "hamming")
+#Frequency and phase response
+mfreqz(a)
+show()
+#Impulse and step response
+figure(2)
+impz(a)
+show()
+@
+
+\subsection{Highpass FIR Filter}
+
+Let's define a highpass FIR filter:
+
+<<>>=
+n = 101
+a = signal.firwin(n, cutoff = 0.3, window = "hanning", pass_zero=False)
+mfreqz(a)
+show()
+@
+
+\subsection{Bandpass FIR filter}
+
+Notice that the plot has a caption defined in code chunk options.
+
+
+<<caption="Bandpass FIR filter.">>=
+n = 1001
+a = signal.firwin(n, cutoff = [0.2, 0.5], window = 'blackmanharris', pass_zero = False)
+mfreqz(a)
+show()
+@
+
+\end{document}
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..19ed177
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=4
+opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
+https://pypi.debian.net/Pweave/Pweave@ANY_VERSION@@ARCHIVE_EXT@

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-pweave.git



More information about the debian-science-commits mailing list