You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(4) |
2
(9) |
3
(23) |
4
(34) |
5
(31) |
6
(25) |
7
(10) |
8
(7) |
9
(1) |
10
(18) |
11
(3) |
12
(18) |
13
(13) |
14
(6) |
15
(9) |
16
(6) |
17
(10) |
18
(12) |
19
(1) |
20
(8) |
21
(5) |
22
|
23
|
24
|
25
|
26
(4) |
27
(2) |
28
(4) |
29
|
30
|
31
|
|
|
|
|
|
From: <md...@us...> - 2007-12-18 21:09:30
|
Revision: 4772 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4772&view=rev Author: mdboom Date: 2007-12-18 13:09:25 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Better docstrings for set_x/yscale and friends. Modified Paths: -------------- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/pyplot.py branches/transforms/lib/matplotlib/scale.py Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-12-18 21:08:19 UTC (rev 4771) +++ branches/transforms/lib/matplotlib/axes.py 2007-12-18 21:09:25 UTC (rev 4772) @@ -1651,25 +1651,18 @@ ", ".join(mscale.get_scale_names())) return self.xaxis.get_scale() - # MGDTODO: Update docstring def set_xscale(self, value, **kwargs): """ SET_XSCALE(value) - Set the xscaling: %(scale)s + Set the scaling of the x-axis: %(scale)s - If value is 'log', the additional kwargs have the following meaning - - * basex: base of the logarithm - - * subsx: a sequence of the location of the minor ticks; - None defaults to autosubs, which depend on the number of - decades in the plot. Eg for base 10, subsx=(1,2,5) will - put minor ticks on 1,2,5,11,12,15,21, ....To turn off - minor ticking, set subsx=[] - ACCEPTS: [%(scale)s] - """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()])} + + Different kwargs are accepted, depending on the scale: + %(scale_docs)s + """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]), + 'scale_docs': mscale.get_scale_docs().strip()} self.xaxis.set_scale(value, **kwargs) self.autoscale_view() self._update_transScale() @@ -1815,22 +1808,16 @@ def set_yscale(self, value, **kwargs): """ - SET_YSCALE(value, basey=10, subsy=None) + SET_YSCALE(value) - Set the yscaling: %(scale)s + Set the scaling of the y-axis: %(scale)s - If value is 'log', the additional kwargs have the following meaning + ACCEPTS: [%(scale)s] - * basey: base of the logarithm - - * subsy: a sequence of the location of the minor ticks; - None defaults to autosubs, which depend on the number of - decades in the plot. Eg for base 10, subsy=(1,2,5) will - put minor ticks on 1,2,5,11,12,15, 21, ....To turn off - minor ticking, set subsy=[] - - ACCEPTS: %(scale)s - """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()])} + Different kwargs are accepted, depending on the scale: + %(scale_docs)s + """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]), + 'scale_docs': mscale.get_scale_docs().strip()} self.yaxis.set_scale(value, **kwargs) self.autoscale_view() self._update_transScale() Modified: branches/transforms/lib/matplotlib/pyplot.py =================================================================== --- branches/transforms/lib/matplotlib/pyplot.py 2007-12-18 21:08:19 UTC (rev 4771) +++ branches/transforms/lib/matplotlib/pyplot.py 2007-12-18 21:09:25 UTC (rev 4772) @@ -12,7 +12,7 @@ from matplotlib.axes import Axes from matplotlib.projections import PolarAxes from matplotlib import mlab # for csv2rec in plotfile -from matplotlib.scale import get_scale_names +from matplotlib.scale import get_scale_docs, get_scale_names from matplotlib import cm from matplotlib.cm import get_cmap @@ -727,26 +727,34 @@ return ret -# MGDTODO: Update docstring def xscale(*args, **kwargs): """ SET_XSCALE(value) - Set the xscaling: %(scale)s - """ % {'scale': ' | '.join([repr(x) for x in get_scale_names()])} + Set the scaling for the x-axis: %(scale)s + + Different keywords may be accepted, depending on the scale: + + %(scale_docs)s + """ % {'scale': ' | '.join([repr(x) for x in get_scale_names()]), + 'scale_docs': get_scale_docs()} ax = gca() ret = ax.set_xscale(*args, **kwargs) draw_if_interactive() return ret -# MGDTODO: Update docstring def yscale(*args, **kwargs): """ SET_YSCALE(value) - Set the yscaling: %(scale)s - """ % {'scale': ' | '.join([repr(x) for x in get_scale_names()])} + Set the scaling for the y-axis: %(scale)s + + Different keywords may be accepted, depending on the scale: + + %(scale_docs)s + """ % {'scale': ' | '.join([repr(x) for x in get_scale_names()]), + 'scale_docs': get_scale_docs()} ax = gca() ret = ax.set_yscale(*args, **kwargs) draw_if_interactive() Modified: branches/transforms/lib/matplotlib/scale.py =================================================================== --- branches/transforms/lib/matplotlib/scale.py 2007-12-18 21:08:19 UTC (rev 4771) +++ branches/transforms/lib/matplotlib/scale.py 2007-12-18 21:09:25 UTC (rev 4772) @@ -1,3 +1,4 @@ +import textwrap import numpy as npy from matplotlib.numerix import npyma as ma MaskedArray = ma.MaskedArray @@ -2,2 +3,3 @@ +from cbook import dedent from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext, Formatter @@ -30,6 +32,8 @@ name = 'linear' def __init__(self, axis, **kwargs): + """ + """ pass def set_default_locators_and_formatters(self, axis): @@ -167,6 +171,12 @@ def __init__(self, axis, **kwargs): + """ + basex/basey: The base of the logarithm + + subsx/subsy: The number of subticks to draw between each major + tick + """ if axis.axis_name == 'x': base = kwargs.pop('basex', 10.0) subs = kwargs.pop('subsx', None) @@ -262,6 +272,16 @@ return SymmetricalLogScale.SymmetricalLogTransform(self.base) def __init__(self, axis, **kwargs): + """ + basex/basey: The base of the logarithm + + linthreshx/linthreshy: The range (-x, x) within which the plot + is linear (to avoid having the plot go to infinity around + zero). + + subsx/subsy: The number of subticks to render between each + major tick. + """ if axis.axis_name == 'x': base = kwargs.pop('basex', 10.0) linthresh = kwargs.pop('linthreshx', 2.0) @@ -342,6 +362,9 @@ return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) def __init__(self, axis, **kwargs): + """ + thresh: The degree above which to crop the data. + """ thresh = kwargs.pop("thresh", (85 / 180.0) * npy.pi) if thresh >= npy.pi / 2.0: raise ValueError("thresh must be less than pi/2") @@ -393,3 +416,16 @@ names = _scale_mapping.keys() names.sort() return names + +def get_scale_docs(): + docs = [] + for name in get_scale_names(): + scale_class = _scale_mapping[name] + docs.append(" '%s'" % name) + docs.append("") + class_docs = textwrap.wrap( + dedent(scale_class.__init__.__doc__), initial_indent=" " * 8, + subsequent_indent = " " * 8) + docs.extend(class_docs) + docs.append("") + return "\n".join(docs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 21:08:39
|
Revision: 4771 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4771&view=rev Author: mdboom Date: 2007-12-18 13:08:19 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Minor changes. Modified Paths: -------------- branches/transforms/doc/devel/add_new_projection.rst Modified: branches/transforms/doc/devel/add_new_projection.rst =================================================================== --- branches/transforms/doc/devel/add_new_projection.rst 2007-12-18 20:59:56 UTC (rev 4770) +++ branches/transforms/doc/devel/add_new_projection.rst 2007-12-18 21:08:19 UTC (rev 4771) @@ -5,18 +5,19 @@ .. ::author Michael Droettboom Matplotlib supports the addition of new transformations that transform -the data before it is displayed. Separable transformations, that work -on a single dimension are called "scales", and non-separable -transformations, that take data in two or more dimensions as input are -called "projections". +the data before it is displayed. In ``matplotlib`` nomenclature, +separable transformations, working on a single dimension, are called +"scales", and non-separable transformations, that take handle data in +two or more dimensions at a time, are called "projections". -This document is intended for developers and advanced users who need -to add more scales and projections to matplotlib. - From the user's perspective, the scale of a plot can be set with ``set_xscale`` and ``set_yscale``. Choosing the projection currently has no *standardized* method. [MGDTODO] +This document is intended for developers and advanced users who need +to add more scales and projections to matplotlib. + + Creating a new scale ==================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 21:00:05
|
Revision: 4770 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4770&view=rev Author: mdboom Date: 2007-12-18 12:59:56 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Update list of supported backends. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-12-18 20:57:40 UTC (rev 4769) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-12-18 20:59:56 UTC (rev 4770) @@ -158,17 +158,8 @@ BACKENDS - mathtext currently works with GTK, Agg, GTKAgg, TkAgg and WxAgg and - PS, though only horizontal and vertical rotations are supported in - *Agg + mathtext currently works with all backends. - mathtext now embeds the TrueType computer modern fonts into the PS - file, so what you see on the screen should be what you get on paper. - - Backends which don't support mathtext will just render the TeX - string as a literal. Stay tuned. - - KNOWN ISSUES: - Certainly there are some... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 20:57:50
|
Revision: 4769 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4769&view=rev Author: mdboom Date: 2007-12-18 12:57:40 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Update list of supported math symbols. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-12-18 19:17:13 UTC (rev 4768) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-12-18 20:57:40 UTC (rev 4769) @@ -81,35 +81,81 @@ Allowed TeX symbols: - [MGDTODO: This list is no longer exhaustive and needs to be updated] + $ \% \AA \AE \BbbC \BbbN \BbbP \BbbQ \BbbR \BbbZ \Bumpeq \Cap \Colon + \Cup \Delta \Doteq \Downarrow \Equiv \Finv \Gamma \H \Im \L \Lambda + \Ldsh \Leftarrow \Leftrightarrow \Lleftarrow \Lsh \Nearrow \Nwarrow + \O \OE \Omega \P \Phi \Pi \Psi \Rdsh \Re \Rightarrow \Rrightarrow + \Rsh \S \Searrow \Sigma \Subset \Supset \Swarrow \Theta \Uparrow + \Updownarrow \Upsilon \Vdash \Vert \Vvdash \Xi \_ \__sqrt__ \ac + \acute \acwopencirclearrow \adots \ae \aleph \alpha \angle \approx + \approxeq \approxident \arceq \ast \asymp \backcong \backprime + \backsim \backsimeq \backslash \bar \barleftarrow \barwedge \because + \beta \beth \between \bigcap \bigcirc \bigcup \bigodot \bigoplus + \bigotimes \bigstar \bigtriangledown \bigtriangleup \biguplus + \bigvee \bigwedge \blacksquare \blacktriangle \blacktriangledown + \blacktriangleleft \blacktriangleright \bot \bowtie \boxbar \boxdot + \boxminus \boxplus \boxtimes \breve \bullet \bumpeq \c \candra \cap + \carriagereturn \cdot \cdotp \cdots \check \checkmark \chi \circ + \circeq \circledR \circledS \circledast \circledcirc \circleddash + \circumflexaccent \clubsuit \clubsuitopen \colon \coloneq + \combiningacuteaccent \combiningbreve \combiningdiaeresis + \combiningdotabove \combininggraveaccent \combiningoverline + \combiningrightarrowabove \combiningtilde \complement \cong \coprod + \copyright \cup \cupdot \curlyeqprec \curlyeqsucc \curlyvee + \curlywedge \curvearrowleft \curvearrowright \cwopencirclearrow \d + \dag \daleth \danger \dashv \ddag \ddddot \dddot \ddot \ddots + \degree \delta \diamond \diamondsuit \digamma \div \divideontimes + \dot \doteq \dotminus \dotplus \dots \doublebarwedge ? \downarrow + \downdownarrows \downharpoonleft \downharpoonright \downzigzagarrow + \ell \emdash \emptyset \endash \enspace \epsilon \eqcirc \eqcolon + \eqdef \eqgtr \eqless \eqsim \equiv \eta \eth \exists \fallingdotseq + \flat \forall \frakC \frakZ \frown \gamma \geq \geqq \gg \ggg \gimel + \gneqq \gnsim \grave \greater \gtrdot \gtreqless \gtrless \gtrsim + \hat \heartsuit \hookleftarrow \hookrightarrow \i \iiint \iint + \imageof \imath \in \infty \int \intercal \invnot \iota \jmath \k + \kappa \kernelcontraction \l \lambda \lambdabar \lasp \lbrace + \lbrack \lceil \leftangle \leftarrow \leftarrowtail \leftbrace + \leftharpoonaccent \leftharpoondown \leftharpoonup \leftleftarrows + \leftparen \leftrightarrow \leftrightarrows \leftrightharpoons + \leftthreetimes \leq \leqq \less \lessdot \lesseqgtr \lessgtr + \lesssim \lfloor \ll \llcorner \lll \lneqq \lnsim \looparrowleft + \looparrowright \lq \lrcorner \ltimes \maltese \mapsdown \mapsfrom + \mapsto \mapsup \measeq \measuredangle \mho \mid \minus \models \mp + \mu \multimap \nLeftarrow \nLeftrightarrow \nRightarrow \nVDash + \nVdash \nabla \napprox \natural \ncong \ne \nearrow \neg \nequiv + \nexists \ngeq \ngtr \ni \nleftarrow \nleftrightarrow \nleq \nless + \nmid \not \notin \nparallel \nprec \nrightarrow \nsim \nsime + \nsubset \nsubseteq \nsucc \nsupset \nsupseteq \ntriangleleft + \ntrianglelefteq \ntriangleright \ntrianglerighteq \nu \nvDash + \nvdash \nwarrow \o \obar \ocirc \odot \oe \oiiint \oiint \oint + \omega \ominus \oplus \origof \oslash \otimes \overarc + \overleftarrow \overleftrightarrow \parallel \partial \phi \pi + \pitchfork \pm \prec \preccurlyeq \preceq \precnsim \precsim \prime + \prod \propto \prurel \psi \quad \questeq \rasp \rbrace \rbrack + \rceil \rfloor \rho \rightangle \rightarrow \rightarrowbar + \rightarrowtail \rightbrace \rightharpoonaccent \rightharpoondown + \rightharpoonup \rightleftarrows \rightleftharpoons \rightparen + \rightrightarrows \rightthreetimes \rightzigzagarrow \risingdotseq + \rq \rtimes \scrB \scrE \scrF \scrH \scrI \scrL \scrM \scrR \scre + \scrg \scro \scurel \searrow \sharp \sigma \sim \simeq \slash + \smallsetminus \smile \solbar \spadesuit \spadesuitopen + \sphericalangle \sqcap \sqcup \sqsubset \sqsubseteq \sqsupset + \sqsupseteq \ss \star \stareq \sterling \subset \subseteq \subsetneq + \succ \succcurlyeq \succeq \succnsim \succsim \sum \supset \supseteq + \supsetneq \swarrow \t \tau \textasciiacute \textasciicircum + \textasciigrave \textasciitilde \textexclamdown \textquestiondown + \textquotedblleft \textquotedblright \therefore \theta \thickspace + \thinspace \tilde \times \to \top \triangledown \triangleleft + \trianglelefteq \triangleq \triangleright \trianglerighteq + \turnednot \twoheaddownarrow \twoheadleftarrow \twoheadrightarrow + \twoheaduparrow \ulcorner \underbar \uparrow \updownarrow + \updownarrowbar \updownarrows \upharpoonleft \upharpoonright \uplus + \upsilon \upuparrows \urcorner \vDash \varepsilon \varkappa + \varnothing \varphi \varpi \varrho \varsigma \vartheta \vartriangle + \vartriangleleft \vartriangleright \vdash \vdots \vec \vee \veebar + \veeeq \vert \wedge \wedgeq \widehat \widetilde \wp \wr \xi \yen + \zeta \{ \| \} - \/ \Delta \Downarrow \Gamma \Im \LEFTangle \LEFTbrace \LEFTbracket - \LEFTparen \Lambda \Leftarrow \Leftbrace \Leftbracket \Leftparen - \Leftrightarrow \Omega \P \Phi \Pi \Psi \RIGHTangle \RIGHTbrace - \RIGHTbracket \RIGHTparen \Re \Rightarrow \Rightbrace \Rightbracket - \Rightparen \S \SQRT \Sigma \Sqrt \Theta \Uparrow \Updownarrow - \Upsilon \Vert \Xi \aleph \alpha \approx \angstrom \ast \asymp - \backslash \beta \bigcap \bigcirc \bigcup \bigodot \bigoplus - \bigotimes \bigtriangledown \bigtriangleup \biguplus \bigvee - \bigwedge \bot \bullet \cap \cdot \chi \circ \clubsuit \coprod \cup - \dag \dashv \ddag \delta \diamond \diamondsuit \div \downarrow \ell - \emptyset \epsilon \equiv \eta \exists \flat \forall \frown \gamma - \geq \gg \heartsuit \hspace \imath \in \infty \int \iota \jmath - \kappa \lambda \langle \lbrace \lceil \leftangle \leftarrow - \leftbrace \leftbracket \leftharpoondown \leftharpoonup \leftparen - \leftrightarrow \leq \lfloor \ll \mid \mp \mu \nabla \natural - \nearrow \neg \ni \nu \nwarrow \odot \oint \omega \ominus \oplus - \oslash \otimes \phi \pi \pm \prec \preceq \prime \prod \propto \psi - \rangle \rbrace \rceil \rfloor \rho \rightangle \rightarrow - \rightbrace \rightbracket \rightharpoondown \rightharpoonup - \rightparen \searrow \sharp \sigma \sim \simeq \slash \smile - \spadesuit \sqcap \sqcup \sqrt \sqsubseteq \sqsupseteq \subset - \subseteq \succ \succeq \sum \supset \supseteq \swarrow \tau \theta - \times \top \triangleleft \triangleright \uparrow \updownarrow - \uplus \upsilon \varepsilon \varphi \varphi \varrho \varsigma - \vartheta \vdash \vee \vert \wedge \wp \wr \xi \zeta - - BACKENDS mathtext currently works with GTK, Agg, GTKAgg, TkAgg and WxAgg and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 19:17:37
|
Revision: 4768 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4768&view=rev Author: mdboom Date: 2007-12-18 11:17:13 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Update information about the backends (Ps and Pdf were not mentioned.) Modified Paths: -------------- trunk/matplotlib/setup.cfg.template Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2007-12-18 17:46:01 UTC (rev 4767) +++ trunk/matplotlib/setup.cfg.template 2007-12-18 19:17:13 UTC (rev 4768) @@ -13,12 +13,12 @@ #verbose = True [provide_packages] -# By default, matplotlib checks for a few dependencies and -# installs them if missing. This feature can be turned off +# By default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off # by uncommenting the following lines. Acceptible values are: # True: install, overwrite an existing installation # False: do not install -# auto: install only if the package is unavailable. This +# auto: install only if the package is unavailable. This # is the default behavior # ## Date/timezone support: @@ -30,28 +30,28 @@ #configobj = False [gui_support] -# Matplotlib supports multiple GUI toolkits, including Cocoa, -# GTK, Fltk, Qt, Qt4, Tk, and WX. Support for many of these -# toolkits requires AGG, the Anti-Grain Geometry library, which +# Matplotlib supports multiple GUI toolkits, including Cocoa, +# GTK, Fltk, Qt, Qt4, Tk, and WX. Support for many of these +# toolkits requires AGG, the Anti-Grain Geometry library, which # is provided by matplotlib and built by default. # -# Some backends are written in pure Python, and others require -# extension code to be compiled. By default, matplotlib checks -# for these GUI toolkits during installation and, if present, -# compiles the required extensions to support the toolkit. GTK -# support requires the GTK runtime environment and PyGTK. Wx -# support requires wxWidgets and wxPython. Tk support requires -# Tk and Tkinter. The other GUI toolkits do not require any -# extension code, and can be used as long as the libraries are +# Some backends are written in pure Python, and others require +# extension code to be compiled. By default, matplotlib checks +# for these GUI toolkits during installation and, if present, +# compiles the required extensions to support the toolkit. GTK +# support requires the GTK runtime environment and PyGTK. Wx +# support requires wxWidgets and wxPython. Tk support requires +# Tk and Tkinter. The other GUI toolkits do not require any +# extension code, and can be used as long as the libraries are # installed on your system. -# +# # You can uncomment any the following lines if you know you do # not want to use the GUI toolkit. Acceptible values are: -# True: build the extension. Exits with a warning if the +# True: build the extension. Exits with a warning if the # required dependencies are not available # False: do not build the extension # auto: build if the required dependencies are available, -# otherwise skip silently. This is the default +# otherwise skip silently. This is the default # behavior # #gtk = False @@ -62,18 +62,20 @@ [rc_options] # User-configurable options # -# Default backend, one of: Agg, Cairo, CocoaAgg, GTK, GTKAgg, -# GTKCairo, FltkAgg, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg. -# Only the Agg and SVG backends do not require external -# dependencies. Do not choose GTK, GTKAgg, GTKCairo, TkAgg or -# WXAgg if you have disabled the relevent extension modules. -# Agg will be used by default. +# Default backend, one of: Agg, Cairo, CocoaAgg, GTK, GTKAgg, +# GTKCairo, FltkAgg, Pdf, Ps, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg. +# +# The Agg, Ps, Pdf and SVG backends do not require external +# dependencies. Do not choose GTK, GTKAgg, GTKCairo, TkAgg or WXAgg if +# you have disabled the relevent extension modules. Agg will be used +# by default. +# #backend = Agg # -# The numerix module was historically used to provide +# The numerix module was historically used to provide # compatibility between the Numeric, numarray, and NumPy array -# packages. Now that NumPy has emerge as the universal array -# package for python, numerix is not really necessary and is -# maintained to provide backward compatibility. Do not change +# packages. Now that NumPy has emerge as the universal array +# package for python, numerix is not really necessary and is +# maintained to provide backward compatibility. Do not change # this unless you have a compelling reason to do so. #numerix = numpy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 17:46:03
|
Revision: 4767 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4767&view=rev Author: mdboom Date: 2007-12-18 09:46:01 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Preliminary version of "adding new scales and projections" document. (In reST, since that appears to be where mpl documentation is heading.) Added Paths: ----------- branches/transforms/doc/ branches/transforms/doc/devel/ branches/transforms/doc/devel/add_new_projection.rst Added: branches/transforms/doc/devel/add_new_projection.rst =================================================================== --- branches/transforms/doc/devel/add_new_projection.rst (rev 0) +++ branches/transforms/doc/devel/add_new_projection.rst 2007-12-18 17:46:01 UTC (rev 4767) @@ -0,0 +1,192 @@ +=============================================== +Adding new scales and projections to matplotlib +=============================================== + +.. ::author Michael Droettboom + +Matplotlib supports the addition of new transformations that transform +the data before it is displayed. Separable transformations, that work +on a single dimension are called "scales", and non-separable +transformations, that take data in two or more dimensions as input are +called "projections". + +This document is intended for developers and advanced users who need +to add more scales and projections to matplotlib. + +From the user's perspective, the scale of a plot can be set with +``set_xscale`` and ``set_yscale``. Choosing the projection +currently has no *standardized* method. [MGDTODO] + +Creating a new scale +==================== + +Adding a new scale consists of defining a subclass of ``ScaleBase``, +that brings together the following elements: + + - A transformation from data space into plot space. + + - An inverse of that transformation. For example, this is used to + convert mouse positions back into data space. + + - A function to limit the range of the axis to acceptable values. A + log scale, for instance, would prevent the range from including + values less than or equal to zero. + + - Locators (major and minor) that determine where to place ticks in + the plot, and optionally, how to adjust the limits of the plot to + some "good" values. + + - Formatters (major and minor) that specify how the tick labels + should be drawn. + +There are a number of ``Scale`` classes in ``scale.py`` that may be +used as starting points for new scales. As an example, this document +presents adding a new scale ``MercatorLatitudeScale`` which can be +used to plot latitudes in a Mercator_ projection. For simplicity, +this scale assumes that it has a fixed center at the equator. The +code presented here is a simplification of actual code in +``matplotlib``, with complications added only for the sake of +optimization removed. + +First define a new subclass of ``ScaleBase``:: + + class MercatorLatitudeScale(ScaleBase): + """ + Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using + the system used to scale latitudes in a Mercator projection. + + The scale function: + ln(tan(y) + sec(y)) + + The inverse scale function: + atan(sinh(y)) + + Since the Mercator scale tends to infinity at +/- 90 degrees, + there is user-defined threshold, above and below which nothing + will be plotted. This defaults to +/- 85 degrees. + + source: + http://en.wikipedia.org/wiki/Mercator_projection + """ + name = 'mercator_latitude' + +This class must have a member ``name`` that defines the string used to +select the scale. For example, +``gca().set_yscale("mercator_latitude")`` would be used to select the +Mercator latitude scale. + +Next define two nested classes: one for the data transformation and +one for its inverse. Both of these classes must be subclasses of +``Transform`` (defined in ``transforms.py``).:: + + class MercatorLatitudeTransform(Transform): + input_dims = 1 + output_dims = 1 + +There are two class-members that must be defined. ``input_dims`` and +``output_dims`` specify number of input dimensions and output +dimensions to the transformation. These are used by the +transformation framework to do some error checking and prevent +incompatible transformations from being connected together. When +defining transforms for a scale, which are by definition separable and +only have one dimension, these members should always be 1. + +``MercatorLatitudeTransform`` has a simple constructor that takes and +stores the *threshold* for the Mercator projection (to limit its range +to prevent plotting to infinity).:: + + def __init__(self, thresh): + Transform.__init__(self) + self.thresh = thresh + +The ``transform`` method is where the real work happens: It takes an N +x 1 ``numpy`` array and returns a transformed copy. Since the range +of the Mercator scale is limited by the user-specified threshold, the +input array must be masked to contain only valid values. +``matplotlib`` will handle masked arrays and remove the out-of-range +data from the plot. Importantly, the transformation should return an +array that is the same shape as the input array, since these values +need to remain synchronized with values in the other dimension.:: + + def transform(self, a): + masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) + return ma.log(ma.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) + +Lastly for the transformation class, define a method to get the +inverse transformation:: + + def inverted(self): + return MercatorLatitudeScale.InvertedMercatorLatitudeTransform(self.thresh) + +The inverse transformation class follows the same pattern, but +obviously the mathematical operation performed is different:: + + class InvertedMercatorLatitudeTransform(Transform): + input_dims = 1 + output_dims = 1 + + def __init__(self, thresh): + Transform.__init__(self) + self.thresh = thresh + + def transform(self, a): + return npy.arctan(npy.sinh(a)) + + def inverted(self): + return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) + +Now we're back to methods for the ``MercatorLatitudeScale`` class. +Any keyword arguments passed to ``set_xscale`` and ``set_yscale`` will +be passed along to the scale's constructor. In the case of +``MercatorLatitudeScale``, the ``thresh`` keyword argument specifies +the degree at which to crop the plot data. The constructor also +creates a local instance of the ``Transform`` class defined above, +which is made available through its ``get_transform`` method:: + + def __init__(self, axis, **kwargs): + thresh = kwargs.pop("thresh", (85 / 180.0) * npy.pi) + if thresh >= npy.pi / 2.0: + raise ValueError("thresh must be less than pi/2") + self.thresh = thresh + self._transform = self.MercatorLatitudeTransform(thresh) + + def get_transform(self): + return self._transform + +The ``limit_range_for_scale`` method must be provided to limit the +bounds of the axis to the domain of the function. In the case of +Mercator, the bounds should be limited to the threshold that was +passed in. Unlike the autoscaling provided by the tick locators, this +range limiting will always be adhered to, whether the axis range is set +manually, determined automatically or changed through panning and +zooming:: + + def limit_range_for_scale(self, vmin, vmax, minpos): + return max(vmin, -self.thresh), min(vmax, self.thresh) + +Lastly, the ``set_default_locators_and_formatters`` method sets up the +locators and formatters to use with the scale. It may be that the new +scale requires new locators and formatters. Doing so is outside the +scope of this document, but there are many examples in ``ticker.py``. +The Mercator example uses a fixed locator from -90 to 90 degrees and a +custom formatter class to put convert the radians to degrees and put a +degree symbol after the value:: + + def set_default_locators_and_formatters(self, axis): + class DegreeFormatter(Formatter): + def __call__(self, x, pos=None): + # \u00b0 : degree symbol + return u"%d\u00b0" % ((x / npy.pi) * 180.0) + + deg2rad = npy.pi / 180.0 + axis.set_major_locator(FixedLocator( + npy.arange(-90, 90, 10) * deg2rad)) + axis.set_major_formatter(DegreeFormatter()) + axis.set_minor_formatter(DegreeFormatter()) + +Now that the Scale class has been defined, it must be registered so +that ``matplotlib`` can find it:: + + register_scale(MercatorLatitudeScale) + +.. _Mercator: http://en.wikipedia.org/wiki/Mercator_projection \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 17:36:20
|
Revision: 4766 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4766&view=rev Author: mdboom Date: 2007-12-18 09:36:11 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Improved documentation and efficiency... Modified Paths: -------------- branches/transforms/lib/matplotlib/scale.py Modified: branches/transforms/lib/matplotlib/scale.py =================================================================== --- branches/transforms/lib/matplotlib/scale.py 2007-12-18 15:35:06 UTC (rev 4765) +++ branches/transforms/lib/matplotlib/scale.py 2007-12-18 17:36:11 UTC (rev 4766) @@ -7,10 +7,23 @@ from transforms import Transform, IdentityTransform class ScaleBase(object): + def get_transform(self): + """ + Return the transform object associated with this scale. + """ + raise NotImplementedError + def set_default_locators_and_formatters(self, axis): + """ + Set the locators and formatters that go with this scale. + """ raise NotImplementedError def limit_range_for_scale(self, vmin, vmax, minpos): + """ + Returns the range vmin, vmax, limited to the domain supported + by this scale. + """ return vmin, vmax class LinearScale(ScaleBase): @@ -285,6 +298,10 @@ The inverse scale function: atan(sinh(y)) + Since the Mercator scale tends to infinity at +/- 90 degrees, + there is user-defined threshold, above and below which nothing + will be plotted. This defaults to +/- 85 degrees. + source: http://en.wikipedia.org/wiki/Mercator_projection """ @@ -302,23 +319,27 @@ def transform(self, a): masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) if masked.mask.any(): - return ma.log(ma.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) + return ma.log(npy.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) else: return npy.log(npy.abs(npy.tan(a) + 1.0 / npy.cos(a))) def inverted(self): - return MercatorLatitudeScale.InvertedMercatorLatitudeTransform() + return MercatorLatitudeScale.InvertedMercatorLatitudeTransform(self.thresh) class InvertedMercatorLatitudeTransform(Transform): input_dims = 1 output_dims = 1 is_separable = True + def __init__(self, thresh): + Transform.__init__(self) + self.thresh = thresh + def transform(self, a): return npy.arctan(npy.sinh(a)) def inverted(self): - return MercatorLatitudeScale.MercatorLatitudeTransform() + return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) def __init__(self, axis, **kwargs): thresh = kwargs.pop("thresh", (85 / 180.0) * npy.pi) @@ -328,11 +349,7 @@ self._transform = self.MercatorLatitudeTransform(thresh) def set_default_locators_and_formatters(self, axis): - class ThetaFormatter(Formatter): - """ - Used to format the theta tick labels. Converts the native - unit of radians into degrees and adds a degree symbol. - """ + class DegreeFormatter(Formatter): def __call__(self, x, pos=None): # \u00b0 : degree symbol return u"%d\u00b0" % ((x / npy.pi) * 180.0) @@ -340,8 +357,8 @@ deg2rad = npy.pi / 180.0 axis.set_major_locator(FixedLocator( npy.arange(-90, 90, 10) * deg2rad)) - axis.set_major_formatter(ThetaFormatter()) - axis.set_minor_formatter(ThetaFormatter()) + axis.set_major_formatter(DegreeFormatter()) + axis.set_minor_formatter(DegreeFormatter()) def get_transform(self): return self._transform @@ -366,6 +383,12 @@ return _scale_mapping[scale](axis, **kwargs) +def register_scale(scale_class): + """ + Register a new kind of scale. + """ + _scale_mapping[scale_class.name] = scale_class + def get_scale_names(): names = _scale_mapping.keys() names.sort() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 15:35:10
|
Revision: 4765 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4765&view=rev Author: mdboom Date: 2007-12-18 07:35:06 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Fix log scaling of polar plots. Modified Paths: -------------- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/projections/polar.py Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-12-18 15:29:53 UTC (rev 4764) +++ branches/transforms/lib/matplotlib/axes.py 2007-12-18 15:35:06 UTC (rev 4765) @@ -1287,13 +1287,10 @@ return if scalex: - xl = self.get_xbound() XL = self.xaxis.get_major_locator().autoscale() self.set_xbound(XL) if scaley: - ylocator = self.yaxis.get_major_locator() - yl = self.get_ybound() - YL = ylocator.autoscale() + YL = self.yaxis.get_major_locator().autoscale() self.set_ybound(YL) def update_layout(self, renderer): Modified: branches/transforms/lib/matplotlib/projections/polar.py =================================================================== --- branches/transforms/lib/matplotlib/projections/polar.py 2007-12-18 15:29:53 UTC (rev 4764) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-12-18 15:35:06 UTC (rev 4765) @@ -74,19 +74,21 @@ The affine part of the polar projection. Scales the output so that maximum radius rests on the edge of the axes circle. """ - def __init__(self, limits): + def __init__(self, scale_transform, limits): """ limits is the view limit of the data. The only part of its bounds that is used is ymax (for the radius maximum). """ Affine2DBase.__init__(self) + self._scale_transform = scale_transform self._limits = limits - self.set_children(limits) + self.set_children(scale_transform, limits) self._mtx = None def get_matrix(self): if self._invalid: - ymax = self._limits.ymax + limits_scaled = self._limits.transformed(self._scale_transform) + ymax = limits_scaled.ymax affine = Affine2D() \ .scale(0.5 / ymax) \ .translate(0.5, 0.5) @@ -193,7 +195,7 @@ # An affine transformation on the data, generally to limit the # range of the axes - self.transProjectionAffine = self.PolarAffine(self.viewLim) + self.transProjectionAffine = self.PolarAffine(self.transScale, self.viewLim) # The complete data transformation stack -- from data all the # way to display coordinates @@ -205,7 +207,7 @@ # the edge of the axis circle. self._xaxis_transform = ( self.transProjection + - self.PolarAffine(Bbox.unit()) + + self.PolarAffine(IdentityTransform(), Bbox.unit()) + self.transAxes) # The theta labels are moved from radius == 0.0 to radius == 1.1 self._theta_label1_position = Affine2D().translate(0.0, 1.1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 15:30:00
|
Revision: 4764 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4764&view=rev Author: mdboom Date: 2007-12-18 07:29:53 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Fix bug in calculating minpos. Modified Paths: -------------- branches/transforms/src/_path.cpp Modified: branches/transforms/src/_path.cpp =================================================================== --- branches/transforms/src/_path.cpp 2007-12-18 13:08:04 UTC (rev 4763) +++ branches/transforms/src/_path.cpp 2007-12-18 15:29:53 UTC (rev 4764) @@ -277,20 +277,12 @@ { if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) continue; - if (x < *x0) - { - *x0 = x; - if (x > 0.0) - *xm = x; - } - if (y < *y0) - { - *y0 = y; - if (y > 0.0) - *ym = y; - } + if (x < *x0) *x0 = x; + if (y < *y0) *y0 = y; if (x > *x1) *x1 = x; if (y > *y1) *y1 = y; + if (x > 0.0 && x < *xm) *xm = x; + if (y > 0.0 && y < *ym) *ym = y; } } @@ -435,8 +427,8 @@ args.verify_length(5); //segments, trans, clipbox, colors, linewidths, antialiaseds - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); - Py::SeqBase<Py::Object> paths = args[1]; + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); + Py::SeqBase<Py::Object> paths = args[1]; Py::SeqBase<Py::Object> transforms_obj = args[2]; Py::Object offsets_obj = args[3]; agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false); @@ -523,11 +515,11 @@ args.verify_length(9); //segments, trans, clipbox, colors, linewidths, antialiaseds - double x = Py::Float(args[0]); - double y = Py::Float(args[1]); + double x = Py::Float(args[0]); + double y = Py::Float(args[1]); double radius = Py::Float(args[2]); - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]); - Py::SeqBase<Py::Object> paths = args[4]; + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]); + Py::SeqBase<Py::Object> paths = args[4]; Py::SeqBase<Py::Object> transforms_obj = args[5]; Py::SeqBase<Py::Object> offsets_obj = args[6]; agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]); @@ -541,9 +533,9 @@ throw Py::ValueError("Offsets array must be Nx2"); } - size_t Npaths = paths.length(); + size_t Npaths = paths.length(); size_t Noffsets = offsets->dimensions[0]; - size_t N = std::max(Npaths, Noffsets); + size_t N = std::max(Npaths, Noffsets); size_t Ntransforms = std::min(transforms_obj.length(), N); size_t i; @@ -919,10 +911,6 @@ f = *(double*)(row1); } - // I would have preferred to use PyArray_FromDims here, but on - // 64-bit platforms, PyArray_DIMS() does not return the same thing - // that PyArray_FromDims wants, requiring a copy, which I would - // like to avoid in this critical section. result = (PyArrayObject*)PyArray_SimpleNew (PyArray_NDIM(vertices), PyArray_DIMS(vertices), PyArray_DOUBLE); if (PyArray_NDIM(vertices) == 2) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 13:08:27
|
Revision: 4763 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4763&view=rev Author: mdboom Date: 2007-12-18 05:08:04 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Don't allocate the clipping path buffers unless we need them. Modified Paths: -------------- branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-12-18 13:02:33 UTC (rev 4762) +++ branches/transforms/src/_backend_agg.cpp 2007-12-18 13:08:04 UTC (rev 4763) @@ -239,27 +239,22 @@ height(height), dpi(dpi), NUMBYTES(width*height*4), + alphaBuffer(NULL), + alphaMaskRenderingBuffer(NULL), + alphaMask(NULL), + pixfmtAlphaMask(NULL), + rendererBaseAlphaMask(NULL), + rendererAlphaMask(NULL), + scanlineAlphaMask(NULL), debug(debug) { _VERBOSE("RendererAgg::RendererAgg"); unsigned stride(width*4); - pixBuffer = new agg::int8u[NUMBYTES]; renderingBuffer = new agg::rendering_buffer; renderingBuffer->attach(pixBuffer, width, height, stride); - alphaBuffer = new agg::int8u[NUMBYTES]; - alphaMaskRenderingBuffer = new agg::rendering_buffer; - alphaMaskRenderingBuffer->attach(alphaBuffer, width, height, stride); - alphaMask = new alpha_mask_type(*alphaMaskRenderingBuffer); - - pixfmtAlphaMask = new agg::pixfmt_gray8(*alphaMaskRenderingBuffer); - rendererBaseAlphaMask = new renderer_base_alpha_mask_type(*pixfmtAlphaMask); - rendererAlphaMask = new renderer_alpha_mask_type(*rendererBaseAlphaMask); - scanlineAlphaMask = new agg::scanline_p8(); - - slineP8 = new scanline_p8; slineBin = new scanline_bin; @@ -275,6 +270,21 @@ }; +void RendererAgg::create_alpha_buffers() { + if (!alphaBuffer) { + unsigned stride(width*4); + alphaBuffer = new agg::int8u[NUMBYTES]; + alphaMaskRenderingBuffer = new agg::rendering_buffer; + alphaMaskRenderingBuffer->attach(alphaBuffer, width, height, stride); + alphaMask = new alpha_mask_type(*alphaMaskRenderingBuffer); + + pixfmtAlphaMask = new agg::pixfmt_gray8(*alphaMaskRenderingBuffer); + rendererBaseAlphaMask = new renderer_base_alpha_mask_type(*pixfmtAlphaMask); + rendererAlphaMask = new renderer_alpha_mask_type(*rendererBaseAlphaMask); + scanlineAlphaMask = new agg::scanline_p8(); + } +} + template<class R> void RendererAgg::set_clipbox(const Py::Object& cliprect, R rasterizer) { @@ -442,6 +452,7 @@ if (has_clippath && (clippath.ptr() != lastclippath.ptr() || clippath_trans != lastclippath_transform)) { + create_alpha_buffers(); agg::trans_affine trans(clippath_trans); trans *= agg::trans_affine_scaling(1.0, -1.0); trans *= agg::trans_affine_translation(0.0, (double)height); @@ -617,7 +628,7 @@ _color(color) { } - void generate(color_type* output_span, int x, int y, unsigned len) + inline void generate(color_type* output_span, int x, int y, unsigned len) { _allocator.allocate(len); child_color_type* input_span = _allocator.span(); Modified: branches/transforms/src/_backend_agg.h =================================================================== --- branches/transforms/src/_backend_agg.h 2007-12-18 13:02:33 UTC (rev 4762) +++ branches/transforms/src/_backend_agg.h 2007-12-18 13:08:04 UTC (rev 4763) @@ -77,7 +77,7 @@ SafeSnap() : first(true), xsnap(0.0), lastx(0.0), lastxsnap(0.0), ysnap(0.0), lasty(0.0), lastysnap(0.0) {} SnapData snap (const float& x, const float& y); - + private: bool first; float xsnap, lastx, lastxsnap, ysnap, lasty, lastysnap; @@ -87,7 +87,7 @@ // a class in the swig wrapper class BufferRegion : public Py::PythonExtension<BufferRegion> { public: - BufferRegion(const agg::rect_i &r, bool freemem=true) : + BufferRegion(const agg::rect_i &r, bool freemem=true) : rect(r), freemem(freemem) { width = r.x2 - r.x1; height = r.y2 - r.y1; @@ -99,7 +99,7 @@ int width; int height; int stride; - + bool freemem; Py::Object to_string(const Py::Tuple &args); @@ -151,7 +151,7 @@ //struct AMRenderer { -// +// //} // the renderer @@ -246,6 +246,7 @@ const Py::SeqBase<Py::Int>& antialiaseds); private: + void create_alpha_buffers(); Py::Object lastclippath; agg::trans_affine lastclippath_transform; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-18 13:02:38
|
Revision: 4762 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4762&view=rev Author: mdboom Date: 2007-12-18 05:02:33 -0800 (Tue, 18 Dec 2007) Log Message: ----------- Minor speed improvement Modified Paths: -------------- branches/transforms/lib/matplotlib/scale.py Modified: branches/transforms/lib/matplotlib/scale.py =================================================================== --- branches/transforms/lib/matplotlib/scale.py 2007-12-17 18:29:04 UTC (rev 4761) +++ branches/transforms/lib/matplotlib/scale.py 2007-12-18 13:02:33 UTC (rev 4762) @@ -301,7 +301,10 @@ def transform(self, a): masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) - return ma.log(ma.tan(masked) + 1.0 / ma.cos(masked)) + if masked.mask.any(): + return ma.log(ma.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) + else: + return npy.log(npy.abs(npy.tan(a) + 1.0 / npy.cos(a))) def inverted(self): return MercatorLatitudeScale.InvertedMercatorLatitudeTransform() @@ -346,6 +349,7 @@ def limit_range_for_scale(self, vmin, vmax, minpos): return max(vmin, -self.thresh), min(vmax, self.thresh) + _scale_mapping = { 'linear' : LinearScale, 'log' : LogScale, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-17 18:29:10
|
Revision: 4761 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4761&view=rev Author: mdboom Date: 2007-12-17 10:29:04 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Minor speed improvement Modified Paths: -------------- branches/transforms/lib/matplotlib/projections/polar.py Modified: branches/transforms/lib/matplotlib/projections/polar.py =================================================================== --- branches/transforms/lib/matplotlib/projections/polar.py 2007-12-17 18:28:03 UTC (rev 4760) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-12-17 18:29:04 UTC (rev 4761) @@ -310,7 +310,7 @@ ACCEPTS: sequence of floats """ angles = npy.asarray(angles, npy.float_) - self.set_xticks((angles / 180.0) * npy.pi) + self.set_xticks(angles * (npy.pi / 180.0)) if labels is not None: self.set_xticklabels(labels) if frac is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-17 18:28:09
|
Revision: 4760 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4760&view=rev Author: mdboom Date: 2007-12-17 10:28:03 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Added Mercator latitude scale. Modified Paths: -------------- branches/transforms/lib/matplotlib/scale.py Modified: branches/transforms/lib/matplotlib/scale.py =================================================================== --- branches/transforms/lib/matplotlib/scale.py 2007-12-17 17:20:29 UTC (rev 4759) +++ branches/transforms/lib/matplotlib/scale.py 2007-12-17 18:28:03 UTC (rev 4760) @@ -2,8 +2,8 @@ from matplotlib.numerix import npyma as ma MaskedArray = ma.MaskedArray -from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext -from ticker import NullLocator, LogLocator, AutoLocator, SymmetricalLogLocator +from ticker import NullFormatter, ScalarFormatter, LogFormatterMathtext, Formatter +from ticker import NullLocator, LogLocator, AutoLocator, SymmetricalLogLocator, FixedLocator from transforms import Transform, IdentityTransform class ScaleBase(object): @@ -28,6 +28,7 @@ def get_transform(self): return IdentityTransform() + def _mask_non_positives(a): mask = a <= 0.0 if mask.any(): @@ -185,7 +186,17 @@ return (vmin <= 0.0 and minpos or vmin, vmax <= 0.0 and minpos or vmax) + class SymmetricalLogScale(ScaleBase): + """ + The symmetrical logarithmic scale is logarithmic in both the + positive and negative directions from the origin. + + Since the values close to zero tend toward infinity, there is + usually need to have a range around zero that is linear. The + parameter "linthresh" allows the user to specify the size of this + range (-linthresh, linthresh). + """ name = 'symlog' class SymmetricalLogTransform(Transform): @@ -263,10 +274,83 @@ return self._transform +class MercatorLatitudeScale(ScaleBase): + """ + Scales data in range -pi/2 to pi/2 (-90 to 90 degrees) using + the system used to scale latitudes in a Mercator projection. + + The scale function: + ln(tan(y) + sec(y)) + + The inverse scale function: + atan(sinh(y)) + + source: + http://en.wikipedia.org/wiki/Mercator_projection + """ + name = 'mercator_latitude' + + class MercatorLatitudeTransform(Transform): + input_dims = 1 + output_dims = 1 + is_separable = True + + def __init__(self, thresh): + Transform.__init__(self) + self.thresh = thresh + + def transform(self, a): + masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) + return ma.log(ma.tan(masked) + 1.0 / ma.cos(masked)) + + def inverted(self): + return MercatorLatitudeScale.InvertedMercatorLatitudeTransform() + + class InvertedMercatorLatitudeTransform(Transform): + input_dims = 1 + output_dims = 1 + is_separable = True + + def transform(self, a): + return npy.arctan(npy.sinh(a)) + + def inverted(self): + return MercatorLatitudeScale.MercatorLatitudeTransform() + + def __init__(self, axis, **kwargs): + thresh = kwargs.pop("thresh", (85 / 180.0) * npy.pi) + if thresh >= npy.pi / 2.0: + raise ValueError("thresh must be less than pi/2") + self.thresh = thresh + self._transform = self.MercatorLatitudeTransform(thresh) + + def set_default_locators_and_formatters(self, axis): + class ThetaFormatter(Formatter): + """ + Used to format the theta tick labels. Converts the native + unit of radians into degrees and adds a degree symbol. + """ + def __call__(self, x, pos=None): + # \u00b0 : degree symbol + return u"%d\u00b0" % ((x / npy.pi) * 180.0) + + deg2rad = npy.pi / 180.0 + axis.set_major_locator(FixedLocator( + npy.arange(-90, 90, 10) * deg2rad)) + axis.set_major_formatter(ThetaFormatter()) + axis.set_minor_formatter(ThetaFormatter()) + + def get_transform(self): + return self._transform + + def limit_range_for_scale(self, vmin, vmax, minpos): + return max(vmin, -self.thresh), min(vmax, self.thresh) + _scale_mapping = { - 'linear' : LinearScale, - 'log' : LogScale, - 'symlog' : SymmetricalLogScale + 'linear' : LinearScale, + 'log' : LogScale, + 'symlog' : SymmetricalLogScale, + 'mercator_latitude' : MercatorLatitudeScale } def scale_factory(scale, axis, **kwargs): scale = scale.lower() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-12-17 17:21:17
|
Revision: 4759 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4759&view=rev Author: jswhit Date: 2007-12-17 09:20:29 -0800 (Mon, 17 Dec 2007) Log Message: ----------- fix typo Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 15:43:03 UTC (rev 4758) +++ trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 17:20:29 UTC (rev 4759) @@ -7,7 +7,7 @@ date = '20071215' else: date = sys.argv[1] -if date[4] > '2005': +if date[0:4] > '2005': ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc') else: ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-17 15:43:08
|
Revision: 4758 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4758&view=rev Author: mdboom Date: 2007-12-17 07:43:03 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Merged revisions 4735-4757 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4745 | jdh2358 | 2007-12-15 16:33:38 -0500 (Sat, 15 Dec 2007) | 1 line changed %g to %r for rec2csv ........ r4747 | astraw | 2007-12-16 14:28:46 -0500 (Sun, 16 Dec 2007) | 1 line Add test for rec2csv and csv2rec roundtrip not losing precision. ........ r4748 | astraw | 2007-12-16 15:53:35 -0500 (Sun, 16 Dec 2007) | 1 line rec2csv does not close filehandles passed in open ........ r4749 | astraw | 2007-12-16 18:19:59 -0500 (Sun, 16 Dec 2007) | 1 line fix csv2rec roundtrip for funky strings, too ........ r4755 | jdh2358 | 2007-12-16 23:37:38 -0500 (Sun, 16 Dec 2007) | 1 line mods to support dates in csv2rec and friends ........ Modified Paths: -------------- branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/lib/matplotlib/mpl-data/matplotlib.conf.template Added Paths: ----------- branches/transforms/unit/mlab_unit.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4734 + /trunk/matplotlib:1-4757 Modified: branches/transforms/CHANGELOG =================================================================== --- branches/transforms/CHANGELOG 2007-12-17 15:41:47 UTC (rev 4757) +++ branches/transforms/CHANGELOG 2007-12-17 15:43:03 UTC (rev 4758) @@ -1,3 +1,6 @@ +2007-12-16 rec2csv saves doubles without losing precision. Also, it + does not close filehandles passed in open. - JDH,ADS + 2007-12-13 Moved rec2gtk to matplotlib.toolkits.gtktools and rec2excel to matplotlib.toolkits.exceltools - JDH Modified: branches/transforms/lib/matplotlib/cbook.py =================================================================== --- branches/transforms/lib/matplotlib/cbook.py 2007-12-17 15:41:47 UTC (rev 4757) +++ branches/transforms/lib/matplotlib/cbook.py 2007-12-17 15:43:03 UTC (rev 4758) @@ -225,7 +225,7 @@ except TypeError: return False else: return True -def to_filehandle(fname, flag='r'): +def to_filehandle(fname, flag='r', return_opened=False): """ fname can be a filename or a file handle. Support for gzipped files is automatic, if the filename ends in .gz. flag is a @@ -237,10 +237,14 @@ fh = gzip.open(fname, flag) else: fh = file(fname, flag) + opened = True elif hasattr(fname, 'seek'): fh = fname + opened = False else: raise ValueError('fname must be a string or file handle') + if return_opened: + return fh, opened return fh def flatten(seq, scalarp=is_scalar): Modified: branches/transforms/lib/matplotlib/mlab.py =================================================================== --- branches/transforms/lib/matplotlib/mlab.py 2007-12-17 15:41:47 UTC (rev 4757) +++ branches/transforms/lib/matplotlib/mlab.py 2007-12-17 15:43:03 UTC (rev 4758) @@ -2129,6 +2129,7 @@ process_skiprows(reader) + dateparser = dateutil.parser.parse def myfloat(x): if x==missing: @@ -2136,9 +2137,18 @@ else: return float(x) + def mydate(x): + # try and return a date object + d = dateparser(x) + + if d.hour>0 or d.minute>0 or d.second>0: + raise ValueError('not a date') + return d.date() + + def get_func(item, func): # promote functions in this order - funcmap = {int:myfloat, myfloat:dateutil.parser.parse, dateutil.parser.parse:str} + funcmap = {int:myfloat, myfloat:mydate, mydate:dateparser, dateparser:str} try: func(item) except: if func==str: @@ -2238,8 +2248,12 @@ class FormatString(FormatObj): def tostr(self, x): - return '"%s"'%self.toval(x) + val = repr(x) + return val[1:-1] +#class FormatString(FormatObj): +# def tostr(self, x): +# return '"%r"'%self.toval(x) class FormatFormatStr(FormatObj): def __init__(self, fmt): @@ -2297,7 +2311,7 @@ npy.float32 : FormatFloat(), npy.float64 : FormatFloat(), npy.object_ : FormatObj(), - npy.string_ : FormatObj(), + npy.string_ : FormatString(), } def get_formatd(r, formatd=None): @@ -2317,7 +2331,7 @@ format = copy.deepcopy(format) if isinstance(format, FormatFloat): format.scale = 1. # override scaling for storage - format.fmt = '%g' # maximal precision + format.fmt = '%r' return format def rec2csv(r, fname, delimiter=',', formatd=None): @@ -2335,13 +2349,14 @@ for i, name in enumerate(r.dtype.names): funcs.append(csvformat_factory(formatd[name]).tostr) - fh = cbook.to_filehandle(fname, 'w') + fh, opened = cbook.to_filehandle(fname, 'w', return_opened=True) writer = csv.writer(fh, delimiter=delimiter) header = r.dtype.names writer.writerow(header) for row in r: writer.writerow([func(val) for func, val in zip(funcs, row)]) - fh.close() + if opened: + fh.close() Modified: branches/transforms/lib/matplotlib/mpl-data/matplotlib.conf.template =================================================================== --- branches/transforms/lib/matplotlib/mpl-data/matplotlib.conf.template 2007-12-17 15:41:47 UTC (rev 4757) +++ branches/transforms/lib/matplotlib/mpl-data/matplotlib.conf.template 2007-12-17 15:43:03 UTC (rev 4758) @@ -3,32 +3,32 @@ # This is a sample matplotlib configuration file. It should be placed # in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and # C:\Documents and Settings\yourname\.matplotlib (win32 systems) -# +# # By default, the installer will overwrite the existing file in the install # path, so if you want to preserve yours, please move it to your HOME dir and # set the environment variable if necessary. -# +# # This file is best viewed in a editor which supports ini or conf mode syntax # highlighting. -# +# # Blank lines, or lines starting with a comment symbol, are ignored, # as are trailing comments. Other lines must have the format -# +# # key = val optional comment -# +# # val should be valid python syntax, just as you would use when setting # properties using rcParams. This should become more obvious by inspecting # the default values listed herein. -# +# # Colors: for the color values below, you can either use # - a matplotlib color string, such as r | k | b # - an rgb tuple, such as (1.0, 0.5, 0.0) # - a hex string, such as #ff00ff or ff00ff # - a scalar grayscale intensity such as 0.75 # - a legal html color name, eg red | blue | darkslategray -# +# # Interactivity: see http://matplotlib.sourceforge.net/interactive.html. -# +# # ### CONFIGURATION BEGINS HERE ### # a value of type 'str' @@ -42,7 +42,7 @@ # 'Africa/Abidjan' or 'Africa/Accra' or 'Africa/Addis_Ababa' or # 'Africa/Algiers' or 'Africa/Asmara' or 'Africa/Asmera' or 'Africa/Bamako' or # 'Africa/Bangui' or 'Africa/Banjul' or 'Africa/Bissau' or 'Africa/Blantyre' -# <...snipped 156 lines...> +# <...snipped 156 lines...> # 'US/Michigan' or 'US/Mountain' or 'US/Pacific' or 'US/Pacific-New' or # 'US/Samoa' or 'UTC' or 'Universal' or 'W-SU' or 'WET' or 'Zulu' or # 'posixrules' @@ -108,10 +108,10 @@ [[ps]] # 3 or 42 fonttype = 3 - # 'auto' or 'letter' or 'legal' or 'ledger' or 'A0' or 'A1' or 'A2' or - # 'A3' or 'A4' or 'A5' or 'A6' or 'A7' or 'A8' or 'A9' or 'A10' or - # 'B0' or 'B1' or 'B2' or 'B3' or 'B4' or 'B5' or 'B6' or 'B7' or 'B8' - # or 'B9' or 'B10' + # auto | letter | legal | ledger | A0 | A1 | A2 | + # A3 | A4 | A5 | A6 | A7 | A8 | A9 | A10 | + # B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 + # | B9 | B10 papersize = 'letter' # a value of type 'bool' useafm = False @@ -216,7 +216,7 @@ # 'Accent' or 'Accent_r' or 'Blues' or 'Blues_r' or 'BrBG' or 'BrBG_r' or # 'BuGn' or 'BuGn_r' or 'BuPu' or 'BuPu_r' or 'Dark2' or 'Dark2_r' or # 'GnBu' or 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or - # <...snipped 16 lines...> + # <...snipped 16 lines...> # 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' or # 'spring' or 'spring_r' or 'summer' or 'summer_r' or 'winter' or # 'winter_r' @@ -404,4 +404,4 @@ # a value of type 'float' pad = 4.0 # a value of type 'float' - size = 2.0 \ No newline at end of file + size = 2.0 Copied: branches/transforms/unit/mlab_unit.py (from rev 4755, trunk/matplotlib/unit/mlab_unit.py) =================================================================== --- branches/transforms/unit/mlab_unit.py (rev 0) +++ branches/transforms/unit/mlab_unit.py 2007-12-17 15:43:03 UTC (rev 4758) @@ -0,0 +1,59 @@ +import datetime, StringIO, unittest +import matplotlib.mlab as mlab +import numpy + +class TestMlab(unittest.TestCase): + def test_csv2rec_closefile(self): + # If passed a file-like object, rec2csv should not close it. + ra=numpy.rec.array([(123, 1197346475.0137341), (456, 123.456)], + dtype=[('a', '<i8'), ('b', '<f8')]) + fh = StringIO.StringIO() + mlab.rec2csv( ra, fh ) + self.failIf( fh.closed ) + + def test_csv2rec_roundtrip(self): + + # Make sure double-precision floats and strings pass through a + # roundtrip unaltered. + + # A bug in numpy (fixed in r4602) meant that numpy scalars + # lost precision when passing through repr(). csv2rec was + # affected by this. This test will only pass on numpy >= + # 1.0.5. + delta = datetime.timedelta(days=1) + date0 = datetime.date(2007,12,16) + date1 = date0 + delta + date2 = date1 + delta + + delta = datetime.timedelta(days=1) + datetime0 = datetime.datetime(2007,12,16,22,29,34,924122) + datetime1 = datetime0 + delta + datetime2 = datetime1 + delta + ra=numpy.rec.fromrecords([ + (123, date0, datetime0, 1197346475.0137341, 'a,bc'), + (456, date1, datetime1, 123.456, 'd\'ef'), + (789, date2, datetime2, 0.000000001, 'ghi'), + ], + names='intdata,datedata,datetimedata,floatdata,stringdata') + + fh = StringIO.StringIO() + mlab.rec2csv( ra, fh ) + fh.seek(0) + if 0: + print 'CSV contents:','-'*40 + print fh.read() + print '-'*40 + fh.seek(0) + ra2 = mlab.csv2rec(fh) + fh.close() + #print 'ra', ra + #print 'ra2', ra2 + for name in ra.dtype.names: + if 0: + print name, repr(ra[name]), repr(ra2[name]) + dt = ra.dtype[name] + print 'repr(dt.type)',repr(dt.type) + self.failUnless( numpy.all(ra[name] == ra2[name]) ) # should not fail with numpy 1.0.5 + +if __name__=='__main__': + unittest.main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-17 15:41:49
|
Revision: 4757 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4757&view=rev Author: mdboom Date: 2007-12-17 07:41:47 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Make filename match example. Modified Paths: -------------- branches/transforms/examples/symlog_demo.py Modified: branches/transforms/examples/symlog_demo.py =================================================================== --- branches/transforms/examples/symlog_demo.py 2007-12-17 15:41:34 UTC (rev 4756) +++ branches/transforms/examples/symlog_demo.py 2007-12-17 15:41:47 UTC (rev 4757) @@ -1,7 +1,7 @@ #!/usr/bin/env python from pylab import * -dt = 1.0 +dt = 0.01 x = arange(-50.0, 50.0, dt) y = arange(0, 100.0, dt) @@ -25,5 +25,5 @@ grid(True) ylabel('symlog both') -savefig('log_demo') +savefig('symlog_demo') show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-12-17 15:41:43
|
Revision: 4756 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4756&view=rev Author: mdboom Date: 2007-12-17 07:41:34 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Bugfix Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_pdf.py Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-17 04:37:38 UTC (rev 4755) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-12-17 15:41:34 UTC (rev 4756) @@ -399,7 +399,7 @@ self.nextImage = 1 self.markers = {} - self.two_byte_charprocs = {} + self.multi_byte_charprocs = {} # The PDF spec recommends to include every procset procsets = [ Name(x) @@ -431,7 +431,7 @@ xobjects = dict(self.images.values()) for tup in self.markers.values(): xobjects[tup[0]] = tup[1] - for name, value in self.two_byte_charprocs.items(): + for name, value in self.multi_byte_charprocs.items(): xobjects[name] = value self.writeObject(self.XObjectObject, xobjects) self.writeImages() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-12-17 04:37:43
|
Revision: 4755 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4755&view=rev Author: jdh2358 Date: 2007-12-16 20:37:38 -0800 (Sun, 16 Dec 2007) Log Message: ----------- mods to support dates in csv2rec and friends Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/unit/mlab_unit.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-17 02:57:17 UTC (rev 4754) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-17 04:37:38 UTC (rev 4755) @@ -2129,6 +2129,7 @@ process_skiprows(reader) + dateparser = dateutil.parser.parse def myfloat(x): if x==missing: @@ -2136,9 +2137,18 @@ else: return float(x) + def mydate(x): + # try and return a date object + d = dateparser(x) + + if d.hour>0 or d.minute>0 or d.second>0: + raise ValueError('not a date') + return d.date() + + def get_func(item, func): # promote functions in this order - funcmap = {int:myfloat, myfloat:dateutil.parser.parse, dateutil.parser.parse:str} + funcmap = {int:myfloat, myfloat:mydate, mydate:dateparser, dateparser:str} try: func(item) except: if func==str: @@ -2233,17 +2243,17 @@ return self.toval(x) def toval(self, x): - return repr(x) + return str(x) -class FormatString2(FormatObj): +class FormatString(FormatObj): def tostr(self, x): val = repr(x) return val[1:-1] -class FormatString(FormatObj): - def tostr(self, x): - return '"%r"'%self.toval(x) +#class FormatString(FormatObj): +# def tostr(self, x): +# return '"%r"'%self.toval(x) class FormatFormatStr(FormatObj): def __init__(self, fmt): @@ -2301,7 +2311,7 @@ npy.float32 : FormatFloat(), npy.float64 : FormatFloat(), npy.object_ : FormatObj(), - npy.string_ : FormatString2(), + npy.string_ : FormatString(), } def get_formatd(r, formatd=None): Modified: trunk/matplotlib/unit/mlab_unit.py =================================================================== --- trunk/matplotlib/unit/mlab_unit.py 2007-12-17 02:57:17 UTC (rev 4754) +++ trunk/matplotlib/unit/mlab_unit.py 2007-12-17 04:37:38 UTC (rev 4755) @@ -1,7 +1,6 @@ -import unittest +import datetime, StringIO, unittest import matplotlib.mlab as mlab import numpy -import StringIO class TestMlab(unittest.TestCase): def test_csv2rec_closefile(self): @@ -21,11 +20,22 @@ # lost precision when passing through repr(). csv2rec was # affected by this. This test will only pass on numpy >= # 1.0.5. - ra=numpy.rec.array([(123, 1197346475.0137341, 'a,bc'), - (456, 123.456, 'd\'ef'), - (789, 0.000000001, 'ghi'), + delta = datetime.timedelta(days=1) + date0 = datetime.date(2007,12,16) + date1 = date0 + delta + date2 = date1 + delta + + delta = datetime.timedelta(days=1) + datetime0 = datetime.datetime(2007,12,16,22,29,34,924122) + datetime1 = datetime0 + delta + datetime2 = datetime1 + delta + ra=numpy.rec.fromrecords([ + (123, date0, datetime0, 1197346475.0137341, 'a,bc'), + (456, date1, datetime1, 123.456, 'd\'ef'), + (789, date2, datetime2, 0.000000001, 'ghi'), ], - dtype=[('a', '<i8'), ('b', '<f8'), ('c', '|S3')]) + names='intdata,datedata,datetimedata,floatdata,stringdata') + fh = StringIO.StringIO() mlab.rec2csv( ra, fh ) fh.seek(0) @@ -36,6 +46,8 @@ fh.seek(0) ra2 = mlab.csv2rec(fh) fh.close() + #print 'ra', ra + #print 'ra2', ra2 for name in ra.dtype.names: if 0: print name, repr(ra[name]), repr(ra2[name]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-12-17 02:57:24
|
Revision: 4754 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4754&view=rev Author: jswhit Date: 2007-12-16 18:57:17 -0800 (Sun, 16 Dec 2007) Log Message: ----------- enter a date on command line. Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 02:12:31 UTC (rev 4753) +++ trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 02:57:17 UTC (rev 4754) @@ -1,10 +1,16 @@ from matplotlib.toolkits.basemap import Basemap, NetCDFFile -import pylab, numpy +import pylab, numpy, sys # read in sea-surface temperature and ice data # can be a local file, a URL for a remote opendap dataset, # or (if PyNIO is installed) a GRIB or HDF file. -date = '20071214' -ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc') +if len(sys.argv) == 1: + date = '20071215' +else: + date = sys.argv[1] +if date[4] > '2005': + ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc') +else: + ncfile = NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc') # read sst. Will automatically create a masked array using # missing_value variable attribute. sst = ncfile.variables['sst'][:] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-12-17 02:12:35
|
Revision: 4753 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4753&view=rev Author: jswhit Date: 2007-12-16 18:12:31 -0800 (Sun, 16 Dec 2007) Log Message: ----------- update requirements. Modified Paths: -------------- trunk/toolkits/basemap/README Modified: trunk/toolkits/basemap/README =================================================================== --- trunk/toolkits/basemap/README 2007-12-17 01:53:39 UTC (rev 4752) +++ trunk/toolkits/basemap/README 2007-12-17 02:12:31 UTC (rev 4753) @@ -5,6 +5,8 @@ **Requirements** +python 2.3 (or higher) + matplotlib 0.90 (or higher) numpy 1.0 (or higher) @@ -12,6 +14,8 @@ The GEOS (Geometry Engine - Open Source) library (version 2.2.3). Source code is included in the geos-2.2.3 directory. +setuptools (only if your are using python 2.3) + **Copyright** source code from proj.4 (http://proj.maptools.org) is included in the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-12-17 01:53:43
|
Revision: 4752 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4752&view=rev Author: jswhit Date: 2007-12-16 17:53:39 -0800 (Sun, 16 Dec 2007) Log Message: ----------- forgot that setuptools still needed for package_data in python 2.3 Modified Paths: -------------- trunk/toolkits/basemap/setup.py Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2007-12-16 23:28:59 UTC (rev 4751) +++ trunk/toolkits/basemap/setup.py 2007-12-17 01:53:39 UTC (rev 4752) @@ -1,5 +1,16 @@ import sys, glob, os from distutils.core import setup +major, minor1, minor2, s, tmp = sys.version_info +if major==2 and minor1<=3: + # setuptools monkeypatches distutils.core.Distribution to support + # package_data + try: import setuptools + except ImportError: + raise SystemExit(""" +matplotlib requires setuptools for installation. Please download +http://peak.telecommunity.com/dist/ez_setup.py and run it (as su if +you are doing a system wide install) to install the proper version of +setuptools for your system""") from distutils.core import Extension from distutils.util import convert_path import numpy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-12-16 23:29:03
|
Revision: 4751 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4751&view=rev Author: jswhit Date: 2007-12-16 15:28:59 -0800 (Sun, 16 Dec 2007) Log Message: ----------- remove un-needed file Modified Paths: -------------- trunk/toolkits/basemap/MANIFEST.in Modified: trunk/toolkits/basemap/MANIFEST.in =================================================================== --- trunk/toolkits/basemap/MANIFEST.in 2007-12-16 23:28:33 UTC (rev 4750) +++ trunk/toolkits/basemap/MANIFEST.in 2007-12-16 23:28:59 UTC (rev 4751) @@ -66,7 +66,6 @@ include examples/plotprecip.py include examples/nws_precip_conus_20061222.nc include examples/README -include lib/matplotlib/toolkits/__init__.py include lib/matplotlib/toolkits/basemap/__init__.py include lib/matplotlib/toolkits/basemap/basemap.py include lib/matplotlib/toolkits/basemap/proj.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-12-16 23:28:35
|
Revision: 4750 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4750&view=rev Author: jswhit Date: 2007-12-16 15:28:33 -0800 (Sun, 16 Dec 2007) Log Message: ----------- not needed Removed Paths: ------------- trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py Deleted: trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py 2007-12-16 23:19:59 UTC (rev 4749) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py 2007-12-16 23:28:33 UTC (rev 4750) @@ -1,4 +0,0 @@ -#try: -# __import__('pkg_resources').declare_namespace(__name__) -#except ImportError: -# pass # must not have setuptools This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <as...@us...> - 2007-12-16 23:20:01
|
Revision: 4749 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4749&view=rev Author: astraw Date: 2007-12-16 15:19:59 -0800 (Sun, 16 Dec 2007) Log Message: ----------- fix csv2rec roundtrip for funky strings, too Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/unit/mlab_unit.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 20:53:35 UTC (rev 4748) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 23:19:59 UTC (rev 4749) @@ -2236,11 +2236,15 @@ return repr(x) +class FormatString2(FormatObj): + def tostr(self, x): + val = repr(x) + return val[1:-1] + class FormatString(FormatObj): def tostr(self, x): return '"%r"'%self.toval(x) - class FormatFormatStr(FormatObj): def __init__(self, fmt): self.fmt = fmt @@ -2297,7 +2301,7 @@ npy.float32 : FormatFloat(), npy.float64 : FormatFloat(), npy.object_ : FormatObj(), - npy.string_ : FormatObj(), + npy.string_ : FormatString2(), } def get_formatd(r, formatd=None): Modified: trunk/matplotlib/unit/mlab_unit.py =================================================================== --- trunk/matplotlib/unit/mlab_unit.py 2007-12-16 20:53:35 UTC (rev 4748) +++ trunk/matplotlib/unit/mlab_unit.py 2007-12-16 23:19:59 UTC (rev 4749) @@ -13,25 +13,34 @@ self.failIf( fh.closed ) def test_csv2rec_roundtrip(self): - # Make sure double-precision floats pass through. + # Make sure double-precision floats and strings pass through a + # roundtrip unaltered. + # A bug in numpy (fixed in r4602) meant that numpy scalars # lost precision when passing through repr(). csv2rec was # affected by this. This test will only pass on numpy >= # 1.0.5. - ra=numpy.rec.array([(123, 1197346475.0137341), (456, 123.456)], - dtype=[('a', '<i8'), ('b', '<f8')]) - rec2csv_closes_files = True - if rec2csv_closes_files: - fh = 'mlab_unit_tmp.csv' - else: - fh = StringIO.StringIO() + ra=numpy.rec.array([(123, 1197346475.0137341, 'a,bc'), + (456, 123.456, 'd\'ef'), + (789, 0.000000001, 'ghi'), + ], + dtype=[('a', '<i8'), ('b', '<f8'), ('c', '|S3')]) + fh = StringIO.StringIO() mlab.rec2csv( ra, fh ) - if not rec2csv_closes_files: + fh.seek(0) + if 0: + print 'CSV contents:','-'*40 + print fh.read() + print '-'*40 fh.seek(0) ra2 = mlab.csv2rec(fh) + fh.close() for name in ra.dtype.names: - #print name, repr(ra[name]), repr(ra2[name]) + if 0: + print name, repr(ra[name]), repr(ra2[name]) + dt = ra.dtype[name] + print 'repr(dt.type)',repr(dt.type) self.failUnless( numpy.all(ra[name] == ra2[name]) ) # should not fail with numpy 1.0.5 if __name__=='__main__': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <as...@us...> - 2007-12-16 20:53:40
|
Revision: 4748 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4748&view=rev Author: astraw Date: 2007-12-16 12:53:35 -0800 (Sun, 16 Dec 2007) Log Message: ----------- rec2csv does not close filehandles passed in open Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/cbook.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-12-16 19:28:46 UTC (rev 4747) +++ trunk/matplotlib/CHANGELOG 2007-12-16 20:53:35 UTC (rev 4748) @@ -1,3 +1,6 @@ +2007-12-16 rec2csv saves doubles without losing precision. Also, it + does not close filehandles passed in open. - JDH,ADS + 2007-12-13 Moved rec2gtk to matplotlib.toolkits.gtktools and rec2excel to matplotlib.toolkits.exceltools - JDH Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2007-12-16 19:28:46 UTC (rev 4747) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-12-16 20:53:35 UTC (rev 4748) @@ -224,7 +224,7 @@ except TypeError: return False else: return True -def to_filehandle(fname, flag='r'): +def to_filehandle(fname, flag='r', return_opened=False): """ fname can be a filename or a file handle. Support for gzipped files is automatic, if the filename ends in .gz. flag is a @@ -236,10 +236,14 @@ fh = gzip.open(fname, flag) else: fh = file(fname, flag) + opened = True elif hasattr(fname, 'seek'): fh = fname + opened = False else: raise ValueError('fname must be a string or file handle') + if return_opened: + return fh, opened return fh def flatten(seq, scalarp=is_scalar): Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 19:28:46 UTC (rev 4747) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 20:53:35 UTC (rev 4748) @@ -2335,13 +2335,14 @@ for i, name in enumerate(r.dtype.names): funcs.append(csvformat_factory(formatd[name]).tostr) - fh = cbook.to_filehandle(fname, 'w') + fh, opened = cbook.to_filehandle(fname, 'w', return_opened=True) writer = csv.writer(fh, delimiter=delimiter) header = r.dtype.names writer.writerow(header) for row in r: writer.writerow([func(val) for func, val in zip(funcs, row)]) - fh.close() + if opened: + fh.close() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |