Skip to content

Commit 24ccb6e

Browse files
committed
added Ariels csd patch for proper scaling at the dc component
svn path=/branches/v0_99_maint/; revision=8121
1 parent 64b3b06 commit 24ccb6e

File tree

4 files changed

+65
-38
lines changed

4 files changed

+65
-38
lines changed

doc/faq/installing_faq.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ generate postscript images from some numerical simulations, and still
146146
others in web application servers to dynamically serve up graphs.
147147

148148
To support all of these use cases, matplotlib can target different
149-
outputs, and each of these capabililities is called a backend (the
149+
outputs, and each of these capabililities is called a backend; the
150150
"frontend" is the user facing code, ie the plotting code, whereas the
151151
"backend" does all the dirty work behind the scenes to make the
152152
figure. There are two types of backends: user interface backends (for
153-
use in pygtk, wxpython, tkinter, qt or fltk) and hardcopy backends to
153+
use in pygtk, wxpython, tkinter, qt, macosx, or fltk) and hardcopy backends to
154154
make image files (PNG, SVG, PDF, PS).
155155

156156
There are a two primary ways to configure your backend. One is to set
@@ -183,10 +183,10 @@ from the canvas (the place where the drawing goes). The canonical
183183
renderer for user interfaces is ``Agg`` which uses the `antigrain
184184
<http://antigrain.html>`_ C++ library to make a raster (pixel) image
185185
of the figure. All of the user interfaces can be used with agg
186-
rendering, eg ``WXAgg``, ``GTKAgg``, ``QTAgg``, ``TkAgg``. In
187-
addition, some of the user interfaces support other rendering engines.
188-
For example, with GTK, you can also select GDK rendering (backend
189-
``GTK``) or Cairo rendering (backend ``GTKCairo``).
186+
rendering, eg ``WXAgg``, ``GTKAgg``, ``QTAgg``, ``TkAgg``,
187+
``CocoaAgg``. In addition, some of the user interfaces support other
188+
rendering engines. For example, with GTK, you can also select GDK
189+
rendering (backend ``GTK``) or Cairo rendering (backend ``GTKCairo``).
190190

191191
For the rendering engines, one can also distinguish between `vector
192192
<http://en.wikipedia.org/wiki/Vector_graphics>`_ or `raster
@@ -238,6 +238,7 @@ TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_)
238238
QtAgg Agg rendering to a :term:`Qt` canvas (requires PyQt_)
239239
Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_)
240240
FLTKAgg Agg rendering to a :term:`FLTK` canvas (requires pyFLTK_)
241+
macosx Cocoa rendering in OSX windows
241242
============ ================================================================
242243

243244
.. _`Anti-Grain Geometry`: http://www.antigrain.com/

doc/glossary/index.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Glossary
1414
Cairo
1515
The `Cairo graphics <http://cairographics.org>`_ engine
1616

17+
18+
dateutil
19+
The `dateutil <http://labix.org/python-dateutil>`_ library
20+
provides extensions to the standard datetime module
21+
1722
EPS
1823
Encapsulated Postscript (`EPS <http://en.wikipedia.org/wiki/Encapsulated_PostScript>`_)
1924

@@ -86,6 +91,14 @@ Glossary
8691
language widely used for scripting, application development, web
8792
application servers, scientific computing and more.
8893

94+
95+
pytz
96+
`pytz <http://pytz.sourceforge.net/>`_ provides the Olson tz
97+
database in Python. it allows accurate and cross platform
98+
timezone calculations and solves the issue of ambiguous times at
99+
the end of daylight savings
100+
101+
89102
Qt
90103
`Qt <http://trolltech.com/products/qt/>`__ is a cross-platform
91104
application framework for desktop and embedded development.

doc/users/installing.rst

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,29 @@ progress::
4444
matplotlib requires numpy version 1.1 or later. Although it is not a
4545
requirement to use matplotlib, we strongly encourage you to install
4646
`ipython <http://ipython.scipy.org/dist>`_, which is an interactive
47-
shell for python that is matplotlib aware. Once you have ipython,
48-
numpy and matplotlib installed, in ipython's "pylab" mode you have a
49-
matlab-like environment that automatically handles most of the
50-
configuration details for you, so you can get up and running quickly::
47+
shell for python that is matplotlib aware.
48+
49+
Next we need to get matplotlib installed. We provide prebuilt
50+
binaries for OS X and Windows on the matplotlib `download
51+
<http://sourceforge.net/projects/matplotlib/files/>`_ page. Click on
52+
the latest release of the "matplotlib" package, choose your python
53+
version (2.5 or 2.6) and your platform (macosx or win32) and you
54+
should be good to go. If you have any problems, please check the
55+
:ref:`installing-faq`, google around a little bit, and post a question
56+
the `mailing list
57+
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_. If
58+
you are on debian/unbuntu linux, it suffices to do::
59+
60+
> sudo apt-get install python-matplotlib
61+
62+
Instructions for installing our OSX binaries are found in the FAQ
63+
:ref:`install_osx_binaries`.
64+
65+
66+
Once you have ipython, numpy and matplotlib installed, in ipython's
67+
"pylab" mode you have a matlab-like environment that automatically
68+
handles most of the configuration details for you, so you can get up
69+
and running quickly::
5170

5271
johnh@flag:~> ipython -pylab
5372
Python 2.4.5 (#4, Apr 12 2008, 09:09:16)
@@ -60,20 +79,6 @@ configuration details for you, so you can get up and running quickly::
6079

6180
In [2]: hist(x, 100)
6281

63-
And a *voila*, a figure pops up. But we are putting the cart ahead of
64-
the horse -- first we need to get matplotlib installed. We provide
65-
prebuilt binaries for OS X and Windows on the matplotlib `download
66-
<http://sourceforge.net/projects/matplotlib/files/>`_ page. Click on
67-
the latest release of the "matplotlib" package, choose your python
68-
version (2.4 or 2.5) and your platform (macosx or win32) and you
69-
should be good to go. If you have any problems, please check the
70-
:ref:`installing-faq`, google around a little bit, and post a question
71-
the `mailing list
72-
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_.
73-
74-
Instructions for installing our OSX binaries are found in the FAQ
75-
ref:`install_osx_binaries`.
76-
7782
Note that when testing matplotlib installations from the interactive
7883
python console, there are some issues relating to user interface
7984
toolkits and interactive settings that are discussed in
@@ -85,9 +90,9 @@ Installing from source
8590
======================
8691

8792
If you are interested perhaps in contributing to matplotlib
88-
development, or just like to build everything yourself, it is not
89-
difficult to build matplotlib from source. Grab the latest *tar.gz*
90-
release file from `sourceforge
93+
development, running the latest greatest code, or just like to
94+
build everything yourself, it is not difficult to build matplotlib
95+
from source. Grab the latest *tar.gz* release file from `sourceforge
9196
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_, or if
9297
you want to develop matplotlib or just need the latest bugfixed
9398
version, grab the latest svn version :ref:`install-svn`.
@@ -173,17 +178,17 @@ backends and the capabilities they provide
173178
agg template source statically, so it will not affect anything on
174179
your system outside of matplotlib.
175180

176-
pytz 2007g or later
181+
:term:`pytz` 2007g or later
177182
timezone handling for python datetime objects. By default,
178183
matplotlib will install pytz if it isn't already installed on your
179-
system. To override the default, use setup.cfg to force or
184+
system. To override the default, use :file:`setup.cfg to force or
180185
prevent installation of pytz.
181186
182-
dateutil 1.1 or later
183-
extensions to python datetime handling. By
184-
default, matplotlib will install dateutil if it isn't already
185-
installed on your system. To override the default, use setup.cfg
186-
to force or prevent installation of dateutil.
187+
:term:`dateutil` 1.1 or later
188+
provides extensions to python datetime handling. By default, matplotlib
189+
will install dateutil if it isn't already installed on your
190+
system. To override the default, use :file:`setup.cfg` to force
191+
or prevent installation of dateutil.
187192

188193

189194

lib/matplotlib/mlab.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,18 @@ def _spectral_helper(x, y, NFFT=256, Fs=2, detrend=detrend_none,
273273
Pxy[:,i] = np.conjugate(fx[:numFreqs]) * fy[:numFreqs]
274274

275275
# Scale the spectrum by the norm of the window to compensate for
276-
# windowing loss; see Bendat & Piersol Sec 11.5.2. Also include
277-
# scaling factors for one-sided densities and dividing by the sampling
278-
# frequency, if desired.
279-
Pxy *= scaling_factor / (np.abs(windowVals)**2).sum()
276+
# windowing loss; see Bendat & Piersol Sec 11.5.2.
277+
Pxy *= 1 / (np.abs(windowVals)**2).sum()
278+
279+
# Also include scaling factors for one-sided densities and dividing by the
280+
# sampling frequency, if desired. Scale everything, except the DC component
281+
# and the NFFT/2 component:
282+
Pxy[1:-1] *= scaling_factor
283+
284+
#But do scale those components by Fs, if required
285+
if scale_by_freq:
286+
Pxy[[0,-1]] /= Fs
287+
280288
t = 1./Fs * (ind + NFFT / 2.)
281289
freqs = float(Fs) / pad_to * np.arange(numFreqs)
282290

0 commit comments

Comments
 (0)