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
|
From: <jd...@us...> - 2007-11-12 20:08:24
|
Revision: 4236 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4236&view=rev Author: jdh2358 Date: 2007-11-12 12:08:11 -0800 (Mon, 12 Nov 2007) Log Message: ----------- removed duplicate load import Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/pylab.py Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-12 19:22:05 UTC (rev 4235) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-12 20:08:11 UTC (rev 4236) @@ -249,7 +249,7 @@ from numpy.random import * from numpy.linalg import * -from matplotlib.mlab import load, window_hanning, window_none, conv, detrend, demean, \ +from matplotlib.mlab import window_hanning, window_none, conv, detrend, demean, \ detrend_mean, detrend_none, detrend_linear, entropy, normpdf, levypdf, \ find, longest_contiguous_ones, longest_ones, prepca, prctile, prctile_rank, \ center_matrix, rk4, bivariate_normal, get_xyz_where, get_sparse_matrix, dist, \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 19:22:09
|
Revision: 4235 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4235&view=rev Author: mdboom Date: 2007-11-12 11:22:05 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [ 1545149 ] Problem rendering image in SVG backend Reading the image file should use binary mode. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-11-12 19:15:28 UTC (rev 4234) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-11-12 19:22:05 UTC (rev 4235) @@ -184,7 +184,7 @@ im.write_png(filename) im.flipud_out() - imfile = file (filename, 'r') + imfile = file (filename, 'rb') image64 = base64.encodestring (imfile.read()) imfile.close() os.remove(filename) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 19:15:31
|
Revision: 4234 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4234&view=rev Author: mdboom Date: 2007-11-12 11:15:28 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [ 1638661 ] Toolbox Save button not saving file in GTK BE with Python2.5 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-11-12 18:54:49 UTC (rev 4233) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-11-12 19:15:28 UTC (rev 4234) @@ -1019,7 +1019,7 @@ def get_filename_from_user (self): while True: filename = None - if self.run() != gtk.RESPONSE_OK: + if self.run() != int(gtk.RESPONSE_OK): break filename = self.get_filename() break @@ -1045,7 +1045,7 @@ self.set_filename(self.path) filename = None - if self.run() == gtk.RESPONSE_OK: + if self.run() == int(gtk.RESPONSE_OK): self.path = filename = self.get_filename() self.hide() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 18:54:54
|
Revision: 4233 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4233&view=rev Author: mdboom Date: 2007-11-12 10:54:49 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [ 1660316 ] PolyInteractor verts call Should be calling get_verts() instead of .verts. (Thanks JPaul Rinehimer) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/patches.py Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2007-11-12 18:53:25 UTC (rev 4232) +++ trunk/matplotlib/lib/matplotlib/patches.py 2007-11-12 18:54:49 UTC (rev 4233) @@ -992,7 +992,7 @@ raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor') canvas = poly.figure.canvas self.poly = poly - self.poly.verts = list(self.poly.verts) + self.poly.verts = list(self.poly.get_verts()) x, y = zip(*self.poly.verts) self.line = lines.Line2D(x,y,marker='o', markerfacecolor='r') #self._update_line(poly) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 18:53:27
|
Revision: 4232 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4232&view=rev Author: mdboom Date: 2007-11-12 10:53:25 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [ 1691298 ] pcolormesh shows empty plot when plotting small time ranges Avoiding downcasting the data before we have to. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-12 18:10:25 UTC (rev 4231) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-12 18:53:25 UTC (rev 4232) @@ -4727,7 +4727,7 @@ X = X.ravel() Y = Y.ravel() - coords = npy.zeros(((Nx * Ny), 2), npy.float32) + coords = npy.zeros(((Nx * Ny), 2), X.dtype) coords[:, 0] = X coords[:, 1] = Y This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 18:10:29
|
Revision: 4231 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4231&view=rev Author: mdboom Date: 2007-11-12 10:10:25 -0800 (Mon, 12 Nov 2007) Log Message: ----------- Provide way to access STIX "letterlike" symbols using LaTeX font commands. Add "stixsans" option to typeset math with sans-serif glyphs. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/_mathtext_data.py trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/rcsetup.py trunk/matplotlib/lib/matplotlib/mathtext.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template Added Paths: ----------- trunk/matplotlib/examples/stix_fonts_demo.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/CHANGELOG 2007-11-12 18:10:25 UTC (rev 4231) @@ -1,3 +1,25 @@ +2007-11-12 Added support for STIX fonts. A new rcParam, + mathtext.fontset, can be used to choose between: + + 'cm': + The TeX/LaTeX Computer Modern fonts + + 'stix': + The STIX fonts (see stixfonts.org) + + 'stixsans': + The STIX fonts, using sans-serif glyphs by default + + 'custom': + A generic Unicode font, in which case the mathtext font + must be specified using mathtext.bf, mathtext.it, + mathtext.sf etc. + + Added a new example, stix_fonts_demo.py to show how to access + different fonts and unusual symbols. + + - MGD + 2007-11-12 Options to disable building backend extension modules moved from setup.py to setup.cfg - DSD Modified: trunk/matplotlib/examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/mathtext_examples.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -49,7 +49,7 @@ r'$\widehat{abc}\widetilde{def}$', r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$', r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$', - #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' + ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' ] from pylab import * @@ -66,7 +66,7 @@ print (i, s) text(0.1, -i, s, fontsize=20) - #savefig('mathtext_example') + savefig('mathtext_examples') #close('all') show() Added: trunk/matplotlib/examples/stix_fonts_demo.py =================================================================== --- trunk/matplotlib/examples/stix_fonts_demo.py (rev 0) +++ trunk/matplotlib/examples/stix_fonts_demo.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import os, sys, re + +import gc + +stests = [ + r'$\mathcircled{123} \mathrm{\mathcircled{123}} \mathbf{\mathcircled{123}}$', + r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}} \mathbf{\mathsf{Sans \Omega}}$', + r'$\mathtt{Monospace}$', + r'$\mathcal{CALLIGRAPHIC}$', + r'$\mathbb{Blackboard \pi}$', + r'$\mathrm{\mathbb{Blackboard \pi}}$', + r'$\mathbf{\mathbb{Blackboard \pi}}$', + r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$', + r'$\mathscr{Script}$', + ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' + ] + +from pylab import * + +def doall(): + tests = stests + + figure(figsize=(8, (len(tests) * 1) + 2)) + plot([0, 0], 'r') + grid(False) + axis([0, 3, -len(tests), 0]) + yticks(arange(len(tests)) * -1) + for i, s in enumerate(tests): + print (i, s) + text(0.1, -i, s, fontsize=32) + + savefig('stix_fonts_example') + #close('all') + show() + +if '--latex' in sys.argv: + fd = open("stix_fonts_examples.ltx", "w") + fd.write("\\documentclass{article}\n") + fd.write("\\begin{document}\n") + fd.write("\\begin{enumerate}\n") + + for i, s in enumerate(stests): + s = re.sub(r"(?<!\\)\$", "$$", s) + fd.write("\\item %s\n" % s) + + fd.write("\\end{enumerate}\n") + fd.write("\\end{document}\n") + fd.close() + + os.system("pdflatex stix_fonts_examples.ltx") +else: + doall() Property changes on: trunk/matplotlib/examples/stix_fonts_demo.py ___________________________________________________________________ Name: svn:executable + * Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py =================================================================== --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -2265,482 +2265,207 @@ 'bigotimes': 10754 } -uni2tex = dict([(v,k) for k,v in tex2uni.items()]) - -tex2type1 = {'doteq': 'uni2250', -'partial': 'uni2202', -'gg': 'uni226B', -'asymp': 'uni224D', -'blacktriangledown': 'uni25BE', -'otimes': 'uni2297', -'nearrow': 'uni2197', -'varpi': 'uni03D6', -'vee': 'uni2228', -'vec': 'uni20D7', -'smile': 'uni2323', -'succnsim': 'uni22E9', -'gimel': 'uni2137', -'vert': 'bar', -'varrho': 'uni03F1', -'P': 'paragraph', -'approxident': 'uni224B', -'Swarrow': 'uni21D9', -'textasciicircum': 'asciicircum', -'imageof': 'uni22B7', -'ntriangleleft': 'uni22EA', -'nleq': 'uni2270', -'div': 'divide', -'nparallel': 'uni2226', -'Leftarrow': 'uni21D0', -'lll': 'uni22D8', -'oiint': 'uni222F', -'ngeq': 'uni2271', -'Theta': 'uni0398', -'origof': 'uni22B6', -'blacksquare': 'uni25A0', -'hspace': 'uni200A', -'solbar': 'uni233F', -'neg': 'logicalnot', -'sum': 'uni2211', -'Vdash': 'uni22A9', -'coloneq': 'uni2254', -'degree': 'degree', -'bowtie': 'uni22C8', -'blacktriangleright': 'uni25B6', -'varsigma': 'uni03C2', -'leq': 'uni2264', -'ggg': 'uni22D9', -'lneqq': 'uni2268', -'scurel': 'uni22B1', -'stareq': 'uni225B', -'BbbN': 'uni2115', -'nLeftarrow': 'uni21CD', -'nLeftrightarrow': 'uni21CE', -'k': 'uni0328', -'bot': 'uni22A5', -'BbbC': 'uni2102', -'Lsh': 'uni21B0', -'leftleftarrows': 'uni21C7', -'BbbZ': 'uni2124', -'digamma': 'uni03DD', -'BbbR': 'uni211D', -'BbbP': 'uni2119', -'BbbQ': 'uni211A', -'vartriangleright': 'uni22B3', -'succsim': 'uni227F', -'wedge': 'uni2227', -'lessgtr': 'uni2276', -'veebar': 'uni22BB', -'mapsdown': 'uni21A7', -'Rsh': 'uni21B1', -'chi': 'uni03C7', -'prec': 'uni227A', -'nsubseteq': 'uni2288', -'therefore': 'uni2234', -'eqcirc': 'uni2256', -'textexclamdown': 'exclamdown', -'nRightarrow': 'uni21CF', -'flat': 'uni266D', -'notin': 'uni2209', -'llcorner': 'uni231E', -'varepsilon': 'uni03B5', -'bigtriangleup': 'uni25B3', -'aleph': 'uni2135', -'dotminus': 'uni2238', -'upsilon': 'uni03C5', -'Lambda': 'uni039B', -'cap': 'uni2229', -'barleftarrow': 'uni21E4', -'mu': 'uni03BC', -'boxplus': 'uni229E', -'mp': 'uni2213', -'circledast': 'uni229B', -'tau': 'uni03C4', -'in': 'uni2208', -'backslash': 'backslash', -'varnothing': 'uni2205', -'sharp': 'uni266F', -'eqsim': 'uni2242', -'gnsim': 'uni22E7', -'Searrow': 'uni21D8', -'updownarrows': 'uni21C5', -'heartsuit': 'uni2661', -'trianglelefteq': 'uni22B4', -'ddag': 'daggerdbl', -'sqsubseteq': 'uni2291', -'mapsfrom': 'uni21A4', -'boxbar': 'uni25EB', -'sim': 'uni223C', -'Nwarrow': 'uni21D6', -'nequiv': 'uni2262', -'succ': 'uni227B', -'vdash': 'uni22A2', -'Leftrightarrow': 'uni21D4', -'parallel': 'uni2225', -'invnot': 'uni2310', -'natural': 'uni266E', -'ss': 'germandbls', -'uparrow': 'uni2191', -'nsim': 'uni2241', -'hookrightarrow': 'uni21AA', -'Equiv': 'uni2263', -'approx': 'uni2248', -'Vvdash': 'uni22AA', -'nsucc': 'uni2281', -'leftrightharpoons': 'uni21CB', -'Re': 'uni211C', -'boxminus': 'uni229F', -'equiv': 'uni2261', -'Lleftarrow': 'uni21DA', -'thinspace': 'uni2009', -'ll': 'uni226A', -'Cup': 'uni22D3', -'measeq': 'uni225E', -'upharpoonleft': 'uni21BF', -'lq': 'quoteleft', -'Upsilon': 'uni03D2', -'subsetneq': 'uni228A', -'greater': 'greater', -'supsetneq': 'uni228B', -'Cap': 'uni22D2', -'L': 'Lslash', -'spadesuit': 'uni2660', -'lrcorner': 'uni231F', -'not': 'uni0338', -'bar': 'uni0304', -'rightharpoonaccent': 'uni20D1', -'boxdot': 'uni22A1', -'l': 'lslash', -'leftharpoondown': 'uni21BD', -'bigcup': 'uni22C3', -'iint': 'uni222C', -'bigwedge': 'uni22C0', -'downharpoonleft': 'uni21C3', -'textasciitilde': 'asciitilde', -'subset': 'uni2282', -'leqq': 'uni2266', -'mapsup': 'uni21A5', -'nvDash': 'uni22AD', -'looparrowleft': 'uni21AB', -'nless': 'uni226E', -'rightarrowbar': 'uni21E5', -'Vert': 'uni2016', -'downdownarrows': 'uni21CA', -'uplus': 'uni228E', -'simeq': 'uni2243', -'napprox': 'uni2249', -'ast': 'uni2217', -'twoheaduparrow': 'uni219F', -'doublebarwedge ?': 'uni2306', -'Sigma': 'uni03A3', -'leftharpoonaccent': 'uni20D0', -'ntrianglelefteq': 'uni22EC', -'nexists': 'uni2204', -'times': 'multiply', -'measuredangle': 'uni2221', -'bumpeq': 'uni224F', -'carriagereturn': 'uni21B5', -'adots': 'uni22F0', -'checkmark': 'uni2713', -'lambda': 'uni03BB', -'xi': 'uni03BE', -'rbrace': 'braceright', -'rbrack': 'bracketright', -'Nearrow': 'uni21D7', -'maltese': 'uni2720', -'clubsuit': 'uni2663', -'top': 'uni22A4', -'overarc': 'uni0311', -'varphi': 'uni03C6', -'Delta': 'uni0394', -'iota': 'uni03B9', -'nleftarrow': 'uni219A', -'candra': 'uni0310', -'supset': 'uni2283', -'triangleleft': 'uni25C1', -'gtreqless': 'uni22DB', -'ntrianglerighteq': 'uni22ED', -'quad': 'uni2003', -'Xi': 'uni039E', -'gtrdot': 'uni22D7', -'leftthreetimes': 'uni22CB', -'minus': 'minus', -'preccurlyeq': 'uni227C', -'nleftrightarrow': 'uni21AE', -'lambdabar': 'uni019B', -'blacktriangle': 'uni25B4', -'kernelcontraction': 'uni223B', -'Phi': 'uni03A6', -'angle': 'uni2220', -'spadesuitopen': 'uni2664', -'eqless': 'uni22DC', -'mid': 'uni2223', -'varkappa': 'uni03F0', -'Ldsh': 'uni21B2', -'updownarrow': 'uni2195', -'beta': 'uni03B2', -'textquotedblleft': 'quotedblleft', -'rho': 'uni03C1', -'alpha': 'uni03B1', -'intercal': 'uni22BA', -'beth': 'uni2136', -'grave': 'uni0300', -'acwopencirclearrow': 'uni21BA', -'nmid': 'uni2224', -'nsupset': 'uni2285', -'sigma': 'uni03C3', -'dot': 'uni0307', -'Rightarrow': 'uni21D2', -'turnednot': 'uni2319', -'backsimeq': 'uni22CD', -'leftarrowtail': 'uni21A2', -'approxeq': 'uni224A', -'curlyeqsucc': 'uni22DF', -'rightarrowtail': 'uni21A3', -'Psi': 'uni03A8', -'copyright': 'copyright', -'yen': 'yen', -'vartriangleleft': 'uni22B2', -'rasp': 'uni02BC', -'triangleright': 'uni25B7', -'precsim': 'uni227E', -'infty': 'uni221E', -'geq': 'uni2265', -'updownarrowbar': 'uni21A8', -'precnsim': 'uni22E8', -'H': 'uni030B', -'ulcorner': 'uni231C', -'looparrowright': 'uni21AC', -'ncong': 'uni2247', -'downarrow': 'uni2193', -'circeq': 'uni2257', -'subseteq': 'uni2286', -'bigstar': 'uni2605', -'prime': 'uni2032', -'lceil': 'uni2308', -'Rrightarrow': 'uni21DB', -'oiiint': 'uni2230', -'curlywedge': 'uni22CF', -'vDash': 'uni22A8', -'lfloor': 'uni230A', -'ddots': 'uni22F1', -'exists': 'uni2203', -'underbar': 'uni0331', -'Pi': 'uni03A0', -'leftrightarrows': 'uni21C6', -'sphericalangle': 'uni2222', -'coprod': 'uni2210', -'circledcirc': 'uni229A', -'gtrsim': 'uni2273', -'gneqq': 'uni2269', -'between': 'uni226C', -'theta': 'uni03B8', -'complement': 'uni2201', -'arceq': 'uni2258', -'nVdash': 'uni22AE', -'S': 'section', -'wr': 'uni2240', -'wp': 'uni2118', -'backcong': 'uni224C', -'lasp': 'uni02BD', -'c': 'uni0327', -'nabla': 'uni2207', -'dotplus': 'uni2214', -'eta': 'uni03B7', -'forall': 'uni2200', -'eth': 'eth', -'colon': 'colon', -'sqcup': 'uni2294', -'rightrightarrows': 'uni21C9', -'sqsupset': 'uni2290', -'mapsto': 'uni21A6', -'bigtriangledown': 'uni25BD', -'sqsupseteq': 'uni2292', -'propto': 'uni221D', -'pi': 'uni03C0', -'pm': 'plusminus', -'dots': 'ellipsis', -'nrightarrow': 'uni219B', -'textasciiacute': 'acute', -'Doteq': 'uni2251', -'breve': 'uni0306', -'sqcap': 'uni2293', -'twoheadrightarrow': 'uni21A0', -'kappa': 'uni03BA', -'vartriangle': 'uni25B5', -'diamondsuit': 'uni2662', -'pitchfork': 'uni22D4', -'blacktriangleleft': 'uni25C0', -'nprec': 'uni2280', -'vdots': 'uni22EE', -'curvearrowright': 'uni21B7', -'barwedge': 'uni22BC', -'multimap': 'uni22B8', -'textquestiondown': 'questiondown', -'cong': 'uni2245', -'rtimes': 'uni22CA', -'rightzigzagarrow': 'uni21DD', -'rightarrow': 'uni2192', -'leftarrow': 'uni2190', -'__sqrt__': 'uni221A', -'twoheaddownarrow': 'uni21A1', -'oint': 'uni222E', -'bigvee': 'uni22C1', -'eqdef': 'uni225D', -'sterling': 'sterling', -'phi': 'uni03D5', -'Updownarrow': 'uni21D5', -'backprime': 'uni2035', -'emdash': 'emdash', -'Gamma': 'uni0393', -'i': 'dotlessi', -'rceil': 'uni2309', -'leftharpoonup': 'uni21BC', -'Im': 'uni2111', -'curvearrowleft': 'uni21B6', -'wedgeq': 'uni2259', -'fallingdotseq': 'uni2252', -'curlyeqprec': 'uni22DE', -'questeq': 'uni225F', -'less': 'less', -'upuparrows': 'uni21C8', -'tilde': 'uni0303', -'textasciigrave': 'grave', -'smallsetminus': 'uni2216', -'ell': 'uni2113', -'cup': 'uni222A', -'danger': 'uni2621', -'nVDash': 'uni22AF', -'cdotp': 'periodcentered', -'cdots': 'uni22EF', -'hat': 'uni0302', -'eqgtr': 'uni22DD', -'enspace': 'uni2002', -'psi': 'uni03C8', -'frown': 'uni2322', -'acute': 'uni0301', -'downzigzagarrow': 'uni21AF', -'ntriangleright': 'uni22EB', -'cupdot': 'uni228D', -'circleddash': 'uni229D', -'oslash': 'uni2298', -'mho': 'uni2127', -'d': 'uni0323', -'sqsubset': 'uni228F', -'cdot': 'uni22C5', -'Omega': 'uni03A9', -'OE': 'OE', -'veeeq': 'uni225A', -'Finv': 'uni2132', -'t': 'uni0361', -'leftrightarrow': 'uni2194', -'swarrow': 'uni2199', -'rightthreetimes': 'uni22CC', -'rightleftharpoons': 'uni21CC', -'lesssim': 'uni2272', -'searrow': 'uni2198', -'because': 'uni2235', -'gtrless': 'uni2277', -'star': 'uni22C6', -'nsubset': 'uni2284', -'zeta': 'uni03B6', -'dddot': 'uni20DB', -'bigcirc': 'uni25CB', -'Supset': 'uni22D1', -'circ': 'uni2218', -'slash': 'uni2215', -'ocirc': 'uni030A', -'prod': 'uni220F', -'twoheadleftarrow': 'uni219E', -'daleth': 'uni2138', -'upharpoonright': 'uni21BE', -'odot': 'uni2299', -'Uparrow': 'uni21D1', -'O': 'Oslash', -'hookleftarrow': 'uni21A9', -'trianglerighteq': 'uni22B5', -'nsime': 'uni2244', -'oe': 'oe', -'nwarrow': 'uni2196', -'o': 'oslash', -'ddddot': 'uni20DC', -'downharpoonright': 'uni21C2', -'succcurlyeq': 'uni227D', -'gamma': 'uni03B3', -'scrR': 'uni211B', -'dag': 'dagger', -'thickspace': 'uni2005', -'frakZ': 'uni2128', -'lessdot': 'uni22D6', -'triangledown': 'uni25BF', -'ltimes': 'uni22C9', -'scrB': 'uni212C', -'endash': 'endash', -'scrE': 'uni2130', -'scrF': 'uni2131', -'scrH': 'uni210B', -'scrI': 'uni2110', -'rightharpoondown': 'uni21C1', -'scrL': 'uni2112', -'scrM': 'uni2133', -'frakC': 'uni212D', -'nsupseteq': 'uni2289', -'circledR': 'registered', -'circledS': 'uni24C8', -'ngtr': 'uni226F', -'bigcap': 'uni22C2', -'scre': 'uni212F', -'Downarrow': 'uni21D3', -'scrg': 'uni210A', -'overleftrightarrow': 'uni20E1', -'scro': 'uni2134', -'lnsim': 'uni22E6', -'eqcolon': 'uni2255', -'curlyvee': 'uni22CE', -'urcorner': 'uni231D', -'lbrace': 'braceleft', -'Bumpeq': 'uni224E', -'delta': 'uni03B4', -'boxtimes': 'uni22A0', -'overleftarrow': 'uni20D6', -'prurel': 'uni22B0', -'clubsuitopen': 'uni2667', -'cwopencirclearrow': 'uni21BB', -'geqq': 'uni2267', -'rightleftarrows': 'uni21C4', -'ac': 'uni223E', -'ae': 'ae', -'int': 'uni222B', -'rfloor': 'uni230B', -'risingdotseq': 'uni2253', -'nvdash': 'uni22AC', -'diamond': 'uni22C4', -'ddot': 'uni0308', -'backsim': 'uni223D', -'oplus': 'uni2295', -'triangleq': 'uni225C', -'check': 'uni030C', -'ni': 'uni220B', -'iiint': 'uni222D', -'ne': 'uni2260', -'lesseqgtr': 'uni22DA', -'obar': 'uni233D', -'supseteq': 'uni2287', -'nu': 'uni03BD', -'AA': 'uni212B', -'AE': 'AE', -'models': 'uni22A7', -'ominus': 'uni2296', -'dashv': 'uni22A3', -'omega': 'uni03C9', -'rq': 'quoteright', -'Subset': 'uni22D0', -'rightharpoonup': 'uni21C0', -'Rdsh': 'uni21B3', -'bullet': 'uni2219', -'divideontimes': 'uni22C7', -'lbrack': 'bracketleft', -'textquotedblright': 'quotedblright', -'Colon': 'uni2237'} - -type12tex = dict([(v,k) for k,v in tex2type1.items()]) +# Each element is a 4-tuple of the form: +# src_start, src_end, dst_font, dst_start +# +stix_virtual_fonts = { + 'bb': + { + 'rm': + [ + (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9 + (0x0041, 0x0042, 'rm', 0x1d538), # A-B + (0x0043, 0x0043, 'rm', 0x2102), # C + (0x0044, 0x0047, 'rm', 0x1d53b), # D-G + (0x0048, 0x0048, 'rm', 0x210d), # H + (0x0049, 0x004d, 'rm', 0x1d540), # I-M + (0x004e, 0x004e, 'rm', 0x2115), # N + (0x004f, 0x004f, 'rm', 0x1d546), # O + (0x0050, 0x0051, 'rm', 0x2119), # P-Q + (0x0052, 0x0052, 'rm', 0x211d), # R + (0x0053, 0x0059, 'rm', 0x1d54a), # S-Y + (0x005a, 0x005a, 'rm', 0x2124), # Z + (0x0061, 0x007a, 'rm', 0x1d552), # a-z + (0x0393, 0x0393, 'rm', 0x213e), # \Gamma + (0x03a0, 0x03a0, 'rm', 0x213f), # \Pi + (0x03a3, 0x03a3, 'rm', 0x2140), # \Sigma + (0x03b3, 0x03b3, 'rm', 0x213d), # \gamma + (0x03c0, 0x03c0, 'rm', 0x213c), # \pi + ], + 'it': + [ + (0x0041, 0x0041, 'it', 0xe154), # A-B + (0x0043, 0x0043, 'it', 0x2102), # C (missing in beta STIX fonts) + (0x0044, 0x0044, 'it', 0x2145), # D + (0x0045, 0x0047, 'it', 0xe156), # E-G + (0x0048, 0x0048, 'it', 0x210d), # H (missing in beta STIX fonts) + (0x0049, 0x004d, 'it', 0xe159), # I-M + (0x004e, 0x004e, 'it', 0x2115), # N (missing in beta STIX fonts) + (0x004f, 0x004f, 'it', 0xe15e), # O + (0x0050, 0x0051, 'it', 0x2119), # P-Q (missing in beta STIX fonts) + (0x0052, 0x0052, 'it', 0x211d), # R (missing in beta STIX fonts) + (0x0053, 0x0059, 'it', 0xe15f), # S-Y + (0x005a, 0x005a, 'it', 0x2124), # Z (missing in beta STIX fonts) + (0x0061, 0x0063, 'it', 0xe166), # a-c + (0x0064, 0x0065, 'it', 0x2146), # d-e + (0x0066, 0x0068, 'it', 0xe169), # f-h + (0x0069, 0x006a, 'it', 0x2148), # i-j + (0x006b, 0x007a, 'it', 0xe16c), # k-z + (0x0393, 0x0393, 'it', 0x213e), # \Gamma (missing in beta STIX fonts) + (0x03a0, 0x03a0, 'it', 0x213f), # \Pi + (0x03a3, 0x03a3, 'it', 0x2140), # \Sigma (missing in beta STIX fonts) + (0x03b3, 0x03b3, 'it', 0x213d), # \gamma (missing in beta STIX fonts) + (0x03c0, 0x03c0, 'it', 0x213c), # \pi + ], + 'bf': + [ + (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9 + (0x0041, 0x005a, 'bf', 0xe38a), # A-Z + (0x0061, 0x007a, 'bf', 0xe39d), # a-z + (0x0393, 0x0393, 'bf', 0x213e), # \Gamma + (0x03a0, 0x03a0, 'bf', 0x213f), # \Pi + (0x03a3, 0x03a3, 'bf', 0x2140), # \Sigma + (0x03b3, 0x03b3, 'bf', 0x213d), # \gamma + (0x03c0, 0x03c0, 'bf', 0x213c), # \pi + ], + }, + 'cal': + [ + (0x0041, 0x005a, 'it', 0xe22d), # A-Z + ], + 'circled': + { + 'rm': + [ + (0x0030, 0x0030, 'rm', 0x24ea), # 0 + (0x0031, 0x0039, 'rm', 0x2460), # 1-9 + (0x0041, 0x005a, 'rm', 0x24b6), # A-Z + (0x0061, 0x007a, 'rm', 0x24d0) # a-z + ], + 'it': + [ + (0x0030, 0x0030, 'it', 0x24ea), # 0 + (0x0031, 0x0039, 'it', 0x2460), # 1-9 + (0x0041, 0x005a, 'it', 0x24b6), # A-Z + (0x0061, 0x007a, 'it', 0x24d0) # a-z + ], + 'bf': + [ + (0x0030, 0x0030, 'bf', 0x24ea), # 0 + (0x0031, 0x0039, 'bf', 0x2460), # 1-9 + (0x0041, 0x005a, 'bf', 0x24b6), # A-Z + (0x0061, 0x007a, 'bf', 0x24d0) # a-z + ], + }, + 'frak': + { + 'rm': + [ + (0x0041, 0x0042, 'rm', 0x1d504), # A-B + (0x0043, 0x0043, 'rm', 0x212d), # C + (0x0044, 0x0047, 'rm', 0x1d507), # D-G + (0x0048, 0x0048, 'rm', 0x210c), # H + (0x0049, 0x0049, 'rm', 0x2111), # I + (0x004a, 0x0051, 'rm', 0x1d50d), # J-Q + (0x0052, 0x0052, 'rm', 0x211c), # R + (0x0053, 0x0059, 'rm', 0x1d516), # S-Y + (0x005a, 0x005a, 'rm', 0x2128), # Z + (0x0061, 0x007a, 'rm', 0x1d51e), # a-z + ], + 'it': + [ + (0x0041, 0x0042, 'rm', 0x1d504), # A-B + (0x0043, 0x0043, 'rm', 0x212d), # C + (0x0044, 0x0047, 'rm', 0x1d507), # D-G + (0x0048, 0x0048, 'rm', 0x210c), # H + (0x0049, 0x0049, 'rm', 0x2111), # I + (0x004a, 0x0051, 'rm', 0x1d50d), # J-Q + (0x0052, 0x0052, 'rm', 0x211c), # R + (0x0053, 0x0059, 'rm', 0x1d516), # S-Y + (0x005a, 0x005a, 'rm', 0x2128), # Z + (0x0061, 0x007a, 'rm', 0x1d51e), # a-z + ], + 'bf': + [ + (0x0041, 0x005a, 'bf', 0x1d56c), # A-Z + (0x0061, 0x007a, 'bf', 0x1d586), # a-z + ], + }, + 'scr': + [ + (0x0041, 0x0041, 'it', 0x1d49c), # A + (0x0042, 0x0042, 'it', 0x212c), # B + (0x0043, 0x0044, 'it', 0x1d49e), # C-D + (0x0045, 0x0046, 'it', 0x2130), # E-F + (0x0047, 0x0047, 'it', 0x1d4a2), # G + (0x0048, 0x0048, 'it', 0x210b), # H + (0x0049, 0x0049, 'it', 0x2110), # I + (0x004a, 0x004b, 'it', 0x1d4a5), # J-K + (0x004c, 0x004c, 'it', 0x2112), # L + (0x004d, 0x003d, 'it', 0x2113), # M + (0x004e, 0x0051, 'it', 0x1d4a9), # N-Q + (0x0052, 0x0052, 'it', 0x211b), # R + (0x0053, 0x005a, 'it', 0x1d4ae), # S-Z + (0x0061, 0x0064, 'it', 0x1d4b6), # a-d + (0x0065, 0x0065, 'it', 0x212f), # e + (0x0066, 0x0066, 'it', 0x1d4bb), # f + (0x0067, 0x0067, 'it', 0x210a), # g + (0x0068, 0x006e, 'it', 0x1d4bd), # h-n + (0x006f, 0x006f, 'it', 0x2134), # o + (0x0070, 0x007a, 'it', 0x1d4c5), # p-z + ], + 'sf': + { + 'rm': + [ + (0x0030, 0x0039, 'rm', 0x1d7e2), # 0-9 + (0x0041, 0x005a, 'rm', 0x1d5a0), # A-Z + (0x0061, 0x007a, 'rm', 0x1d5ba), # a-z + (0x0391, 0x03a9, 'rm', 0xe17d), # \Alpha-\Omega + (0x03b1, 0x03c9, 'rm', 0xe196), # \alpha-\omega + (0x03d1, 0x03d1, 'rm', 0xe1b0), # theta variant + (0x03d5, 0x03d5, 'rm', 0xe1b1), # phi variant + (0x03d6, 0x03d6, 'rm', 0xe1b3), # pi variant + (0x03f1, 0x03f1, 'rm', 0xe1b2), # rho variant + (0x03f5, 0x03f5, 'rm', 0xe1af), # lunate epsilon + (0x2202, 0x2202, 'rm', 0xe17c), # partial differential + ], + 'it': + [ + (0x0030, 0x0039, 'it', 0xe1b4), # 0-9 + (0x0041, 0x005a, 'it', 0x1d608), # A-Z + (0x0061, 0x007a, 'it', 0x1d622), # a-z + (0x0391, 0x03a9, 'it', 0xe1bf), # \Alpha-\Omega + (0x03b1, 0x03c9, 'it', 0xe1d8), # \alpha-\omega + (0x03d1, 0x03d1, 'it', 0xe1f2), # theta variant + (0x03d5, 0x03d5, 'it', 0xe1f3), # phi variant + (0x03d6, 0x03d6, 'it', 0xe1f5), # pi variant + (0x03f1, 0x03f1, 'it', 0xe1f4), # rho variant + (0x03f5, 0x03f5, 'it', 0xe1f1), # lunate epsilon + ], + 'bf': + [ + (0x0030, 0x0039, 'bf', 0x1d7ec), # 0-9 + (0x0041, 0x005a, 'bf', 0x1d5d4), # A-Z + (0x0061, 0x007a, 'bf', 0x1d5ee), # a-z + (0x0391, 0x03a9, 'bf', 0x1d756), # \Alpha-\Omega + (0x03b1, 0x03c9, 'bf', 0x1d770), # \alpha-\omega + (0x03d1, 0x03d1, 'bf', 0x1d78b), # theta variant + (0x03d5, 0x03d5, 'bf', 0x1d78d), # phi variant + (0x03d6, 0x03d6, 'bf', 0x1d78f), # pi variant + (0x03f0, 0x03f0, 'bf', 0x1d78c), # kappa variant + (0x03f1, 0x03f1, 'bf', 0x1d78e), # rho variant + (0x03f5, 0x03f5, 'bf', 0x1d78a), # lunate epsilon + (0x2202, 0x2202, 'bf', 0x1d789), # partial differential + (0x2207, 0x2207, 'bf', 0x1d76f), # \Nabla + ], + }, + 'tt': + [ + (0x0030, 0x0039, 'rm', 0x1d7f6), # 0-9 + (0x0041, 0x005a, 'rm', 0x1d670), # A-Z + (0x0061, 0x007a, 'rm', 0x1d68a) # a-z + ], + } + + Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -166,7 +166,7 @@ it = T.Trait('serif:oblique' , mplT.FontconfigPatternHandler()) bf = T.Trait('serif:bold' , mplT.FontconfigPatternHandler()) sf = T.Trait('sans' , mplT.FontconfigPatternHandler()) - fontset = T.Trait('cm', 'cm', 'stix', 'custom') + fontset = T.Trait('cm', 'cm', 'stix', 'stixsans', 'custom') fallback_to_cm = T.true class axes(TConfig): Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -203,7 +203,7 @@ parse_fontconfig_pattern(s) return s -validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'custom']) +validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'stixsans', 'custom']) validate_verbose = ValidateInStrings('verbose',[ 'silent', 'helpful', 'debug', 'debug-annoying', Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -146,8 +146,7 @@ from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING from matplotlib.font_manager import findfont, FontProperties from matplotlib._mathtext_data import latex_to_bakoma, \ - latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1, \ - latex_to_cmex + latex_to_standard, tex2uni, latex_to_cmex, stix_virtual_fonts from matplotlib import get_data_path, rcParams #################### @@ -184,29 +183,6 @@ raise ValueError, message -#Not used, but might turn useful -def get_type1_name(symbol): - """get_type1_name(symbol) -> string - -Returns the the Type1 name of symbol. -symbol can be a single unicode character, or a TeX command (i.e. r'\pi'). - -""" - try:# This will succeed if symbol is a single unicode char - return uni2type1[ord(symbol)] - except TypeError: - pass - try:# Is symbol a TeX symbol (i.e. \alpha) - return tex2type1[symbol.strip("\\")] - except KeyError: - pass - # The symbol is already a Type1 name so return it - if isinstance(symbol, str): - return symbol - else: - # The user did not suply a valid symbol, show usage - raise ValueError, get_type1_name.__doc__ - class MathtextBackend(object): def __init__(self): self.fonts_object = None @@ -470,7 +446,7 @@ """ return 0. - def get_metrics(self, font, sym, fontsize, dpi): + def get_metrics(self, font, font_class, sym, fontsize, dpi): """ font: one of the TeX font names, tt, it, rm, cal, sf, bf or default (non-math) @@ -485,7 +461,7 @@ iceberg - the distance from the baseline to the top of the glyph. horiBearingY in Truetype parlance, height in TeX parlance """ - info = self._get_info(font, sym, fontsize, dpi) + info = self._get_info(font, font_class, sym, fontsize, dpi) return info.metrics def set_canvas_size(self, w, h, d): @@ -493,8 +469,8 @@ self.width, self.height, self.depth = ceil(w), ceil(h), ceil(d) self.mathtext_backend.set_canvas_size(self.width, self.height, self.depth) - def render_glyph(self, ox, oy, facename, sym, fontsize, dpi): - info = self._get_info(facename, sym, fontsize, dpi) + def render_glyph(self, ox, oy, facename, font_class, sym, fontsize, dpi): + info = self._get_info(facename, font_class, sym, fontsize, dpi) realpath, stat_key = get_realpath_and_stat(info.font.fname) used_characters = self.used_characters.setdefault( stat_key, (realpath, Set())) @@ -568,7 +544,10 @@ cached_font = self.fonts.get(basename) if cached_font is None: - font = FT2Font(basename) + try: + font = FT2Font(basename) + except RuntimeError: + return None cached_font = self.CachedFont(font) self.fonts[basename] = cached_font self.fonts[font.postscript_name] = cached_font @@ -580,15 +559,15 @@ return glyph.height/64.0/2.0 + 256.0/64.0 * dpi/72.0 return 0. - def _get_info (self, fontname, sym, fontsize, dpi, mark_as_used=True): + def _get_info(self, fontname, font_class, sym, fontsize, dpi): 'load the cmfont, metrics and glyph with caching' - key = fontname, sym, fontsize, dpi + key = fontname, font_class, sym, fontsize, dpi bunch = self.glyphd.get(key) if bunch is not None: return bunch cached_font, num, symbol_name, fontsize, slanted = \ - self._get_glyph(fontname, sym, fontsize) + self._get_glyph(fontname, font_class, sym, fontsize) font = cached_font.font font.set_size(fontsize, dpi) @@ -629,7 +608,7 @@ pclt = cached_font.font.get_sfnt_table('pclt') if pclt is None: # Some fonts don't store the xHeight, so we do a poor man's xHeight - metrics = self.get_metrics(font, 'x', fontsize, dpi) + metrics = self.get_metrics(font, 'it', 'x', fontsize, dpi) return metrics.iceberg xHeight = pclt['xHeight'] / 64.0 return xHeight @@ -638,11 +617,11 @@ cached_font = self._get_font(font) return max(1.0, cached_font.font.underline_thickness / 64.0 / fontsize * 10.0) - def get_kern(self, font1, sym1, fontsize1, - font2, sym2, fontsize2, dpi): + def get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi): if font1 == font2 and fontsize1 == fontsize2: - info1 = self._get_info(font1, sym1, fontsize1, dpi) - info2 = self._get_info(font2, sym2, fontsize2, dpi) + info1 = self._get_info(font1, fontclass1, sym1, fontsize1, dpi) + info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi) font = info1.font return font.get_kerning(info1.num, info2.num, KERNING_DEFAULT) / 64.0 return 0.0 @@ -671,7 +650,7 @@ _slanted_symbols = Set(r"\int \oint".split()) - def _get_glyph(self, fontname, sym, fontsize): + def _get_glyph(self, fontname, font_class, sym, fontsize): symbol_name = None if fontname in self.fontmap and latex_to_bakoma.has_key(sym): basename, num = latex_to_bakoma[sym] @@ -682,11 +661,12 @@ elif len(sym) == 1: slanted = (fontname == "it") cached_font = self._get_font(fontname) - num = ord(sym) - gid = cached_font.charmap.get(num) - if gid is not None: - symbol_name = cached_font.font.get_glyph_name( - cached_font.charmap[num]) + if cached_font is not None: + num = ord(sym) + gid = cached_font.charmap.get(num) + if gid is not None: + symbol_name = cached_font.font.get_glyph_name( + cached_font.charmap[num]) if symbol_name is None: warn("Unrecognized symbol '%s'. Substituting with a dummy symbol." @@ -780,8 +760,11 @@ self.fontmap['ex'] = font _slanted_symbols = Set(r"\int \oint".split()) - - def _get_glyph(self, fontname, sym, fontsize): + + def _map_virtual_font(self, fontname, font_class, uniindex): + return fontname, uniindex + + def _get_glyph(self, fontname, font_class, sym, fontsize): found_symbol = False if self.use_cmex: @@ -800,6 +783,9 @@ sym.encode('ascii', 'backslashreplace'), MathTextWarning) + fontname, uniindex = self._map_virtual_font( + fontname, font_class, uniindex) + # Only characters in the "Letter" class should be italicized in 'it' # mode. Greek capital letters should be Roman. if found_symbol: @@ -807,26 +793,29 @@ if fontname == 'it': unistring = unichr(uniindex) - if (not unicodedata.category(unistring).startswith("L") + if (not unicodedata.category(unistring)[0] == "L" or unicodedata.name(unistring).startswith("GREEK CAPITAL")): new_fontname = 'rm' slanted = (new_fontname == 'it') or sym in self._slanted_symbols cached_font = self._get_font(new_fontname) - try: - glyphindex = cached_font.charmap[uniindex] - except KeyError: - warn("Font '%s' does not have a glyph for '%s'" % - (cached_font.font.postscript_name, - sym.encode('ascii', 'backslashreplace')), - MathTextWarning) - found_symbol = False + found_symbol = False + if cached_font is not None: + try: + glyphindex = cached_font.charmap[uniindex] + found_symbol = True + except KeyError: + warn("Font '%s' does not have a glyph for '%s'" % + (cached_font.font.postscript_name, + sym.encode('ascii', 'backslashreplace')), + MathTextWarning) if not found_symbol: if self.cm_fallback: warn("Substituting with a symbol from Computer Modern.", MathTextWarning) - return self.cm_fallback._get_glyph(fontname, sym, fontsize) + return self.cm_fallback._get_glyph( + fontname, 'it', sym, fontsize) else: warn("Substituting with a dummy symbol.", MathTextWarning) fontname = 'rm' @@ -847,10 +836,8 @@ class StixFonts(UnicodeFonts): _fontmap = { 'rm' : 'STIXGeneral', - 'tt' : 'VeraMono', 'it' : 'STIXGeneralItalic', 'bf' : 'STIXGeneralBol', - 'sf' : 'Vera', 'nonunirm' : 'STIXNonUni', 'nonuniit' : 'STIXNonUniIta', 'nonunibf' : 'STIXNonUniBol', @@ -867,6 +854,7 @@ cm_fallback = False def __init__(self, *args, **kwargs): + self._sans = kwargs.pop("sans", False) TruetypeFonts.__init__(self, *args, **kwargs) if not len(self.fontmap): for key, name in self._fontmap.iteritems(): @@ -874,20 +862,47 @@ self.fontmap[key] = fullpath self.fontmap[name] = fullpath - def _get_glyph(self, fontname, sym, fontsize): - # Handle calligraphic letters - if fontname == 'cal': - if len(sym) != 1 or ord(sym) < ord('A') or ord(sym) > ord('Z'): - raise ValueError(r"Sym '%s' is not available in \mathcal font" % sym) - fontname = 'nonuniit' - sym = unichr(ord(sym) + 0xe22d - ord('A')) + def _map_virtual_font(self, fontname, font_class, uniindex): + # Handle these "fonts" that are actually embedded in + # other fonts. + mapping = stix_virtual_fonts.get(fontname) + if self._sans and mapping is None: + mapping = stix_virtual_fonts['sf'] + doing_sans_conversion = True + else: + doing_sans_conversion = False + if mapping is not None: + if isinstance(mapping, dict): + mapping = mapping[font_class] + + # Binary search for the source glyph + lo = 0 + hi = len(mapping) + while lo < hi: + mid = (lo+hi)//2 + range = mapping[mid] + if uniindex < range[0]: + hi = mid + elif uniindex <= range[1]: + break + else: + lo = mid + 1 + + if uniindex >= range[0] and uniindex <= range[1]: + uniindex = uniindex - range[0] + range[3] + fontname = range[2] + elif not doing_sans_conversion: + # This will generate a dummy character + uniindex = 0x1 + fontname = 'it' + # Handle private use area glyphs if (fontname in ('it', 'rm', 'bf') and - len(sym) == 1 and ord(sym) >= 0xe000 and ord(sym) <= 0xf8ff): + uniindex >= 0xe000 and uniindex <= 0xf8ff): fontname = 'nonuni' + fontname - return UnicodeFonts._get_glyph(self, fontname, sym, fontsize) + return fontname, uniindex _size_alternatives = {} def get_sized_alternatives_for_symbol(self, fontname, sym): @@ -955,7 +970,7 @@ self.fonts[cached_font.get_fontname()] = cached_font return cached_font - def _get_info (self, fontname, sym, fontsize, dpi): + def _get_info (self, fontname, font_class, sym, fontsize, dpi): 'load the cmfont, metrics and glyph with caching' key = fontname, sym, fontsize, dpi tup = self.glyphd.get(key) @@ -1033,11 +1048,11 @@ return self.glyphd[key] - def get_kern(self, font1, sym1, fontsize1, - font2, sym2, fontsize2, dpi): + def get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi): if font1 == font2 and fontsize1 == fontsize2: - info1 = self._get_info(font1, sym1, fontsize1, dpi) - info2 = self._get_info(font2, sym2, fontsize2, dpi) + info1 = self._get_info(font1, fontclass1, sym1, fontsize1, dpi) + info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi) font = info1.font return (font.get_kern_dist(info1.glyph, info2.glyph) * 0.001 * fontsize1) @@ -1173,6 +1188,7 @@ self.font_output = state.font_output assert isinstance(state.font, (str, unicode, int)) self.font = state.font + self.font_class = state.font_class self.fontsize = state.fontsize self.dpi = state.dpi # The real width, height and depth will be set during the @@ -1184,7 +1200,7 @@ def _update_metrics(self): metrics = self._metrics = self.font_output.get_metrics( - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) if self.c == ' ': self.width = metrics.advance else: @@ -1203,8 +1219,8 @@ kern = 0. if isinstance(next, Char): kern = self.font_output.get_kern( - self.font, self.c, self.fontsize, - next.font, next.c, next.fontsize, + self.font, self.font_class, self.c, self.fontsize, + next.font, next.font_class, next.c, next.fontsize, self.dpi) return advance + kern @@ -1212,7 +1228,7 @@ """Render the character to the canvas""" self.font_output.render_glyph( x, y, - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) def shrink(self): Node.shrink(self) @@ -1234,7 +1250,7 @@ are already offset correctly from the baseline in TrueType fonts.""" def _update_metrics(self): metrics = self._metrics = self.font_output.get_metrics( - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) self.width = metrics.xmax - metrics.xmin self.height = metrics.ymax - metrics.ymin self.depth = 0 @@ -1251,7 +1267,7 @@ """Render the character to the canvas""" self.font_output.render_glyph( x - self._metrics.xmin, y + self._metrics.ymin, - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) class List(Box): """A list of nodes (either horizontal or vertical). @@ -1936,7 +1952,9 @@ "tanh") fontname = oneOf("rm cal it tt sf bf") - latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf mathdefault") + latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf " + "mathdefault mathbb mathfrak mathcircled " + "mathscr") space =(FollowedBy(bslash) + (Literal(r'\ ') @@ -2093,7 +2111,7 @@ self._em_width_cache = {} def parse(self, s, fonts_object, fontsize, dpi): - self._state_stack = [self.State(fonts_object, 'default', fontsize, dpi)] + self._state_stack = [self.State(fonts_object, 'default', 'rm', fontsize, dpi)] try: self._expression.parseString(s) except ParseException, err: @@ -2108,10 +2126,11 @@ # entering and leaving a group { } or math/non-math, the stack # is pushed and popped accordingly. The current state always # exists in the top element of the stack. - class State: - def __init__(self, font_output, font, fontsize, dpi): + class State(object): + def __init__(self, font_output, font, font_class, fontsize, dpi): self.font_output = font_output - self.font = font + self._font = font + self.font_class = font_class self.fontsize = fontsize self.dpi = dpi @@ -2119,9 +2138,18 @@ return Parser.State( self.font_output, self.font, + self.font_class, self.fontsize, self.dpi) + def _get_font(self): + return self._font + def _set_font(self, name): + if name in ('it', 'rm', 'bf'): + self.font_class = name + self._font = name + font = property(_get_font, _set_font) + def get_state(self): return self._state_stack[-1] @@ -2159,7 +2187,7 @@ width = self._em_width_cache.get(key) if width is None: metrics = state.font_output.get_metrics( - state.font, 'm', state.fontsize, state.dpi) + state.font, 'it', 'm', state.fontsize, state.dpi) width = metrics.advance self._em_width_cache[key] = width return Kern(width * percentage) @@ -2474,7 +2502,7 @@ # Shift so the fraction line sits in the middle of the # equals sign metrics = state.font_output.get_metrics( - state.font, '=', state.fontsize, state.dpi) + state.font, 'it', '=', state.fontsize, state.dpi) shift = (cden.height - ((metrics.ymax + metrics.ymin) / 2 - thickness * 3.0)) @@ -2594,10 +2622,12 @@ font_output = BakomaFonts(prop, backend) elif fontset == 'stix': font_output = StixFonts(prop, backend) + elif fontset == 'stixsans': + font_output = StixFonts(prop, backend, sans=True) elif fontset == 'custom': font_output = UnicodeFonts(prop, backend) else: - raise ValueError("mathtext.fontset must be either 'cm', 'stix', or 'custom'") + raise ValueError("mathtext.fontset must be either 'cm', 'stix', 'stixsans', or 'custom'") fontsize = prop.get_size_in_points() Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -203,7 +203,7 @@ parse_fontconfig_pattern(s) return s -validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'custom']) +validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'stixsans', 'custom']) validate_verbose = ValidateInStrings('verbose',[ 'silent', 'helpful', 'debug', 'debug-annoying', Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/matplotlibrc.template 2007-11-12 18:10:25 UTC (rev 4231) @@ -168,7 +168,8 @@ #mathtext.it : serif:italic #mathtext.bf : serif:bold #mathtext.sf : sans -#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix' or 'custom' +#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix', + # 'stixsans' or 'custom' #mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern # fonts when a symbol can not be found in one of # the custom math fonts. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-12 17:03:33
|
Revision: 4230 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4230&view=rev Author: jswhit Date: 2007-11-12 09:03:28 -0800 (Mon, 12 Nov 2007) Log Message: ----------- updated Requirements Modified Paths: -------------- trunk/toolkits/basemap-testing/README Modified: trunk/toolkits/basemap-testing/README =================================================================== --- trunk/toolkits/basemap-testing/README 2007-11-12 17:00:55 UTC (rev 4229) +++ trunk/toolkits/basemap-testing/README 2007-11-12 17:03:28 UTC (rev 4230) @@ -5,14 +5,18 @@ **Requirements** +python 2.4 or higher. + matplotlib 0.90 (or higher) numpy 1.0 (or higher) -libgoes_c version 2.2.3, available from -http://geos.refractions.net/, and ctypes (which comes with python >= 2.5, -but can be installed separately for python 2.4) +libgoes_c version 2.2.3, available from http://geos.refractions.net/. +ctypes (which comes with python >= 2.5, +but can be installed separately for python 2.4 from +http:/python.org/pypi/ctypes). + **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-11-12 17:00:57
|
Revision: 4229 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4229&view=rev Author: jswhit Date: 2007-11-12 09:00:55 -0800 (Mon, 12 Nov 2007) Log Message: ----------- added Shapely license (since Shapely source code now included). Added Paths: ----------- trunk/toolkits/basemap-testing/LICENSE_shapely Added: trunk/toolkits/basemap-testing/LICENSE_shapely =================================================================== --- trunk/toolkits/basemap-testing/LICENSE_shapely (rev 0) +++ trunk/toolkits/basemap-testing/LICENSE_shapely 2007-11-12 17:00:55 UTC (rev 4229) @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-12 17:00:27
|
Revision: 4228 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4228&view=rev Author: jswhit Date: 2007-11-12 09:00:25 -0800 (Mon, 12 Nov 2007) Log Message: ----------- update licensing info Modified Paths: -------------- trunk/toolkits/basemap-testing/README Modified: trunk/toolkits/basemap-testing/README =================================================================== --- trunk/toolkits/basemap-testing/README 2007-11-12 16:57:45 UTC (rev 4227) +++ trunk/toolkits/basemap-testing/README 2007-11-12 17:00:25 UTC (rev 4228) @@ -21,6 +21,10 @@ pyshapelib by Bernhard Herzog is included in the 'pyshapelib' directory under the terms given in LICENSE_pyshapelib. +The Shapely module (http://trac.gispython.org/projects/PCL/wiki/Shapely) by +Sean Gillies is included in the 'lib/shapely' directory under the terms +given in LICENSE_shapely. + the coastline, lake, river and political boundary data are extracted from datasets provided with the Generic Mapping Tools (http://gmt.soest.hawaii.edu) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-12 16:57:49
|
Revision: 4227 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4227&view=rev Author: jswhit Date: 2007-11-12 08:57:45 -0800 (Mon, 12 Nov 2007) Log Message: ----------- update install instructions Modified Paths: -------------- trunk/toolkits/basemap-testing/README Modified: trunk/toolkits/basemap-testing/README =================================================================== --- trunk/toolkits/basemap-testing/README 2007-11-12 16:54:58 UTC (rev 4226) +++ trunk/toolkits/basemap-testing/README 2007-11-12 16:57:45 UTC (rev 4227) @@ -9,9 +9,7 @@ numpy 1.0 (or higher) -Shapely (http://trac.gispython.org/projects/PCL/wiki/Shapely - svn version) - -Shapely requires libgoes_c version 2.2.3, available from +libgoes_c version 2.2.3, available from http://geos.refractions.net/, and ctypes (which comes with python >= 2.5, but can be installed separately for python 2.4) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-12 16:55:01
|
Revision: 4226 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4226&view=rev Author: jswhit Date: 2007-11-12 08:54:58 -0800 (Mon, 12 Nov 2007) Log Message: ----------- Add Shapely Added Paths: ----------- trunk/toolkits/basemap-testing/lib/shapely/geometry/ trunk/toolkits/basemap-testing/lib/shapely/geometry/__init__.py trunk/toolkits/basemap-testing/lib/shapely/geometry/base.py trunk/toolkits/basemap-testing/lib/shapely/geometry/collection.py trunk/toolkits/basemap-testing/lib/shapely/geometry/geo.py trunk/toolkits/basemap-testing/lib/shapely/geometry/linestring.py trunk/toolkits/basemap-testing/lib/shapely/geometry/multilinestring.py trunk/toolkits/basemap-testing/lib/shapely/geometry/multipoint.py trunk/toolkits/basemap-testing/lib/shapely/geometry/multipolygon.py trunk/toolkits/basemap-testing/lib/shapely/geometry/point.py trunk/toolkits/basemap-testing/lib/shapely/geometry/polygon.py Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/__init__.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/__init__.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/__init__.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,9 @@ +from geo import asShape +from point import Point, asPoint +from linestring import LineString, asLineString +from polygon import Polygon, asPolygon +from multipoint import MultiPoint, asMultiPoint +from multilinestring import MultiLineString, asMultiLineString +from multipolygon import MultiPolygon, asMultiPolygon +from collection import GeometryCollection + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/base.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/base.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/base.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,358 @@ +""" +Base geometry class and utilities. +""" + +from ctypes import string_at, byref, c_int, c_size_t, c_char_p, c_double +import sys + +from shapely.geos import lgeos +from shapely.predicates import BinaryPredicate, UnaryPredicate +from shapely.topology import BinaryTopologicalOp, UnaryTopologicalOp + + +GEOMETRY_TYPES = [ + 'Point', + 'LineString', + 'LinearRing', + 'Polygon', + 'MultiPoint', + 'MultiLineString', + 'MultiPolygon', + 'GeometryCollection' + ] + +def geometry_type_name(g): + return GEOMETRY_TYPES[lgeos.GEOSGeomTypeId(g)] + +# Abstract geometry factory for use with topological methods below + +def geom_factory(g): + if not g: + raise ValueError, "No Shapely geometry can be created from this null value" + ob = BaseGeometry() + geom_type = geometry_type_name(g) + # TODO: check cost of dynamic import by profiling + mod = __import__( + 'shapely.geometry', + globals(), + locals(), + [geom_type], + ) + ob.__class__ = getattr(mod, geom_type) + ob._geom = g + ob._ndim = 2 # callers should be all from 2D worlds + return ob + + +class CoordinateSequence(object): + + _cseq = None + _ndim = None + _length = 0 + index = 0 + + def __init__(self, geom): + self._cseq = lgeos.GEOSGeom_getCoordSeq(geom._geom) + self._ndim = geom._ndim + + def __iter__(self): + self.index = 0 + self._length = self.__len__() + return self + + def next(self): + dx = c_double() + dy = c_double() + dz = c_double() + i = self.index + if i < self._length: + lgeos.GEOSCoordSeq_getX(self._cseq, i, byref(dx)) + lgeos.GEOSCoordSeq_getY(self._cseq, i, byref(dy)) + if self._ndim == 3: # TODO: use hasz + lgeos.GEOSCoordSeq_getZ(self._cseq, i, byref(dz)) + self.index += 1 + return (dx.value, dy.value, dz.value) + else: + self.index += 1 + return (dx.value, dy.value) + else: + raise StopIteration + + def __len__(self): + cs_len = c_int(0) + lgeos.GEOSCoordSeq_getSize(self._cseq, byref(cs_len)) + return cs_len.value + + def __getitem__(self, i): + M = self.__len__() + if i + M < 0 or i >= M: + raise IndexError, "index out of range" + if i < 0: + ii = M + i + else: + ii = i + dx = c_double() + dy = c_double() + dz = c_double() + lgeos.GEOSCoordSeq_getX(self._cseq, ii, byref(dx)) + lgeos.GEOSCoordSeq_getY(self._cseq, ii, byref(dy)) + if self._ndim == 3: # TODO: use hasz + lgeos.GEOSCoordSeq_getZ(self._cseq, ii, byref(dz)) + return (dx.value, dy.value, dz.value) + else: + return (dx.value, dy.value) + + +class GeometrySequence(object): + + _factory = None + _geom = None + _ndim = None + _index = 0 + _length = 0 + + def __init__(self, geom, type): + self._factory = type + self._geom = geom._geom + self._ndim = geom._ndim + + def __iter__(self): + self._index = 0 + self._length = self.__len__() + return self + + def next(self): + if self._index < self.__len__(): + g = self._factory() + g._owned = True + g._geom = lgeos.GEOSGetGeometryN(self._geom, self._index) + self._index += 1 + return g + else: + raise StopIteration + + def __len__(self): + return lgeos.GEOSGetNumGeometries(self._geom) + + def __getitem__(self, i): + M = self.__len__() + if i + M < 0 or i >= M: + raise IndexError, "index out of range" + if i < 0: + ii = M + i + else: + ii = i + g = self._factory() + g._owned = True + g._geom = lgeos.GEOSGetGeometryN(self._geom, ii) + return g + + @property + def _longest(self): + max = 0 + for g in iter(self): + l = len(g.coords) + if l > max: + max = l + + +class BaseGeometry(object): + + """Provides GEOS spatial predicates and topological operations. + """ + + _geom = None + _ctypes_data = None + _ndim = None + _crs = None + _owned = False + + def __init__(self): + self._geom = lgeos.GEOSGeomFromWKT(c_char_p('GEOMETRYCOLLECTION EMPTY')) + + def __del__(self): + if self._geom is not None and not self._owned: + lgeos.GEOSGeom_destroy(self._geom) + + def __str__(self): + return self.to_wkt() + + def __eq__(self, other): + return self.equals(other) + + def __ne__(self, other): + return not self.equals(other) + + # To support pickling + + def __reduce__(self): + return (self.__class__, (), self.to_wkb()) + + def __setstate__(self, state): + self._geom = lgeos.GEOSGeomFromWKB_buf( + c_char_p(state), + c_size_t(len(state)) + ) + + # Array and ctypes interfaces + + @property + def ctypes(self): + """Return a ctypes representation. + + To be overridden by extension classes.""" + raise NotImplementedError + + @property + def array_interface_base(self): + if sys.byteorder == 'little': + typestr = '<f8' + elif sys.byteorder == 'big': + typestr = '>f8' + else: + raise ValueError, "Unsupported byteorder: neither little nor big-endian" + return { + 'version': 3, + 'typestr': typestr, + 'data': self.ctypes, + } + + @property + def __array_interface__(self): + """Provide the Numpy array protocol.""" + raise NotImplementedError + + def get_coords(self): + return CoordinateSequence(self) + + def set_coords(self, ob): + raise NotImplementedError, \ + "set_coords must be provided by derived classes" + + coords = property(get_coords, set_coords) + + # Python feature protocol + + @property + def __geo_interface__(self): + raise NotImplementedError + + @property + def type(self): + return self.geometryType() + + # Type of geometry and its representations + + def geometryType(self): + """Returns a string representing the geometry type, e.g. 'Polygon'.""" + return geometry_type_name(self._geom) + + def to_wkb(self): + """Returns a WKB byte string representation of the geometry.""" + size = c_int() + bytes = lgeos.GEOSGeomToWKB_buf(self._geom, byref(size)) + return string_at(bytes, size.value) + + def to_wkt(self): + """Returns a WKT string representation of the geometry.""" + return string_at(lgeos.GEOSGeomToWKT(self._geom)) + + geom_type = property(geometryType) + wkt = property(to_wkt) + wkb = property(to_wkb) + + # Basic geometry properties + + @property + def area(self): + a = c_double() + retval = lgeos.GEOSArea(self._geom, byref(a)) + return a.value + + @property + def length(self): + len = c_double() + retval = lgeos.GEOSLength(self._geom, byref(len)) + return len.value + + def distance(self, other): + d = c_double() + retval = lgeos.GEOSDistance(self._geom, other._geom, byref(d)) + return d.value + + # Topology operations + # + # These use descriptors to reduce the amount of boilerplate. + + envelope = UnaryTopologicalOp(lgeos.GEOSEnvelope, geom_factory) + intersection = BinaryTopologicalOp(lgeos.GEOSIntersection, geom_factory) + convex_hull = UnaryTopologicalOp(lgeos.GEOSConvexHull, geom_factory) + difference = BinaryTopologicalOp(lgeos.GEOSDifference, geom_factory) + symmetric_difference = BinaryTopologicalOp(lgeos.GEOSSymDifference, + geom_factory) + boundary = UnaryTopologicalOp(lgeos.GEOSBoundary, geom_factory) + union = BinaryTopologicalOp(lgeos.GEOSUnion, geom_factory) + centroid = UnaryTopologicalOp(lgeos.GEOSGetCentroid, geom_factory) + + # Buffer has a unique distance argument, so not a descriptor + def buffer(self, distance, quadsegs=16): + return geom_factory( + lgeos.GEOSBuffer(self._geom, c_double(distance), c_int(quadsegs)) + ) + + # Relate has a unique string return value + def relate(self, other): + func = lgeos.GEOSRelate + func.restype = c_char_p + return lgeos.GEOSRelate(self._geom, other._geom) + + # Binary predicates + # + # These use descriptors to reduce the amount of boilerplate. + + # TODO: Relate Pattern? + disjoint = BinaryPredicate(lgeos.GEOSDisjoint) + touches = BinaryPredicate(lgeos.GEOSTouches) + intersects = BinaryPredicate(lgeos.GEOSIntersects) + crosses = BinaryPredicate(lgeos.GEOSCrosses) + within = BinaryPredicate(lgeos.GEOSWithin) + contains = BinaryPredicate(lgeos.GEOSContains) + overlaps = BinaryPredicate(lgeos.GEOSOverlaps) + equals = BinaryPredicate(lgeos.GEOSEquals) + + # Unary predicates + # + # These use descriptors to reduce the amount of boilerplate. + + is_empty = UnaryPredicate(lgeos.GEOSisEmpty) + is_valid = UnaryPredicate(lgeos.GEOSisValid) + is_simple = UnaryPredicate(lgeos.GEOSisSimple) + is_ring = UnaryPredicate(lgeos.GEOSisRing) + has_z = UnaryPredicate(lgeos.GEOSHasZ) + + @property + def bounds(self): + env = self.envelope + if env.geom_type != 'Polygon': + raise ValueError, env.wkt + cs = lgeos.GEOSGeom_getCoordSeq(env.exterior._geom) + cs_len = c_int(0) + lgeos.GEOSCoordSeq_getSize(cs, byref(cs_len)) + + minx = 1.e+20 + maxx = -1e+20 + miny = 1.e+20 + maxy = -1e+20 + temp = c_double() + for i in xrange(cs_len.value): + lgeos.GEOSCoordSeq_getX(cs, i, byref(temp)) + x = temp.value + if x < minx: minx = x + if x > maxx: maxx = x + lgeos.GEOSCoordSeq_getY(cs, i, byref(temp)) + y = temp.value + if y < miny: miny = y + if y > maxy: maxy = y + + return (minx, miny, maxx, maxy) + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/collection.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/collection.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/collection.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,24 @@ +""" +Geometry collections. +""" + +from shapely.geometry.base import BaseGeometry + +class GeometryCollection(BaseGeometry): + + """A geometry collection. + """ + + def __init__(self): + BaseGeometry.__init__(self) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + + +if __name__ == "__main__": + _test() + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/geo.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/geo.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/geo.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,35 @@ + +from point import PointAdapter +from linestring import LineStringAdapter +from polygon import PolygonAdapter +from multipoint import MultiPointAdapter +from multilinestring import MultiLineStringAdapter +from multipolygon import MultiPolygonAdapter + + +def asShape(context): + """Adapts the context to a geometry interface. The coordinates remain + stored in the context. + """ + if hasattr(context, "__geo_interface__"): + ob = context.__geo_interface__ + else: + ob = context + + geom_type = ob.get("type").lower() + + if geom_type == "point": + return PointAdapter(ob["coordinates"]) + elif geom_type == "linestring": + return LineStringAdapter(ob["coordinates"]) + elif geom_type == "polygon": + return PolygonAdapter(ob["coordinates"][0], ob["coordinates"][1:]) + elif geom_type == "multipoint": + return MultiPointAdapter(ob["coordinates"]) + elif geom_type == "multilinestring": + return MultiLineStringAdapter(ob["coordinates"]) + elif geom_type == "multipolygon": + return MultiPolygonAdapter(ob["coordinates"]) + else: + raise ValueError, "Unknown geometry type: %s" % geom_type + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/linestring.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/linestring.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/linestring.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,228 @@ +""" +Line strings. +""" + +from ctypes import byref, c_double, c_int, cast, POINTER, pointer +from ctypes import ArgumentError + +from shapely.geos import lgeos +from shapely.geometry.base import BaseGeometry + + +def geos_linestring_from_py(ob, update_geom=None, update_ndim=0): + try: + # From array protocol + array = ob.__array_interface__ + assert len(array['shape']) == 2 + m = array['shape'][0] + n = array['shape'][1] + assert m >= 2 + assert n == 2 or n == 3 + + # Make pointer to the coordinate array + try: + cp = cast(array['data'][0], POINTER(c_double)) + except ArgumentError: + cp = array['data'] + + # Create a coordinate sequence + if update_geom is not None: + cs = lgeos.GEOSGeom_getCoordSeq(update_geom) + if n != update_ndim: + raise ValueError, \ + "Wrong coordinate dimensions; this geometry has dimensions: %d" \ + % update_ndim + else: + cs = lgeos.GEOSCoordSeq_create(m, n) + + # add to coordinate sequence + for i in xrange(m): + dx = c_double(cp[n*i]) + dy = c_double(cp[n*i+1]) + dz = None + if n == 3: + dz = c_double(cp[n*i+2]) + + # Because of a bug in the GEOS C API, + # always set X before Y + lgeos.GEOSCoordSeq_setX(cs, i, dx) + lgeos.GEOSCoordSeq_setY(cs, i, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, i, dz) + + except AttributeError: + # Fall back on list + m = len(ob) + n = len(ob[0]) + assert m >= 2 + assert n == 2 or n == 3 + + # Create a coordinate sequence + if update_geom is not None: + cs = lgeos.GEOSGeom_getCoordSeq(update_geom) + if n != update_ndim: + raise ValueError, \ + "Wrong coordinate dimensions; this geometry has dimensions: %d" \ + % update_ndim + else: + cs = lgeos.GEOSCoordSeq_create(m, n) + + # add to coordinate sequence + for i in xrange(m): + coords = ob[i] + dx = c_double(coords[0]) + dy = c_double(coords[1]) + dz = None + if n == 3: + dz = c_double(coords[2]) + + # Because of a bug in the GEOS C API, + # always set X before Y + lgeos.GEOSCoordSeq_setX(cs, i, dx) + lgeos.GEOSCoordSeq_setY(cs, i, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, i, dz) + + if update_geom is not None: + return None + else: + return (lgeos.GEOSGeom_createLineString(cs), n) + +def update_linestring_from_py(geom, ob): + geos_linestring_from_py(ob, geom._geom, geom._ndim) + + +class LineString(BaseGeometry): + + """A line string, also known as a polyline. + + """ + + def __init__(self, coordinates=None): + """Initialize. + + Parameters + ---------- + + coordinates : sequence or array + This may be an object that satisfies the numpy array protocol, + providing an M x 2 or M x 3 (with z) array, or it may be a sequence + of x, y (,z) coordinate sequences. + + Example + ------- + + >>> line = LineString([[0.0, 0.0], [1.0, 2.0]]) + >>> line = LineString(array([[0.0, 0.0], [1.0, 2.0]])) + + Each result in a line string from (0.0, 0.0) to (1.0, 2.0). + """ + BaseGeometry.__init__(self) + + if coordinates is None: + # allow creation of null lines, to support unpickling + pass + else: + self._geom, self._ndim = geos_linestring_from_py(coordinates) + + @property + def __geo_interface__(self): + return { + 'type': 'LineString', + 'coordinates': tuple(self.coords) + } + + @property + def ctypes(self): + if not self._ctypes_data: + cs = lgeos.GEOSGeom_getCoordSeq(self._geom) + cs_len = c_int(0) + lgeos.GEOSCoordSeq_getSize(cs, byref(cs_len)) + temp = c_double() + n = self._ndim + m = cs_len.value + array_type = c_double * (m * n) + data = array_type() + for i in xrange(m): + lgeos.GEOSCoordSeq_getX(cs, i, byref(temp)) + data[n*i] = temp.value + lgeos.GEOSCoordSeq_getY(cs, i, byref(temp)) + data[n*i+1] = temp.value + if n == 3: # TODO: use hasz + lgeos.GEOSCoordSeq_getZ(cs, i, byref(temp)) + data[n*i+2] = temp.value + self._ctypes_data = data + return self._ctypes_data + + def array_interface(self): + """Provide the Numpy array protocol.""" + ai = self.array_interface_base + ai.update({'shape': (len(self.coords), self._ndim)}) + return ai + __array_interface__ = property(array_interface) + + # Coordinate access + + def set_coords(self, coordinates): + update_linestring_from_py(self, coordinates) + + coords = property(BaseGeometry.get_coords, set_coords) + + +class LineStringAdapter(LineString): + + """Adapts a Python coordinate pair or a numpy array to the line string + interface. + """ + + context = None + + def __init__(self, context): + self.context = context + + # Override base class __del__ + def __del__(self): + pass + + @property + def _ndim(self): + try: + # From array protocol + array = self.context.__array_interface__ + n = array['shape'][1] + assert n == 2 or n == 3 + return n + except AttributeError: + # Fall back on list + return len(self.context[0]) + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_linestring_from_py(self.context)[0] + + @property + def __array_interface__(self): + """Provide the Numpy array protocol.""" + try: + return self.context.__array_interface__ + except AttributeError: + return self.array_interface() + + coords = property(BaseGeometry.get_coords) + + +def asLineString(context): + """Factory for PointAdapter instances.""" + return LineStringAdapter(context) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + + +if __name__ == "__main__": + _test() + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/multilinestring.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/multilinestring.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/multilinestring.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,155 @@ +""" +Multi-part collection of linestrings. +""" + +from ctypes import byref, c_double, c_int, c_void_p, cast, POINTER, pointer + +from shapely.geos import lgeos +from shapely.geometry.base import BaseGeometry, GeometrySequence +from shapely.geometry.linestring import LineString, geos_linestring_from_py + + +def geos_multilinestring_from_py(ob): + """ob must be either a sequence or array of sequences or arrays.""" + try: + # From array protocol + array = ob.__array_interface__ + assert len(array['shape']) == 1 + L = array['shape'][0] + assert L >= 1 + + # Make pointer to the coordinate array + cp = cast(array['data'][0], POINTER(c_double)) + + # Array of pointers to sub-geometries + subs = (c_void_p * L)() + + for l in xrange(L): + geom, ndims = geos_linestring_from_py(array['data'][l]) + subs[i] = cast(geom, c_void_p) + N = lgeos.GEOSGeom_getDimensions(subs[0]) + + except AttributeError: + # Fall back on list + L = len(ob) + N = len(ob[0][0]) + assert L >= 1 + assert N == 2 or N == 3 + + # Array of pointers to point geometries + subs = (c_void_p * L)() + + # add to coordinate sequence + for l in xrange(L): + geom, ndims = geos_linestring_from_py(ob[l]) + subs[l] = cast(geom, c_void_p) + + return (lgeos.GEOSGeom_createCollection(5, subs, L), N) + + +class MultiLineString(BaseGeometry): + + """a multiple linestring geometry. + """ + + def __init__(self, coordinates=None): + """Initialize. + + Parameters + ---------- + + coordinates : sequence + Contains coordinate sequences or objects that provide the numpy + array protocol, providing an M x 2 or M x 3 (with z) array. + + Example + ------- + + >>> geom = MultiLineString( [[[0.0, 0.0], [1.0, 2.0]]] ) + >>> geom = MultiLineString( [ array([[0.0, 0.0], [1.0, 2.0]]) ] ) + + Each result in a collection containing one line string. + """ + BaseGeometry.__init__(self) + + if coordinates is None: + # allow creation of null lines, to support unpickling + pass + else: + self._geom, self._ndim = geos_multilinestring_from_py(coordinates) + + @property + def __geo_interface__(self): + return { + 'type': 'MultiLineString', + 'coordinates': tuple(tuple(c for c in g.coords) for g in self.geoms) + } + + @property + def ctypes(self): + raise NotImplementedError, \ + "Multi-part geometries have no ctypes representations" + + @property + def __array_interface__(self): + """Provide the Numpy array protocol.""" + raise NotImplementedError, \ + "Multi-part geometries do not themselves provide the array interface" + + @property + def coords(self): + raise NotImplementedError, \ + "Multi-part geometries do not provide a coordinate sequence" + + @property + def geoms(self): + return GeometrySequence(self, LineString) + + +class MultiLineStringAdapter(MultiLineString): + + """Adapts sequences of sequences or numpy arrays to the multilinestring + interface. + """ + + context = None + + def __init__(self, context): + self.context = context + + # Override base class __del__ + def __del__(self): + pass + + @property + def _ndim(self): + try: + # From array protocol + array = self.context[0].__array_interface__ + n = array['shape'][1] + assert n == 2 or n == 3 + return n + except AttributeError: + # Fall back on list + return len(self.context[0][0]) + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_multilinestring_from_py(self.context)[0] + + +def asMultiLineString(context): + """Factory for MultiLineStringAdapter instances.""" + return MultiLineStringAdapter(context) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + + +if __name__ == "__main__": + _test() + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/multipoint.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/multipoint.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/multipoint.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,182 @@ +""" +Multiple points. +""" + +from ctypes import byref, c_double, c_int, c_void_p, cast, POINTER, pointer + +from shapely.geos import lgeos +from shapely.geometry.base import BaseGeometry, GeometrySequence +from shapely.geometry.point import Point, geos_point_from_py + + +def geos_multipoint_from_py(ob): + try: + # From array protocol + array = ob.__array_interface__ + assert len(array['shape']) == 2 + m = array['shape'][0] + n = array['shape'][1] + assert m >= 1 + assert n == 2 or n == 3 + + # Make pointer to the coordinate array + cp = cast(array['data'][0], POINTER(c_double)) + + # Array of pointers to sub-geometries + subs = (c_void_p * m)() + + for i in xrange(m): + geom, ndims = geos_point_from_py(cp[n*i:n*i+2]) + subs[i] = cast(geom, c_void_p) + + except AttributeError: + # Fall back on list + m = len(ob) + n = len(ob[0]) + assert n == 2 or n == 3 + + # Array of pointers to point geometries + subs = (c_void_p * m)() + + # add to coordinate sequence + for i in xrange(m): + coords = ob[i] + geom, ndims = geos_point_from_py(coords) + subs[i] = cast(geom, c_void_p) + + return (lgeos.GEOSGeom_createCollection(4, subs, m), n) + + +class MultiPoint(BaseGeometry): + + """A multiple point geometry. + """ + + def __init__(self, coordinates=None): + """Initialize. + + Parameters + ---------- + + coordinates : sequence or array + This may be an object that satisfies the numpy array protocol, + providing an M x 2 or M x 3 (with z) array, or it may be a sequence + of x, y (,z) coordinate sequences. + + Example + ------- + + >>> geom = MultiPoint([[0.0, 0.0], [1.0, 2.0]]) + >>> geom = MultiPoint(array([[0.0, 0.0], [1.0, 2.0]])) + + Each result in a line string from (0.0, 0.0) to (1.0, 2.0). + """ + BaseGeometry.__init__(self) + + if coordinates is None: + # allow creation of null lines, to support unpickling + pass + else: + self._geom, self._ndim = geos_multipoint_from_py(coordinates) + + + @property + def __geo_interface__(self): + return { + 'type': 'MultiPoint', + 'coordinates': tuple([g.coords[0] for g in self.geoms]) + } + + @property + def ctypes(self): + if not self._ctypes_data: + temp = c_double() + n = self._ndim + m = len(self.geoms) + array_type = c_double * (m * n) + data = array_type() + for i in xrange(m): + g = self.geoms[i]._geom + cs = lgeos.GEOSGeom_getCoordSeq(g) + lgeos.GEOSCoordSeq_getX(cs, 0, byref(temp)) + data[n*i] = temp.value + lgeos.GEOSCoordSeq_getY(cs, 0, byref(temp)) + data[n*i+1] = temp.value + if n == 3: # TODO: use hasz + lgeos.GEOSCoordSeq_getZ(cs, 0, byref(temp)) + data[n*i+2] = temp.value + self._ctypes_data = data + return self._ctypes_data + + def array_interface(self): + """Provide the Numpy array protocol.""" + ai = self.array_interface_base + ai.update({'shape': (len(self.geoms), self._ndim)}) + return ai + __array_interface__ = property(array_interface) + + @property + def coords(self): + raise NotImplementedError, \ + "Multipart geometries do not themselves provide coordinate sequences" + + @property + def geoms(self): + return GeometrySequence(self, Point) + + +class MultiPointAdapter(MultiPoint): + + """Adapts a Python coordinate pair or a numpy array to the multipoint + interface. + """ + + context = None + + def __init__(self, context): + self.context = context + + # Override base class __del__ + def __del__(self): + pass + + @property + def _ndim(self): + try: + # From array protocol + array = self.context.__array_interface__ + n = array['shape'][1] + assert n == 2 or n == 3 + return n + except AttributeError: + # Fall back on list + return len(self.context[0]) + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_multipoint_from_py(self.context)[0] + + @property + def __array_interface__(self): + """Provide the Numpy array protocol.""" + try: + return self.context.__array_interface__ + except AttributeError: + return self.array_interface() + + +def asMultiPoint(context): + """Factory for MultiPointAdapter instances.""" + return MultiPointAdapter(context) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + + +if __name__ == "__main__": + _test() + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/multipolygon.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/multipolygon.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/multipolygon.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,141 @@ +""" +Multi-part collection of polygons. +""" + +from ctypes import byref, c_double, c_int, c_void_p, cast, POINTER, pointer + +from shapely.geos import lgeos +from shapely.geometry.base import BaseGeometry, GeometrySequence +from shapely.geometry.polygon import Polygon, geos_polygon_from_py + + +def geos_multipolygon_from_py(ob): + """ob must be either a sequence or array of sequences or arrays.""" + L = len(ob) + N = len(ob[0][0][0]) + assert L >= 1 + assert N == 2 or N == 3 + + subs = (c_void_p * L)() + for l in xrange(L): + geom, ndims = geos_polygon_from_py(ob[l][0], ob[l][1]) + subs[l] = cast(geom, c_void_p) + + return (lgeos.GEOSGeom_createCollection(6, subs, L), N) + + +class MultiPolygon(BaseGeometry): + + """a multiple polygon geometry. + """ + + def __init__(self, polygons=None): + """Initialize. + + Parameters + ---------- + + polygons : sequence + A sequence of (shell, holes) tuples where shell is the sequence + representation of a linear ring (see linearring.py) and holes is + a sequence of such linear rings. + + Example + ------- + >>> geom = MultiPolygon( [ + ... ( + ... ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + ... [((0.1,0.1), (0.1,0.2), (0.2,0.2), (0.2,0.1))] + ... ) + ... ] ) + """ + BaseGeometry.__init__(self) + + if polygons is None: + # allow creation of null collections, to support unpickling + pass + else: + self._geom, self._ndim = geos_multipolygon_from_py(polygons) + + @property + def __geo_interface__(self): + allcoords = [] + for geom in self.geoms: + coords = [] + coords.append(tuple(geom.exterior.coords)) + for hole in geom.interiors: + coords.append(tuple(hole.coords)) + allcoords.append(coords) + return { + 'type': 'MultiPolygon', + 'coordinates': allcoords + } + + @property + def ctypes(self): + raise NotImplementedError, \ + "Multi-part geometries have no ctypes representations" + + @property + def __array_interface__(self): + """Provide the Numpy array protocol.""" + raise NotImplementedError, \ + "Multi-part geometries do not themselves provide the array interface" + + @property + def coords(self): + raise NotImplementedError, \ + "Multi-part geometries do not provide a coordinate sequence" + + @property + def geoms(self): + return GeometrySequence(self, Polygon) + + +class MultiPolygonAdapter(MultiPolygon): + + """Adapts sequences of sequences or numpy arrays to the multipolygon + interface. + """ + + context = None + + def __init__(self, context): + self.context = context + + # Override base class __del__ + def __del__(self): + pass + + @property + def _ndim(self): + try: + # From array protocol + array = self.context[0][0].__array_interface__ + n = array['shape'][1] + assert n == 2 or n == 3 + return n + except AttributeError: + # Fall back on list + return len(self.context[0][0][0]) + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_multipolygon_from_py(self.context)[0] + + +def asMultiPolygon(context): + """Factory for MultiLineStringAdapter instances.""" + return MultiPolygonAdapter(context) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + + +if __name__ == "__main__": + _test() + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/point.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/point.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/point.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,242 @@ +""" +Points. +""" + +from ctypes import string_at, create_string_buffer, \ + c_char_p, c_double, c_float, c_int, c_uint, c_size_t, c_ubyte, \ + c_void_p, byref +from ctypes import cast, POINTER + +from shapely.geos import lgeos, DimensionError +from shapely.geometry.base import BaseGeometry, CoordinateSequence + + +def geos_point_from_py(ob, update_geom=None, update_ndim=0): + """Create a GEOS geom from an object that is a coordinate sequence + or that provides the array interface. + + Returns the GEOS geometry and the number of its dimensions. + """ + try: + # From array protocol + array = ob.__array_interface__ + assert len(array['shape']) == 1 + n = array['shape'][0] + assert n == 2 or n == 3 + + cdata = array['data'][0] + cp = cast(cdata, POINTER(c_double)) + dx = c_double(cp[0]) + dy = c_double(cp[1]) + dz = None + if n == 3: + dz = c_double(cp[2]) + ndim = 3 + except AttributeError: + # Fall back on list + coords = ob + n = len(coords) + dx = c_double(coords[0]) + dy = c_double(coords[1]) + dz = None + if n == 3: + dz = c_double(coords[2]) + + if update_geom: + cs = lgeos.GEOSGeom_getCoordSeq(update_geom) + if n != update_ndim: + raise ValueError, \ + "Wrong coordinate dimensions; this geometry has dimensions: %d" \ + % update_ndim + else: + cs = lgeos.GEOSCoordSeq_create(1, n) + + # Because of a bug in the GEOS C API, always set X before Y + lgeos.GEOSCoordSeq_setX(cs, 0, dx) + lgeos.GEOSCoordSeq_setY(cs, 0, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, 0, dz) + + if update_geom: + return None + else: + return (lgeos.GEOSGeom_createPoint(cs), n) + +def update_point_from_py(geom, ob): + geos_point_from_py(ob, geom._geom, geom._ndim) + + +class Point(BaseGeometry): + + """A point geometry. + + Attributes + ---------- + x, y, z : float + Coordinate values + + Example + ------- + >>> p = Point(1.0, -1.0) + >>> str(p) + 'POINT (1.0000000000000000 -1.0000000000000000)' + >>> p.y = 0.0 + >>> p.y + 0.0 + >>> p.x + 1.0 + >>> p.array + [[1.0, 0.0]] + """ + + def __init__(self, *args): + """This *copies* the given data to a new GEOS geometry. + + Parameters + ---------- + + There are 2 cases: + + 1) 1 parameter: this must satisfy the numpy array protocol. + 2) 2 or more parameters: x, y, z : float + Easting, northing, and elevation. + """ + BaseGeometry.__init__(self) + + if len(args) == 0: + # allow creation of null points, to support unpickling + pass + else: + if len(args) == 1: + self._geom, self._ndim = geos_point_from_py(args[0]) + else: + self._geom, self._ndim = geos_point_from_py(tuple(args)) + + # Coordinate getters and setters + + @property + def x(self): + """Return x coordinate.""" + cs = lgeos.GEOSGeom_getCoordSeq(self._geom) + d = c_double() + lgeos.GEOSCoordSeq_getX(cs, 0, byref(d)) + return d.value + + @property + def y(self): + """Return y coordinate.""" + cs = lgeos.GEOSGeom_getCoordSeq(self._geom) + d = c_double() + lgeos.GEOSCoordSeq_getY(cs, 0, byref(d)) + return d.value + + @property + def z(self): + """Return z coordinate.""" + if self._ndim != 3: + raise DimensionError, "This point has no z coordinate." + cs = lgeos.GEOSGeom_getCoordSeq(self._geom) + d = c_double() + lgeos.GEOSCoordSeq_getZ(cs, 0, byref(d)) + return d.value + + @property + def __geo_interface__(self): + return { + 'type': 'Point', + 'coordinates': self.coords[0] + } + + @property + def ctypes(self): + if not self._ctypes_data: + array_type = c_double * self._ndim + array = array_type() + array[0] = self.x + array[1] = self.y + if self._ndim == 3: + array[2] = self.z + self._ctypes_data = array + return self._ctypes_data + + def array_interface(self): + """Provide the Numpy array protocol.""" + ai = self.array_interface_base + ai.update({'shape': (self._ndim,)}) + return ai + __array_interface__ = property(array_interface) + + @property + def bounds(self): + cs = lgeos.GEOSGeom_getCoordSeq(self._geom) + x = c_double() + y = c_double() + lgeos.GEOSCoordSeq_getX(cs, 0, byref(x)) + lgeos.GEOSCoordSeq_getY(cs, 0, byref(y)) + return (x.value, y.value, x.value, y.value) + + # Coordinate access + + def set_coords(self, coordinates): + update_point_from_py(self, coordinates) + + coords = property(BaseGeometry.get_coords, set_coords) + + +class PointAdapter(Point): + + """Adapts a Python coordinate pair or a numpy array to the point interface. + """ + + context = None + + def __init__(self, context): + self.context = context + + # Override base class __del__ + def __del__(self): + pass + + @property + def _ndim(self): + try: + # From array protocol + array = self.context.__array_interface__ + n = array['shape'][0] + assert n == 2 or n == 3 + return n + except AttributeError: + # Fall back on list + return len(self.context) + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_point_from_py(self.context)[0] + + # TODO: reimplement x, y, z properties without calling invoking _geom + + @property + def __array_interface__(self): + """Provide the Numpy array protocol.""" + try: + return self.context.__array_interface__ + except AttributeError: + return self.array_interface() + + coords = property(BaseGeometry.get_coords) + + +def asPoint(context): + """Factory for PointAdapter instances.""" + return PointAdapter(context) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + +if __name__ == "__main__": + _test() + Added: trunk/toolkits/basemap-testing/lib/shapely/geometry/polygon.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geometry/polygon.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geometry/polygon.py 2007-11-12 16:54:58 UTC (rev 4226) @@ -0,0 +1,414 @@ +""" +Polygons and their linear ring components. +""" + +from ctypes import byref, c_double, c_int, c_void_p, cast, POINTER, pointer + +from shapely.geos import lgeos +from shapely.geometry.base import BaseGeometry +from shapely.geometry.linestring import LineString, LineStringAdapter + + +def geos_linearring_from_py(ob, update_geom=None, update_ndim=0): + try: + # From array protocol + array = ob.__array_interface__ + assert len(array['shape']) == 2 + m = array['shape'][0] + n = array['shape'][1] + assert m >= 2 + assert n == 2 or n == 3 + + # Make pointer to the coordinate array + try: + cp = cast(array['data'][0], POINTER(c_double)) + except ArgumentError: + cp = array['data'] + + # Add closing coordinates to sequence? + if cp[0] != cp[m*n-n] or cp[1] != cp[m*n-n+1]: + M = m + 1 + else: + M = m + + # Create a coordinate sequence + if update_geom is not None: + cs = lgeos.GEOSGeom_getCoordSeq(update_geom) + if n != update_ndim: + raise ValueError, \ + "Wrong coordinate dimensions; this geometry has dimensions: %d" \ + % update_ndim + else: + cs = lgeos.GEOSCoordSeq_create(M, n) + + # add to coordinate sequence + for i in xrange(m): + dx = c_double(cp[n*i]) + dy = c_double(cp[n*i+1]) + dz = None + if n == 3: + dz = c_double(cp[n*i+2]) + + # Because of a bug in the GEOS C API, + # always set X before Y + lgeos.GEOSCoordSeq_setX(cs, i, dx) + lgeos.GEOSCoordSeq_setY(cs, i, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, i, dz) + + # Add closing coordinates to sequence? + if M > m: + dx = c_double(cp[0]) + dy = c_double(cp[1]) + dz = None + if n == 3: + dz = c_double(cp[2]) + + # Because of a bug in the GEOS C API, + # always set X before Y + lgeos.GEOSCoordSeq_setX(cs, M-1, dx) + lgeos.GEOSCoordSeq_setY(cs, M-1, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, M-1, dz) + + except AttributeError: + # Fall back on list + m = len(ob) + n = len(ob[0]) + assert m >= 2 + assert n == 2 or n == 3 + + # Add closing coordinates if not provided + if ob[0][0] != ob[-1][0] or ob[0][1] != ob[-1][1]: + M = m + 1 + else: + M = m + + # Create a coordinate sequence + if update_geom is not None: + cs = lgeos.GEOSGeom_getCoordSeq(update_geom) + if n != update_ndim: + raise ValueError, \ + "Wrong coordinate dimensions; this geometry has dimensions: %d" \ + % update_ndim + else: + cs = lgeos.GEOSCoordSeq_create(M, n) + + # add to coordinate sequence + for i in xrange(m): + coords = ob[i] + dx = c_double(coords[0]) + dy = c_double(coords[1]) + dz = None + if n == 3: + dz = c_double(coords[2]) + + # Because of a bug in the GEOS C API, + # always set X before Y + lgeos.GEOSCoordSeq_setX(cs, i, dx) + lgeos.GEOSCoordSeq_setY(cs, i, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, i, dz) + + # Add closing coordinates to sequence? + if M > m: + coords = ob[0] + dx = c_double(coords[0]) + dy = c_double(coords[1]) + dz = None + if n == 3: + dz = c_double(coords[2]) + + # Because of a bug in the GEOS C API, + # always set X before Y + lgeos.GEOSCoordSeq_setX(cs, M-1, dx) + lgeos.GEOSCoordSeq_setY(cs, M-1, dy) + if n == 3: + lgeos.GEOSCoordSeq_setZ(cs, M-1, dz) + + if update_geom is not None: + return None + else: + return (lgeos.GEOSGeom_createLinearRing(cs), n) + +def update_linearring_from_py(geom, ob): + geos_linearring_from_py(ob, geom._geom, geom._ndim) + + +class LinearRing(LineString): + + """A linear ring. + """ + + _ndim = 2 + + def __init__(self, coordinates=None): + """Initialize. + + Parameters + ---------- + coordinates : sequence or array + This may be an object that satisfies the numpy array protocol, + providing an M x 2 or M x 3 (with z) array, or it may be a sequence + of x, y (,z) coordinate sequences. + + Rings are implicitly closed. There is no need to specific a final + coordinate pair identical to the first. + + Example + ------- + >>> ring = LinearRing( ((0.,0.), (0.,1.), (1.,1.), (1.,0.)) ) + + Produces a 1x1 square. + """ + BaseGeometry.__init__(self) + + if coordinates is None: + # allow creation of null lines, to support unpickling + pass + else: + self._geom, self._ndims = geos_linearring_from_py(coordinates) + + @property + def __geo_interface__(self): + return { + 'type': 'LinearRing', + 'coordinates': tuple(self.coords) + } + + # Coordinate access + + def set_coords(self, coordinates): + update_linearring_from_py(self, coordinates) + + coords = property(BaseGeometry.get_coords, set_coords) + + +class LinearRingAdapter(LineStringAdapter): + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_linearring_from_py(self.context)[0] + + @property + def __geo_interface__(self): + return { + 'type': 'LinearRing', + 'coordinates': tuple(self.coords) + } + + coords = property(BaseGeometry.get_coords) + + +def asLinearRing(context): + return LinearRingAdapter(context) + + +class InteriorRingSequence(object): + + _factory = None + _geom = None + _ndim = None + _index = 0 + _length = 0 + + def __init__(self, geom): + self._geom = geom._geom + self._ndim = geom._ndim + + def __iter__(self): + self._index = 0 + self._length = self.__len__() + return self + + def next(self): + if self._index < self._length: + g = LinearRing() + g._owned = True + g._geom = lgeos.GEOSGetInteriorRingN(self._geom, self._index) + self._index += 1 + return g + else: + raise StopIteration + + def __len__(self): + return lgeos.GEOSGetNumInteriorRings(self._geom) + + def __getitem__(self, i): + M = self.__len__() + if i + M < 0 or i >= M: + raise IndexError, "index out of range" + if i < 0: + ii = M + i + else: + ii = i + g = LinearRing() + g._owned = True + g._geom = lgeos.GEOSGetInteriorRingN(self._geom, ii) + return g + + @property + def _longest(self): + max = 0 + for g in iter(self): + l = len(g.coords) + if l > max: + max = l + + +def geos_polygon_from_py(shell, holes=None): + if shell is not None: + geos_shell, ndims = geos_linearring_from_py(shell) + ## Polygon geometry takes ownership of the ring + #self._exterior._owned = True + + if holes: + ob = holes + L = len(ob) + try: + N = len(ob[0][0]) + except: + import pdb; pdb.set_trace() + assert L >= 1 + assert N == 2 or N == 3 + + # Array of pointers to ring geometries + geos_holes = (c_void_p * L)() + + # add to coordinate sequence + for l in xrange(L): + geom, ndims = geos_linearring_from_py(ob[l]) + geos_holes[l] = cast(geom, c_void_p) + + else: + geos_holes = POINTER(c_void_p)() + L = 0 + + return ( + lgeos.GEOSGeom_createPolygon( + c_void_p(geos_shell), + geos_holes, + L + ), + ndims + ) + +class Polygon(BaseGeometry): + + """A line string, also known as a polyline. + """ + + _exterior = None + _interiors = [] + _ndim = 2 + + def __init__(self, shell=None, holes=None): + """Initialize. + + Parameters + ---------- + exterior : sequence or array + This may be an object that satisfies the numpy array protocol, + providing an M x 2 or M x 3 (with z) array, or it may be a sequence + of x, y (,z) coordinate sequences. + + Example + ------- + >>> coords = ((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.)) + >>> polygon = Polygon(coords) + """ + BaseGeometry.__init__(self) + + if shell is not None: + self._geom, self._ndims = geos_polygon_from_py(shell, holes) + + @property + def exterior(self): + if self._exterior is None: + # A polygon created from the abstract factory will have a null + # _exterior attribute. + ring = lgeos.GEOSGetExteriorRing(self._geom) + self._exterior = LinearRing() + self._exterior._geom = ring + self._exterior._owned = True + return self._exterior + + @property + def interiors(self): + return InteriorRingSequence(self) + + @property + def ctypes(self): + if not self._ctypes_data: + self._ctypes_data = self.exterior.ctypes + return self._ctypes_data + + @property + def __array_interface__(self): + raise NotImplementedError, \ + "A polygon does not itself provide the array interface. Its rings do." + + @property + def coords(self): + raise NotImplementedError, \ + "Component rings have coordinate sequences, but the polygon does not" + + @property + def __geo_interface__(self): + coords = [tuple(self.exterior.coords)] + for hole in self.interiors: + coords.append(tuple(hole.coords)) + return { + 'type': 'Polygon', + 'coordinates': tuple(coords) + } + + +class PolygonAdapter(Polygon): + + """Adapts sequences of sequences or numpy arrays to the polygon + interface. + """ + + context = None + + def __init__(self, shell, holes=None): + self.shell = shell + self.holes = holes + + # Override base class __del__ + def __del__(self): + pass + + @property + def _ndim(self): + try: + # From array protocol + array = self.shell.__array_interface__ + n = array['shape'][1] + assert n == 2 or n == 3 + return n + except AttributeError: + # Fall back on list + return len(self.shell[0]) + + @property + def _geom(self): + """Keeps the GEOS geometry in synch with the context.""" + return geos_polygon_from_py(self.shell, self.holes)[0] + + +def asPolygon(shell, holes): + """Factory for PolygonAdapter instances.""" + return PolygonAdapter(shell, holes) + + +# Test runner +def _test(): + import doctest + doctest.testmod() + +if __name__ == "__main__": + _test() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-12 16:51:15
|
Revision: 4225 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4225&view=rev Author: jswhit Date: 2007-11-12 08:51:08 -0800 (Mon, 12 Nov 2007) Log Message: ----------- add Shapely Added Paths: ----------- trunk/toolkits/basemap-testing/lib/shapely/geos.py trunk/toolkits/basemap-testing/lib/shapely/iterops.py trunk/toolkits/basemap-testing/lib/shapely/predicates.py trunk/toolkits/basemap-testing/lib/shapely/topology.py trunk/toolkits/basemap-testing/lib/shapely/wkb.py trunk/toolkits/basemap-testing/lib/shapely/wkt.py Added: trunk/toolkits/basemap-testing/lib/shapely/geos.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/geos.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/geos.py 2007-11-12 16:51:08 UTC (rev 4225) @@ -0,0 +1,47 @@ +""" +Exports the libgeos_c shared lib, GEOS-specific exceptions, and utilities. +""" + +import atexit +from ctypes import CDLL, CFUNCTYPE, c_char_p +from ctypes.util import find_library +import sys + +from find_geoslib import find_geoslib +lgeos = find_geoslib() + +# Exceptions + +class ReadingError(Exception): + pass + +class DimensionError(Exception): + pass + +class TopologicalError(Exception): + pass + +class PredicateError(Exception): + pass + + +# GEOS error handlers, which currently do nothing. + +def error_handler(fmt, list): + pass +error_h = CFUNCTYPE(None, c_char_p, c_char_p)(error_handler) + +def notice_handler(fmt, list): + pass +notice_h = CFUNCTYPE(None, c_char_p, c_char_p)(notice_handler) + +# Register a cleanup function + +def cleanup(): + lgeos.finishGEOS() + +atexit.register(cleanup) + +lgeos.initGEOS(notice_h, error_h) + + Added: trunk/toolkits/basemap-testing/lib/shapely/iterops.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/iterops.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/iterops.py 2007-11-12 16:51:08 UTC (rev 4225) @@ -0,0 +1,54 @@ +""" +""" + +from ctypes import c_char_p, c_size_t +from shapely.geos import lgeos + + +def geos_from_geometry(geom): + data = geom.to_wkb() + return lgeos.GEOSGeomFromWKB_buf( + c_char_p(data), + c_size_t(len(data)) + ) + +class BinaryPredicateIterator(object): + + """A generating non-data descriptor. + """ + + fn = None + context = None + + def __init__(self, fn): + self.fn = fn + + def __get__(self, obj, objtype=None): + self.context = obj + return self + + def __call__(self, geom, iterator, value=True): + geos_geom = geos_from_geometry(geom) + for item in iterator: + try: + geom, ob = item + except TypeError: + geom = item + ob = geom + retval = self.fn(geos_geom, geos_from_geometry(geom)) + if retval == 2: + raise PredicateError, "Failed to evaluate %s" % repr(self.fn) + elif bool(retval) == value: + yield ob + + +# utilities +disjoint = BinaryPredicateIterator(lgeos.GEOSDisjoint) +touches = BinaryPredicateIterator(lgeos.GEOSTouches) +intersects = BinaryPredicateIterator(lgeos.GEOSIntersects) +crosses = BinaryPredicateIterator(lgeos.GEOSCrosses) +within = BinaryPredicateIterator(lgeos.GEOSWithin) +contains = BinaryPredicateIterator(lgeos.GEOSContains) +overlaps = BinaryPredicateIterator(lgeos.GEOSOverlaps) +equals = BinaryPredicateIterator(lgeos.GEOSEquals) + Added: trunk/toolkits/basemap-testing/lib/shapely/predicates.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/predicates.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/predicates.py 2007-11-12 16:51:08 UTC (rev 4225) @@ -0,0 +1,50 @@ +""" +Support for GEOS spatial predicates. +""" + +from shapely.geos import PredicateError + +# Predicates + +class BinaryPredicate(object): + + """A callable non-data descriptor. + """ + + fn = None + context = None + + def __init__(self, fn): + self.fn = fn + + def __get__(self, obj, objtype=None): + self.context = obj + return self + + def __call__(self, other): + retval = self.fn(self.context._geom, other._geom) + if retval == 2: + raise PredicateError, "Failed to evaluate %s" % repr(self.fn) + return bool(retval) + + +# A data descriptor +class UnaryPredicate(object): + + """A data descriptor. + """ + + fn = None + + def __init__(self, fn): + self.fn = fn + + def __get__(self, obj, objtype=None): + retval = self.fn(obj._geom) + if retval == 2: + raise PredicateError, "Failed to evaluate %s" % repr(self.fn) + return bool(retval) + + def __set__(self, obj, value=None): + raise AttributeError, "Attribute is read-only" + Added: trunk/toolkits/basemap-testing/lib/shapely/topology.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/topology.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/topology.py 2007-11-12 16:51:08 UTC (rev 4225) @@ -0,0 +1,62 @@ +""" +Support for GEOS topological operations. +""" + +from shapely.geos import TopologicalError + + +class BinaryTopologicalOp(object): + + """A callable non-data descriptor. + + Wraps a GEOS function. The factory is a callable which wraps results in + the appropriate shapely geometry class. + """ + + fn = None + context = None + factory = None + + def __init__(self, fn, factory): + self.fn = fn + self.factory = factory + + def __get__(self, obj, objtype=None): + self.context = obj + return self + + def __call__(self, other): + product = self.fn(self.context._geom, other._geom) + if not product: + # Check validity of geometries + if not self.context.is_valid: + raise TopologicalError, \ + "The operation '%s' produced a null geometry. Likely cause is invalidity of the geometry %s" % (self.fn.__name__, repr(self.context)) + elif not other.is_valid: + raise TopologicalError, \ + "The operation '%s' produced a null geometry. Likely cause is invalidity of the 'other' geometry %s" % (self.fn.__name__, repr(other)) + + return self.factory(product) + + +class UnaryTopologicalOp(object): + + """A data descriptor. + + Wraps a GEOS function. The factory is a callable which wraps results in + the appropriate shapely geometry class. + """ + + fn = None + factory = None + + def __init__(self, fn, factory): + self.fn = fn + self.factory = factory + + def __get__(self, obj, objtype=None): + return self.factory(self.fn(obj._geom)) + + def __set__(self, obj, value=None): + raise AttributeError, "Attribute is read-only" + Added: trunk/toolkits/basemap-testing/lib/shapely/wkb.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/wkb.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/wkb.py 2007-11-12 16:51:08 UTC (rev 4225) @@ -0,0 +1,35 @@ +""" +Load/dump geometries using the well-known binary (WKB) format. +""" + +from ctypes import byref, c_int, c_size_t, c_char_p, string_at + +from shapely.geos import lgeos, ReadingError +from shapely.geometry.base import geom_factory + + +# Pickle-like convenience functions + +def loads(data): + """Load a geometry from a WKB string.""" + geom = lgeos.GEOSGeomFromWKB_buf(c_char_p(data), c_size_t(len(data))); + if not geom: + raise ReadingError, \ + "Could not create geometry because of errors while reading input." + return geom_factory(geom) + +def load(fp): + """Load a geometry from an open file.""" + data = fp.read() + return loads(data) + +def dumps(ob): + """Dump a WKB representation of a geometry to a byte string.""" + size = c_int() + bytes = lgeos.GEOSGeomToWKB_buf(ob._geom, byref(size)) + return string_at(bytes, size.value) + +def dump(ob, fp): + """Dump a geometry to an open file.""" + fp.write(dumps(ob)) + Added: trunk/toolkits/basemap-testing/lib/shapely/wkt.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/wkt.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/wkt.py 2007-11-12 16:51:08 UTC (rev 4225) @@ -0,0 +1,33 @@ +""" +Load/dump geometries using the well-known text (WKT) format. +""" + +from ctypes import byref, c_int, c_size_t, c_char_p, string_at + +from shapely.geos import lgeos, ReadingError +from shapely.geometry.base import geom_factory + + +# Pickle-like convenience functions + +def loads(data): + """Load a geometry from a WKT string.""" + geom = lgeos.GEOSGeomFromWKT(c_char_p(data)) + if not geom: + raise ReadingError, \ + "Could not create geometry because of errors while reading input." + return geom_factory(geom) + +def load(fp): + """Load a geometry from an open file.""" + data = fp.read() + return loads(data) + +def dumps(ob): + """Dump a WKB representation of a geometry to a byte string.""" + return string_at(lgeos.GEOSGeomToWKT(ob._geom)) + +def dump(ob, fp): + """Dump a geometry to an open file.""" + fp.write(dumps(ob)) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-12 16:50:20
|
Revision: 4224 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4224&view=rev Author: jswhit Date: 2007-11-12 08:50:16 -0800 (Mon, 12 Nov 2007) Log Message: ----------- include Shapely Modified Paths: -------------- trunk/toolkits/basemap-testing/setup.py Added Paths: ----------- trunk/toolkits/basemap-testing/lib/shapely/ trunk/toolkits/basemap-testing/lib/shapely/__init__.py trunk/toolkits/basemap-testing/lib/shapely/find_geoslib.py Added: trunk/toolkits/basemap-testing/lib/shapely/__init__.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/__init__.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/__init__.py 2007-11-12 16:50:16 UTC (rev 4224) @@ -0,0 +1 @@ +# Added: trunk/toolkits/basemap-testing/lib/shapely/find_geoslib.py =================================================================== --- trunk/toolkits/basemap-testing/lib/shapely/find_geoslib.py (rev 0) +++ trunk/toolkits/basemap-testing/lib/shapely/find_geoslib.py 2007-11-12 16:50:16 UTC (rev 4224) @@ -0,0 +1,69 @@ +from ctypes import CDLL +from ctypes.util import find_library +import os, sys + +def find_geoslib(): + lgeos = False + # if GEOS_DIR env var set, look there for shared lib. + if os.environ.has_key('GEOS_DIR'): + geos_dir = os.environ['GEOS_DIR'] + from ctypes import CDLL + if sys.platform == 'win32': + try: + lgeos = CDLL(os.path.join(geos_dir,'libgeos_c.dll')) + except (ImportError, WindowsError): + # Try GEOS DLL from the Windows PostGIS installer for + # PostgreSQL 8.2 before failing + try: + lgeos = CDLL(os.path.join(geos_dir,'libgeos_c-1.dll')) + except: + pass + elif sys.platform == 'darwin': + try: + lgeos = CDLL(os.path.join(geos_dir,'libgeos_c.dylib')) + except: + pass + else: + # Try the major versioned name first, falling back on the unversioned name. + try: + lgeos = CDLL(os.path.join(geos_dir,'libgeos_c.so.1')) + except ImportError: + try: + lgeos = CDLL(os.path.join(geos_dir,'libgeos_c.so')) + except: + pass + # if GEOS_DIR env var not set, use find_library to look for shared lib. + else: + if sys.platform == 'win32': + try: + lgeos = find_library('libgeos_c.dll') + except (ImportError, WindowsError): + # Try GEOS DLL from the Windows PostGIS installer for + # PostgreSQL 8.2 before failing + lgeos = find_library('libgeos_c-1.dll') + elif sys.platform == 'darwin': + try: + lgeos = find_library('libgeos_c.dylib') + except: + # fink installs in /sw, but find_library doesn't look there. + lgeos = find_library('/sw/lib/libgeos_c.dylib') + else: + # Try the major versioned name first, falling back on the unversioned name. + try: + lgeos = find_library('libgeos_c.so.1') + except ImportError: + lgeos = find_library('libgeos_c.so') + if not lgeos: + raise ImportError(""" +Cannot find libgeos_c. Please install version 2.2.3. +If it is installed already, please set the GEOS_DIR environment +variable to the location in which it is installed.""") + else: + # lgeos is either a string (containing the absolute + # path to the shared lib) or a CDLL instance. + # convert it to a CDLL instance if it is not one already. + try: + lgeos = CDLL(lgeos) + except: + pass + return lgeos Modified: trunk/toolkits/basemap-testing/setup.py =================================================================== --- trunk/toolkits/basemap-testing/setup.py 2007-11-12 16:31:28 UTC (rev 4223) +++ trunk/toolkits/basemap-testing/setup.py 2007-11-12 16:50:16 UTC (rev 4224) @@ -1,15 +1,8 @@ import sys, glob, os 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""") +if major==2 and minor1<4: + raise SystemExit(""" +python 2.4 or higher required""") from distutils.core import Extension from distutils.util import convert_path @@ -67,8 +60,33 @@ else: additional_params = {} from distutils.core import setup + +# check for ctypes +try: from ctypes.util import find_library +except ImportError: havectypes = False +else: havectypes = True +if not havectypes: + raise SystemExit(""" +basemap requires ctypes, which comes with python 2.5. If you are +running python 2.4, please install ctypes from +http://pypi.python.org/pypi/ctypes""") + +# check for libgeos_c +sys.path.append('lib/shapely') +from find_geoslib import find_geoslib +lgeos = find_geoslib() +sys.path.remove('lib/shapely') + +# check for shapely +try: import shapely +except ImportError: haveshapely = False +else: haveshapely = True +if not haveshapely: + packages.append('shapely') + packages.append('shapely.geometry') + package_dirs['shapely'] = os.path.join('lib','shapely') + - # Specify all the required mpl data pyproj_datafiles = ['data/epsg', 'data/esri', 'data/esri.extra', 'data/GL27', 'data/nad.lst', 'data/nad27', 'data/nad83', 'data/ntv2_out.dist', 'data/other.extra', 'data/pj_out27.dist', 'data/pj_out83.dist', 'data/proj_def.dat', 'data/README', 'data/td_out.dist', 'data/test27', 'data/test83', 'data/testntv2', 'data/testvarious', 'data/world'] boundaryfiles = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-11-12 16:31:32
|
Revision: 4223 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4223&view=rev Author: jdh2358 Date: 2007-11-12 08:31:28 -0800 (Mon, 12 Nov 2007) Log Message: ----------- added some mlab imports back to pylab Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/Makefile trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/lib/matplotlib/pyplot.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/API_CHANGES 2007-11-12 16:31:28 UTC (rev 4223) @@ -1,4 +1,3 @@ - Moved mlab.csv2rec -> recutils.csv2rec Added ax kwarg to pyplot.colorbar and Figure.colorbar so that one can specify the axes object from which space for the colorbar Modified: trunk/matplotlib/Makefile =================================================================== --- trunk/matplotlib/Makefile 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/Makefile 2007-11-12 16:31:28 UTC (rev 4223) @@ -1,6 +1,6 @@ # Makefile for matplotlib -PYTHON = /usr/bin/python2.5 +PYTHON = `which python` VERSION = `${PYTHON} setup.py --version` DISTFILES = API_CHANGES KNOWN_BUGS INSTALL README TODO license \ @@ -12,11 +12,11 @@ clean: ${PYTHON} setup.py clean;\ - rm -f *.png *.ps *.eps *.svg *.jpg + rm -f *.png *.ps *.eps *.svg *.jpg *.pdf find . -name "_tmp*.py" | xargs rm -f;\ find . \( -name "*~" -o -name "*.pyc" \) | xargs rm -f;\ - find examples \( -name "*.svg" -o -name "*.png" -o -name "*.ps" -o -name "*.eps" -o -name "*.tar" -o -name "*.gz" -o -name "*.log" -o -name "*.aux" -o -name "*.tex" \) | xargs rm -f - find unit \( -name "*.png" -o -name "*.ps" -o -name "*.eps" \) | xargs rm -f + find examples \( -name "*.svg" C-o -name "*.png" -o -name "*.pdf" -o -name "*.ps" -o -name "*.eps" -o -name "*.tar" -o -name "*.gz" -o -name "*.log" -o -name "*.aux" -o -name "*.tex" \) | xargs rm -f + find unit \( -name "*.png" -o -name "*.ps" -o -name "*.pdf" -o -name "*.eps" \) | xargs rm -f find . \( -name "#*" -o -name ".#*" -o -name ".*~" -o -name "*~" \) | xargs rm -f Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -4798,6 +4798,39 @@ return mtable.table(self, **kwargs) table.__doc__ = cbook.dedent(table.__doc__) % martist.kwdocd + def twinx(self): + """ + ax = twinx() + + create a twin of Axes for generating a plot with a sharex + x-axis but independent y axis. The y-axis of self will have + ticks on left and the returned axes will have ticks on the + right + """ + + ax2 = self.figure.add_axes(self.get_position(), sharex=self, frameon=False) + ax2.yaxis.tick_right() + ax2.yaxis.set_label_position('right') + self.yaxis.tick_left() + return ax2 + + def twiny(self): + """ + ax = twiny() + + create a twin of Axes for generating a plot with a shared + y-axis but independent x axis. The x-axis of self will have + ticks on bottom and the returned axes will have ticks on the + top + """ + + ax2 = self.figure.add_axes(self.get_position(), sharey=self, frameon=False) + ax2.xaxis.tick_top() + ax2.xaxis.set_label_position('top') + self.xaxis.tick_bottom() + return ax2 + + #### Data analysis Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -442,8 +442,9 @@ kw = dict(rowvar=False) return npy.corrcoef(*args, **kw) -def polyfit(x,y,N): +def polyfit(*args, **kwargs): """ + def polyfit(x,y,N) Do a best fit polynomial of order N of y to x. Return value is a vector of polynomial coefficients [pk ... p1 p0]. Eg, for N=2 @@ -480,21 +481,13 @@ See also polyval """ - x = npy.asarray(x, dtype=npy.float_) - #y = npy.asarray(y, dtype=npy.float_) - #y.shape = (len(y),1) - #X = npy.matrix(npy.vander(x, N+1)) - #Xt = npy.matrix(X.transpose()) - #c = npy.array(npy.linalg.inv(Xt*X)*Xt*y) # convert back to array - #c.shape = (N+1,) - #return c - X = npy.vander(x, N+1) - return npy.linalg.lstsq(X, y)[0] + warnings.warn("use numpy.poyfit", DeprecationWarning) + return npy.polyfit(*args, **kw) -def polyval(p,x): +def polyval(*args, **kwargs): """ y = polyval(p,x) @@ -510,14 +503,11 @@ See also polyfit """ - x = npy.asarray(x, dtype=npy.float_) - p = npy.asarray(p, dtype=npy.float_).reshape((len(p),1)) - X = npy.vander(x,len(p)) - y = npy.dot(X,p) - return y.reshape(x.shape) + warnings.warn("use numpy.polyval", DeprecationWarning) + return npy.polyval(*args, **kw) -def vander(x,N=None): +def vander(*args, **kwargs): """ X = vander(x,N=None) @@ -527,7 +517,7 @@ """ warnings.warn("Use numpy.vander()", DeprecationWarning) - return npy.vander(x, N) + return npy.vander(*args, **kwargs) def donothing_callback(*args): @@ -1262,6 +1252,17 @@ fh = cbook.to_filehandle(fname) X = [] + if delimiter==' ': + # space splitting is a special case since x.split() is what + # you want, not x.split(' ') + def splitfunc(x): + return x.split() + else: + def splitfunc(x): + return x.split(delimiter) + + + converterseq = None for i,line in enumerate(fh): if i<skiprows: continue @@ -1269,13 +1270,13 @@ if not len(line): continue if converterseq is None: converterseq = [converters.get(j,float) - for j,val in enumerate(line.split(delimiter))] + for j,val in enumerate(splitfunc(line))] if usecols is not None: vals = line.split(delimiter) row = [converterseq[j](vals[j]) for j in usecols] else: row = [converterseq[j](val) - for j,val in enumerate(line.split(delimiter))] + for j,val in enumerate(splitfunc(line))] thisLen = len(row) X.append(row) @@ -2281,7 +2282,7 @@ FormatFloat.__init__(self, precision, scale=1e-6) -class FormatDate(FormatString): +class FormatDate(FormatObj): def __init__(self, fmt): self.fmt = fmt @@ -2301,7 +2302,7 @@ npy.float32 : FormatFloat(), npy.float64 : FormatFloat(), npy.object_ : FormatObj(), - npy.string_ : FormatString(), + npy.string_ : FormatObj(), } def get_formatd(r, formatd=None): @@ -2658,7 +2659,7 @@ - def rec2gtk(r, formatd=None, rownum=0): + def rec2gtk(r, formatd=None, rownum=0, autowin=True): """ save record array r to excel pyExcelerator worksheet ws starting at rownum. if ws is string like, assume it is a @@ -2666,7 +2667,13 @@ formatd is a dictionary mapping dtype name -> FormatXL instances - The next rownum after writing is returned + This function creates a SortedStringsScrolledWindow (derived + from gtk.ScrolledWindow) and returns it. if autowin is True, + a gtk.Window is created, attached to the + SortedStringsScrolledWindow instance, shown and returned. If + autowin=False, the caller is responsible for adding the + SortedStringsScrolledWindow instance to a gtk widget and + showing it. """ @@ -2692,6 +2699,14 @@ for row in r: scroll.add_row(row) + + if autowin: + win = gtk.Window() + win.set_default_size(800,600) + win.add(scroll) + win.show_all() + scroll.win = win + return scroll Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -249,6 +249,19 @@ from numpy.random import * from numpy.linalg import * +from matplotlib.mlab import load, window_hanning, window_none, conv, detrend, demean, \ + detrend_mean, detrend_none, detrend_linear, entropy, normpdf, levypdf, \ + find, longest_contiguous_ones, longest_ones, prepca, prctile, prctile_rank, \ + center_matrix, rk4, bivariate_normal, get_xyz_where, get_sparse_matrix, dist, \ + dist_point_to_segment, segments_intersect, fftsurr, liaupunov, movavg, \ + save, load, slopes, stineman_interp, inside_poly, poly_below, poly_between, exp_safe, \ + amap, rms_flat, l1norm, l2norm, norm_flat, frange, diagonal_matrix, identity, \ + base_repr, binary_repr, log2, ispower2, fromfunction_kw, rem, norm, orth, rank, sqrtm,\ + mfuncC, approx_real, rec_append_field, rec_drop_fields, rec_join, csv2rec, rec2csv + + + + # old style--if True, override standard numpy with oldnumeric if False: from numpy.oldnumeric import array, zeros, shape, rank, size, fromstring,\ Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -492,14 +492,8 @@ """ if ax is None: ax=gca() - - - ax2 = gcf().add_axes(ax.get_position(), sharex=ax, frameon=False) - ax2.yaxis.tick_right() - ax2.yaxis.set_label_position('right') - ax.yaxis.tick_left() draw_if_interactive() - return ax2 + return ax.twinx() def twiny(ax=None): @@ -510,14 +504,8 @@ """ if ax is None: ax=gca() - - - ax2 = gcf().add_axes(ax.get_position(), sharey=ax, frameon=False) - ax2.xaxis.tick_top() - ax2.xaxis.set_label_position('top') - ax.xaxis.tick_bottom() draw_if_interactive() - return ax2 + return ax.twiny() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-12 15:37:06
|
Revision: 4222 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4222&view=rev Author: dsdale Date: 2007-11-12 07:36:08 -0800 (Mon, 12 Nov 2007) Log Message: ----------- collect config package code in one location in setup.py, so it can easily be commented out for the next release. Modified Paths: -------------- trunk/matplotlib/setup.py Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-12 15:23:23 UTC (rev 4221) +++ trunk/matplotlib/setup.py 2007-11-12 15:36:08 UTC (rev 4222) @@ -120,8 +120,7 @@ 'matplotlib.numerix.npyma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', - 'matplotlib.numerix.fft', - 'matplotlib.config' + 'matplotlib.numerix.fft' ] py_modules = ['pylab'] @@ -307,10 +306,9 @@ # TODO: comment out for mpl release: print_raw("") print_raw("EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES") -if check_provide_configobj(): - py_modules.append('configobj') -if check_provide_traits(): - build_traits(ext_modules, packages) +packages.append('matplotlib.config') +if check_provide_configobj(): py_modules.append('configobj') +if check_provide_traits(): build_traits(ext_modules, packages) print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-12 15:25:06
|
Revision: 4221 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4221&view=rev Author: dsdale Date: 2007-11-12 07:23:23 -0800 (Mon, 12 Nov 2007) Log Message: ----------- option to disable building backend extension modules moved from setup.py to setup.cfg Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/setup.cfg.template trunk/matplotlib/setup.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-12 13:53:38 UTC (rev 4220) +++ trunk/matplotlib/CHANGELOG 2007-11-12 15:23:23 UTC (rev 4221) @@ -1,3 +1,6 @@ +2007-11-12 Options to disable building backend extension modules moved + from setup.py to setup.cfg - DSD + 2007-11-09 Applied Martin Teichmann's patch 1828813: a QPainter is used in paintEvent, which has to be destroyed using the method end(). If matplotlib raises an exception before the call to end - and it Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2007-11-12 13:53:38 UTC (rev 4220) +++ trunk/matplotlib/setup.cfg.template 2007-11-12 15:23:23 UTC (rev 4221) @@ -11,14 +11,37 @@ #suppress = True [provide_packages] -# by default, matplotlib checks for a few dependencies and +# By default, matplotlib checks for a few dependencies and # installs them if missing. This feature can be turned off # by uncommenting the following lines: # -## date/timezone support: +## Date/timezone support: #pytz = False #dateutil = False # -## experimental config package support: +## Experimental config package support: #enthought.traits = False #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 +# 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 +# installed on your system. +# +# You can uncomment any the following lines if you know you do +# not want to use the GUI toolkit. +#gtk = False +#gtkagg = False +#tkagg = False +#wxagg = False Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-12 13:53:38 UTC (rev 4220) +++ trunk/matplotlib/setup.py 2007-11-12 15:23:23 UTC (rev 4221) @@ -17,6 +17,21 @@ # build support for whatever array packages you have installed. BUILD_IMAGE = 1 + +# build a small extension to manage the focus on win32 platforms. +#BUILD_WINDOWING = 0 +BUILD_WINDOWING = 'auto' + + +VERBOSE = False # insert lots of diagnostic prints in extension code + + + + +## You shouldn't need to customize below this point +import ConfigParser +import os + # Build the antigrain geometry toolkit. Agg makes heavy use of # templates, so it probably requires a fairly recent compiler to build # it. It makes very nice antialiased output and also supports alpha @@ -35,19 +50,27 @@ # needed for wxpython <2.8 if you plan on doing animations BUILD_WXAGG = 1 +if os.path.exists("setup.cfg"): + config = ConfigParser.SafeConfigParser() + config.read("setup.cfg") + try: + BUILD_GTK = config.getboolean("gui_support", "gtk") + except: + pass + try: + BUILD_GTKAGG = config.getboolean("gui_support", "gtkagg") + except: + pass + try: + BUILD_TKAGG = config.getboolean("gui_support", "tkagg") + except: + pass + try: + BUILD_WXAGG = config.getboolean("gui_support", "wxagg") + except: + pass -# build a small extension to manage the focus on win32 platforms. -#BUILD_WINDOWING = 0 -BUILD_WINDOWING = 'auto' - -VERBOSE = False # insert lots of diagnostic prints in extension code - - - - -## You shouldn't need to customize below this point - # BEFORE importing disutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. import os This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 13:53:41
|
Revision: 4220 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4220&view=rev Author: mdboom Date: 2007-11-12 05:53:38 -0800 (Mon, 12 Nov 2007) Log Message: ----------- Merged revisions 4191-4219 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4191 | efiring | 2007-11-09 14:37:15 -0500 (Fri, 09 Nov 2007) | 2 lines Remove numerix as nx from pylab ........ r4194 | mdboom | 2007-11-09 15:14:29 -0500 (Fri, 09 Nov 2007) | 2 lines Fix exception plotting an errorbar graph with only two data points. ........ r4195 | mdboom | 2007-11-09 15:15:52 -0500 (Fri, 09 Nov 2007) | 2 lines Bugfix: [ 1808189 ] lw kwarg broken in errorbar (Thanks Joe Monaco). ........ r4196 | dsdale | 2007-11-09 15:37:57 -0500 (Fri, 09 Nov 2007) | 2 lines minor formatting change to dependency report ........ r4197 | mdboom | 2007-11-09 15:59:47 -0500 (Fri, 09 Nov 2007) | 5 lines Bugfix: [ 1757315 ] ValueError: Cannot set nonpositive limits with log transform. The axes scales were not getting set back to "linear" when cla() is called, so autoscale_limits gets confused on the next call to plot(). ........ r4198 | mdboom | 2007-11-09 16:09:04 -0500 (Fri, 09 Nov 2007) | 5 lines Bugfix: [ 1745650 ] patch for mlab.py's comment handling Comment handling had the potential to lose the last character of a line. Slightly different from user submitted patch -- uses split() instead of three lines of Python code. ........ r4199 | mdboom | 2007-11-09 16:27:30 -0500 (Fri, 09 Nov 2007) | 3 lines Bugfix: [ 1732274 ] No antialiasing with pie on wxpython Reducing the sampling of the curve on the wedge looks much better. ........ r4200 | mdboom | 2007-11-09 16:28:58 -0500 (Fri, 09 Nov 2007) | 2 lines Oops in last commit. ........ r4214 | dsdale | 2007-11-10 18:08:19 -0500 (Sat, 10 Nov 2007) | 3 lines added flags in setup.cfg to disable providing external packages like pytz and datetime ........ r4215 | dsdale | 2007-11-10 18:10:15 -0500 (Sat, 10 Nov 2007) | 2 lines added a comment in setup.cfg, will rename to setup.cfg.template ........ r4216 | dsdale | 2007-11-10 18:20:44 -0500 (Sat, 10 Nov 2007) | 2 lines dont use spaces in setup.cfg section names ........ r4217 | dsdale | 2007-11-10 18:21:38 -0500 (Sat, 10 Nov 2007) | 3 lines moved setup.cfg to setup.cfg.template, so local modifications can be made without affecting the trunk ........ r4218 | dsdale | 2007-11-10 18:26:36 -0500 (Sat, 10 Nov 2007) | 2 lines expand comments in build report ........ Modified Paths: -------------- branches/transforms/examples/animation_blit_fltk.py branches/transforms/examples/annotation_demo.py branches/transforms/examples/barcode_demo.py branches/transforms/examples/broken_barh.py branches/transforms/examples/clippath_test.py branches/transforms/examples/custom_figure_class.py branches/transforms/examples/date_demo_convert.py branches/transforms/examples/dynamic_collection.py branches/transforms/examples/fill_demo2.py branches/transforms/examples/gradient_bar.py branches/transforms/examples/interp_demo.py branches/transforms/examples/lasso_demo.py branches/transforms/examples/pick_event_demo.py branches/transforms/examples/scatter_custom_symbol.py branches/transforms/examples/scatter_star_poly.py branches/transforms/examples/spy_demos.py branches/transforms/examples/xcorr_demo.py branches/transforms/examples/zoom_window.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/lib/matplotlib/pylab.py branches/transforms/setup.py branches/transforms/setupext.py Added Paths: ----------- branches/transforms/setup.cfg.template Removed Paths: ------------- branches/transforms/setup.cfg Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4190 + /trunk/matplotlib:1-4219 Modified: branches/transforms/examples/animation_blit_fltk.py =================================================================== --- branches/transforms/examples/animation_blit_fltk.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/animation_blit_fltk.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -3,7 +3,7 @@ import matplotlib matplotlib.use('FltkAgg') import pylab as p -import numpy as nx +import numpy as npy import time @@ -29,7 +29,7 @@ self.background = self.canvas.copy_from_bbox(self.ax.bbox) self.canvas.restore_region(self.background) # update the data - line.set_ydata(nx.sin(x+self.cnt/10.0)) + line.set_ydata(npy.sin(x+self.cnt/10.0)) # just draw the animated artist self.ax.draw_artist(line) # just redraw the axes rectangle @@ -45,8 +45,8 @@ p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs p.grid() # to ensure proper background restore # create the initial line -x = nx.arange(0,2*nx.pi,0.01) -line, = p.plot(x, nx.sin(x), animated=True) +x = npy.arange(0,2*npy.pi,0.01) +line, = p.plot(x, npy.sin(x), animated=True) p.draw() anim=animator(ax) Modified: branches/transforms/examples/annotation_demo.py =================================================================== --- branches/transforms/examples/annotation_demo.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/annotation_demo.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -32,17 +32,19 @@ """ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show from matplotlib.patches import Ellipse +import numpy as npy + if 1: # if only one location is given, the text and xypoint being # annotated are assumed to be the same fig = figure() ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1,5), ylim=(-3,5)) - t = nx.arange(0.0, 5.0, 0.01) - s = nx.cos(2*nx.pi*t) + t = npy.arange(0.0, 5.0, 0.01) + s = npy.cos(2*npy.pi*t) line, = ax.plot(t, s, lw=3, color='purple') ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction', @@ -85,8 +87,8 @@ # respected fig = figure() ax = fig.add_subplot(111, polar=True) - r = nx.arange(0,1,0.001) - theta = 2*2*nx.pi*r + r = npy.arange(0,1,0.001) + theta = 2*2*npy.pi*r line, = ax.plot(theta, r, color='#ee8d18', lw=3) ind = 800 @@ -115,8 +117,8 @@ ax.add_artist(el) el.set_clip_box(ax.bbox) ax.annotate('the top', - xy=(nx.pi/2., 10.), # theta, radius - xytext=(nx.pi/3, 20.), # theta, radius + xy=(npy.pi/2., 10.), # theta, radius + xytext=(npy.pi/3, 20.), # theta, radius xycoords='polar', textcoords='polar', arrowprops=dict(facecolor='black', shrink=0.05), Modified: branches/transforms/examples/barcode_demo.py =================================================================== --- branches/transforms/examples/barcode_demo.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/barcode_demo.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,14 +1,16 @@ -from pylab import figure, show, cm, nx +from matplotlib.pyplot import figure, show, cm +from numpy import where +from numpy.random import rand # the bar -x = nx.where(nx.mlab.rand(500)>0.7, 1.0, 0.0) +x = where(rand(500)>0.7, 1.0, 0.0) axprops = dict(xticks=[], yticks=[]) barprops = dict(aspect='auto', cmap=cm.binary, interpolation='nearest') fig = figure() -# a vertical barcode +# a vertical barcode -- this is broken at present x.shape = len(x), 1 ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) ax.imshow(x, **barprops) Modified: branches/transforms/examples/broken_barh.py =================================================================== --- branches/transforms/examples/broken_barh.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/broken_barh.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -2,7 +2,7 @@ """ Make a "broken" horizontal bar plot, ie one with gaps """ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show fig = figure() ax = fig.add_subplot(111) Modified: branches/transforms/examples/clippath_test.py =================================================================== --- branches/transforms/examples/clippath_test.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/clippath_test.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,9 +1,10 @@ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show import matplotlib.transforms as transforms from matplotlib.patches import RegularPolygon import matplotlib.agg as agg +from numpy import arange, sin, pi +from numpy.random import rand - class ClipWindow: def __init__(self, ax, line): self.ax = ax @@ -47,9 +48,9 @@ fig = figure(figsize=(8,8)) ax = fig.add_subplot(111) -t = nx.arange(0.0, 4.0, 0.01) -s = 2*nx.sin(2*nx.pi*8*t) +t = arange(0.0, 4.0, 0.01) +s = 2*sin(2*pi*8*t) -line, = ax.plot(t, 2*(nx.mlab.rand(len(t))-0.5), 'b-') +line, = ax.plot(t, 2*(rand(len(t))-0.5), 'b-') clipwin = ClipWindow(ax, line) show() Modified: branches/transforms/examples/custom_figure_class.py =================================================================== --- branches/transforms/examples/custom_figure_class.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/custom_figure_class.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,7 +1,7 @@ """ You can pass a custom Figure constructor to figure if youy want to derive from the default Figure. This simple example creates a figure with a figure title """ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show from matplotlib.figure import Figure class MyFigure(Figure): Modified: branches/transforms/examples/date_demo_convert.py =================================================================== --- branches/transforms/examples/date_demo_convert.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/date_demo_convert.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,16 +1,16 @@ #!/usr/bin/env python import datetime -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show from matplotlib.dates import DayLocator, HourLocator, DateFormatter, drange +from numpy import arange - date1 = datetime.datetime( 2000, 3, 2) date2 = datetime.datetime( 2000, 3, 6) delta = datetime.timedelta(hours=6) dates = drange(date1, date2, delta) -y = nx.arange( len(dates)*1.0) +y = arange( len(dates)*1.0) fig = figure() ax = fig.add_subplot(111) @@ -25,7 +25,7 @@ # tick, not the base multiple ax.xaxis.set_major_locator( DayLocator() ) -ax.xaxis.set_minor_locator( HourLocator(nx.arange(0,25,6)) ) +ax.xaxis.set_minor_locator( HourLocator(arange(0,25,6)) ) ax.xaxis.set_major_formatter( DateFormatter('%Y-%m-%d') ) ax.fmt_xdata = DateFormatter('%Y-%m-%d %H:%M:%S') Modified: branches/transforms/examples/dynamic_collection.py =================================================================== --- branches/transforms/examples/dynamic_collection.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/dynamic_collection.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,7 +1,8 @@ import random from matplotlib.collections import RegularPolyCollection import matplotlib.cm as cm -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show +from numpy.random import rand fig = figure() ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) @@ -29,8 +30,8 @@ press 'a' to add a random point from the collection, 'd' to delete one """ if event.key=='a': - x,y = nx.mlab.rand(2) - color = cm.jet(nx.mlab.rand()) + x,y = rand(2) + color = cm.jet(rand()) offsets.append((x,y)) facecolors.append(color) fig.canvas.draw() Modified: branches/transforms/examples/fill_demo2.py =================================================================== --- branches/transforms/examples/fill_demo2.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/fill_demo2.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,8 +1,10 @@ -from pylab import figure, nx, show +from matplotlib.pyplot import figure, show +from numpy import arange, sin, pi + fig = figure() ax = fig.add_subplot(111) -t = nx.arange(0.0,3.01,0.01) -s = nx.sin(2*nx.pi*t) -c = nx.sin(4*nx.pi*t) +t = arange(0.0,3.01,0.01) +s = sin(2*pi*t) +c = sin(4*pi*t) ax.fill(t, s, 'b', t, c, 'g', alpha=0.2) show() Modified: branches/transforms/examples/gradient_bar.py =================================================================== --- branches/transforms/examples/gradient_bar.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/gradient_bar.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,4 +1,6 @@ -from pylab import figure, show, nx, cm +from matplotlib.pyplot import figure, show, cm +from numpy import arange +from numpy.random import rand def gbar(ax, x, y, width=0.5, bottom=0): X = [[.6, .6],[.7,.7]] @@ -19,8 +21,8 @@ extent=(xmin, xmax, ymin, ymax), alpha=1) N = 10 -x = nx.arange(N)+0.25 -y = nx.mlab.rand(N) +x = arange(N)+0.25 +y = rand(N) gbar(ax, x, y, width=0.7) ax.set_aspect('normal') show() Modified: branches/transforms/examples/interp_demo.py =================================================================== --- branches/transforms/examples/interp_demo.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/interp_demo.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,6 +1,9 @@ -from pylab import figure, show, nx, linspace, stineman_interp -x = linspace(0,2*nx.pi,20); -y = nx.sin(x); yp = None +from matplotlib.pyplot import figure, show +from numpy import pi, sin, linspace +from matplotlib.mlab import stineman_interp + +x = linspace(0,2*pi,20); +y = sin(x); yp = None xi = linspace(x[0],x[-1],100); yi = stineman_interp(xi,x,y,yp); Modified: branches/transforms/examples/lasso_demo.py =================================================================== --- branches/transforms/examples/lasso_demo.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/lasso_demo.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -13,7 +13,9 @@ from matplotlib.colors import colorConverter from matplotlib.collections import RegularPolyCollection -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show +from numpy import nonzero +from numpy.random import rand class Datum: colorin = colorConverter.to_rgba('red') @@ -47,9 +49,7 @@ self.cid = self.canvas.mpl_connect('button_press_event', self.onpress) def callback(self, verts): - #print 'all done', verts - #ind = matplotlib.mlab._inside_poly_deprecated(self.xys, verts) - ind = nx.nonzero(points_inside_poly(self.xys, verts)) + ind = nonzero(points_inside_poly(self.xys, verts))[0] for i in range(self.Nxy): if i in ind: self.facecolors[i] = Datum.colorin @@ -66,7 +66,7 @@ # acquire a lock on the widget drawing self.canvas.widgetlock(self.lasso) -data = [Datum(*xy) for xy in nx.mlab.rand(100, 2)] +data = [Datum(*xy) for xy in rand(100, 2)] fig = figure() ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) Modified: branches/transforms/examples/pick_event_demo.py =================================================================== --- branches/transforms/examples/pick_event_demo.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/pick_event_demo.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -63,23 +63,25 @@ The examples below illustrate each of these methods. """ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show from matplotlib.lines import Line2D from matplotlib.patches import Patch, Rectangle from matplotlib.text import Text from matplotlib.image import AxesImage +import numpy as npy +from numpy.random import rand if 1: # simple picking, lines, rectangles and text fig = figure() ax1 = fig.add_subplot(211) ax1.set_title('click on points, rectangles or text', picker=True) ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) - line, = ax1.plot(nx.mlab.rand(100), 'o', picker=5) # 5 points tolerance + line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance # pick the rectangle ax2 = fig.add_subplot(212) - bars = ax2.bar(range(10), nx.mlab.rand(10), picker=True) + bars = ax2.bar(range(10), rand(10), picker=True) for label in ax2.get_xticklabels(): # make the xtick labels pickable label.set_picker(True) @@ -90,7 +92,7 @@ xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind - print 'onpick1 line:', zip(nx.take(xdata, ind), nx.take(ydata, ind)) + print 'onpick1 line:', zip(npy.take(xdata, ind), npy.take(ydata, ind)) elif isinstance(event.artist, Rectangle): patch = event.artist print 'onpick1 patch:', patch.get_path() @@ -122,12 +124,12 @@ xdata = line.get_xdata() ydata = line.get_ydata() maxd = 0.05 - d = nx.sqrt((xdata-mouseevent.xdata)**2. + (ydata-mouseevent.ydata)**2.) + d = npy.sqrt((xdata-mouseevent.xdata)**2. + (ydata-mouseevent.ydata)**2.) - ind = nx.nonzero(nx.less_equal(d, maxd)) + ind = npy.nonzero(npy.less_equal(d, maxd)) if len(ind): - pickx = nx.take(xdata, ind) - picky = nx.take(ydata, ind) + pickx = npy.take(xdata, ind) + picky = npy.take(ydata, ind) props = dict(ind=ind, pickx=pickx, picky=picky) return True, props else: @@ -139,16 +141,16 @@ fig = figure() ax1 = fig.add_subplot(111) ax1.set_title('custom picker for line data') - line, = ax1.plot(nx.mlab.rand(100), nx.mlab.rand(100), 'o', picker=line_picker) + line, = ax1.plot(rand(100), rand(100), 'o', picker=line_picker) fig.canvas.mpl_connect('pick_event', onpick2) if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection) - x, y, c, s = nx.mlab.rand(4, 100) + x, y, c, s = rand(4, 100) def onpick3(event): ind = event.ind - print 'onpick3 scatter:', ind, nx.take(x, ind), nx.take(y, ind) + print 'onpick3 scatter:', ind, npy.take(x, ind), npy.take(y, ind) fig = figure() ax1 = fig.add_subplot(111) @@ -159,10 +161,10 @@ if 1: # picking images (matplotlib.image.AxesImage) fig = figure() ax1 = fig.add_subplot(111) - im1 = ax1.imshow(nx.rand(10,5), extent=(1,2,1,2), picker=True) - im2 = ax1.imshow(nx.rand(5,10), extent=(3,4,1,2), picker=True) - im3 = ax1.imshow(nx.rand(20,25), extent=(1,2,3,4), picker=True) - im4 = ax1.imshow(nx.rand(30,12), extent=(3,4,3,4), picker=True) + im1 = ax1.imshow(rand(10,5), extent=(1,2,1,2), picker=True) + im2 = ax1.imshow(rand(5,10), extent=(3,4,1,2), picker=True) + im3 = ax1.imshow(rand(20,25), extent=(1,2,3,4), picker=True) + im4 = ax1.imshow(rand(30,12), extent=(3,4,3,4), picker=True) ax1.axis([0,5,0,5]) def onpick4(event): Modified: branches/transforms/examples/scatter_custom_symbol.py =================================================================== --- branches/transforms/examples/scatter_custom_symbol.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/scatter_custom_symbol.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,12 +1,14 @@ -from pylab import figure, nx, show +from matplotlib.pyplot import figure, show +from numpy import arange, pi, cos, sin, pi +from numpy.random import rand # unit area ellipse rx, ry = 3., 1. -area = rx * ry * nx.pi -theta = nx.arange(0, 2*nx.pi+0.01, 0.1) -verts = zip(rx/area*nx.cos(theta), ry/area*nx.sin(theta)) +area = rx * ry * pi +theta = arange(0, 2*pi+0.01, 0.1) +verts = zip(rx/area*cos(theta), ry/area*sin(theta)) -x,y,s,c = nx.mlab.rand(4, 30) +x,y,s,c = rand(4, 30) s*= 10**2. fig = figure() Modified: branches/transforms/examples/scatter_star_poly.py =================================================================== --- branches/transforms/examples/scatter_star_poly.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/scatter_star_poly.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,7 +1,7 @@ import pylab -x = pylab.nx.mlab.rand(10) -y = pylab.nx.mlab.rand(10) +x = pylab.rand(10) +y = pylab.rand(10) pylab.subplot(321) pylab.scatter(x,y,s=80,marker=">") Modified: branches/transforms/examples/spy_demos.py =================================================================== --- branches/transforms/examples/spy_demos.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/spy_demos.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -2,7 +2,8 @@ Plot the sparsity pattern of arrays """ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show +import numpy fig = figure() ax1 = fig.add_subplot(221) @@ -10,7 +11,7 @@ ax3 = fig.add_subplot(223) ax4 = fig.add_subplot(224) -x = nx.mlab.randn(20,20) +x = numpy.random.randn(20,20) x[5] = 0. x[:,12] = 0. Modified: branches/transforms/examples/xcorr_demo.py =================================================================== --- branches/transforms/examples/xcorr_demo.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/xcorr_demo.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,6 +1,7 @@ -from pylab import figure, show, nx +from matplotlib.pylab import figure, show +import numpy -x,y = nx.mlab.randn(2,100) +x,y = numpy.random.randn(2,100) fig = figure() ax1 = fig.add_subplot(211) ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True) @@ -13,3 +14,4 @@ ax2.axhline(0, color='black', lw=2) show() + Modified: branches/transforms/examples/zoom_window.py =================================================================== --- branches/transforms/examples/zoom_window.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/examples/zoom_window.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -9,15 +9,17 @@ Note the diameter of the circles in the scatter are defined in points**2, so their size is independent of the zoom """ -from pylab import figure, show, nx +from matplotlib.pyplot import figure, show +import numpy figsrc = figure() figzoom = figure() axsrc = figsrc.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False) -axzoom = figzoom.add_subplot(111, xlim=(0.45,0.55), ylim=(0.4,.6), autoscale_on=False) +axzoom = figzoom.add_subplot(111, xlim=(0.45,0.55), ylim=(0.4,.6), + autoscale_on=False) axsrc.set_title('Click to zoom') axzoom.set_title('zoom window') -x,y,s,c = nx.mlab.rand(4,200) +x,y,s,c = numpy.random.rand(4,200) s *= 200 Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/lib/matplotlib/axes.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -740,6 +740,8 @@ self.xaxis.cla() self.yaxis.cla() + self.set_xscale('linear') + self.set_yscale('linear') self.ignore_existing_data_limits = True self.callbacks = cbook.CallbackRegistry(('xlim_changed', 'ylim_changed')) @@ -3787,7 +3789,7 @@ plot_kw['mew']=kwargs['mew'] if xerr is not None: - if iterable(xerr) and len(xerr)==2: + if iterable(xerr) and len(xerr)==2 and iterable(xerr[0]) and iterable(xerr[1]): # using list comps rather than arrays to preserve units left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[0])] right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[1])] @@ -3821,7 +3823,7 @@ caplines.extend( self.plot(right, y, 'k|', **plot_kw) ) if yerr is not None: - if iterable(yerr) and len(yerr)==2: + if iterable(yerr) and len(yerr)==2 and iterable(yerr[0]) and iterable(yerr[1]): # using list comps rather than arrays to preserve units lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[0])] upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[1])] Modified: branches/transforms/lib/matplotlib/collections.py =================================================================== --- branches/transforms/lib/matplotlib/collections.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/lib/matplotlib/collections.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -222,7 +222,7 @@ ACCEPTS: float or sequence of floats """ self._linewidths = self._get_value(lw) - set_linewidth = set_linewidths + set_lw = set_linewidth = set_linewidths def set_linestyles(self, ls): """ Modified: branches/transforms/lib/matplotlib/mlab.py =================================================================== --- branches/transforms/lib/matplotlib/mlab.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/lib/matplotlib/mlab.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -1265,7 +1265,7 @@ converterseq = None for i,line in enumerate(fh): if i<skiprows: continue - line = line[:line.find(comments)].strip() + line = line.split(comments, 1)[0].strip() if not len(line): continue if converterseq is None: converterseq = [converters.get(j,float) Modified: branches/transforms/lib/matplotlib/pylab.py =================================================================== --- branches/transforms/lib/matplotlib/pylab.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/lib/matplotlib/pylab.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -202,8 +202,13 @@ from cbook import flatten, is_string_like, exception_to_str, popd, \ silent_list, iterable, enumerate, dedent -import matplotlib.numerix as nx import numpy as npy +# The masked array namespace is brought in as ma; getting +# this from numerix allows one to select either numpy.ma or +# Pierre G-M's maskedarray implementation, which may +# replace the present numpy.ma implementation in a future +# numpy release. +from matplotlib.numerix import npyma as ma from matplotlib import mpl # pulls in most modules Deleted: branches/transforms/setup.cfg =================================================================== --- branches/transforms/setup.cfg 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/setup.cfg 2007-11-12 13:53:38 UTC (rev 4220) @@ -1,7 +0,0 @@ -[egg_info] -tag_svn_revision = 1 - -[status] -# To suppress display of the dependencies and their versions -# at the top of the build log, uncomment the following line: -# suppress = 1 \ No newline at end of file Copied: branches/transforms/setup.cfg.template (from rev 4218, trunk/matplotlib/setup.cfg.template) =================================================================== --- branches/transforms/setup.cfg.template (rev 0) +++ branches/transforms/setup.cfg.template 2007-11-12 13:53:38 UTC (rev 4220) @@ -0,0 +1,24 @@ +# Rename this file to setup.cfg to modify matplotlib's +# build options. + +[egg_info] +tag_svn_revision = 1 + +[status] +# To suppress display of the dependencies and their versions +# at the top of the build log, uncomment the following line: +# +#suppress = True + +[provide_packages] +# by default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines: +# +## date/timezone support: +#pytz = False +#dateutil = False +# +## experimental config package support: +#enthought.traits = False +#configobj = False Modified: branches/transforms/setup.py =================================================================== --- branches/transforms/setup.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/setup.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -13,10 +13,8 @@ rc = {'backend':'PS', 'numerix':'numpy'} -# build the image support module - requires agg and Numeric or -# numarray. You can build the image module with either Numeric or -# numarray or both. By default, matplotlib will build support for -# whatever array packages you have installed. +# build the image support module - requires agg. By default, matplotlib will +# build support for whatever array packages you have installed. BUILD_IMAGE = 1 # Build the path utilities module. This module depends on some parts @@ -87,9 +85,10 @@ build_subprocess, build_ttconv, print_line, print_status, print_message, \ print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \ check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, \ - check_for_cairo, check_for_traits, check_for_pytz, check_for_dateutil, \ - check_for_configobj, check_for_dvipng, check_for_ghostscript, \ - check_for_latex, check_for_pdftops, check_for_datetime + check_for_cairo, check_provide_traits, check_provide_pytz, \ + check_provide_dateutil, check_provide_configobj, check_for_dvipng, \ + check_for_ghostscript, check_for_latex, check_for_pdftops, \ + check_for_datetime #import distutils.sysconfig # jdh @@ -248,8 +247,8 @@ print_raw("OPTIONAL DATE/TIMEZONE DEPENDENCIES") hasdatetime = check_for_datetime() -hasdateutil = check_for_dateutil(hasdatetime) -haspytz = check_for_pytz(hasdatetime) +provide_dateutil = check_provide_dateutil(hasdatetime) +provide_pytz = check_provide_pytz(hasdatetime) if hasdatetime: # dates require python23 datetime # only install pytz and dateutil if the user hasn't got them @@ -280,8 +279,8 @@ add_dateutil() else: # only add them if we need them - if not haspytz: add_pytz() - if not hasdateutil: add_dateutil() + if provide_pytz: add_pytz() + if provide_dateutil: add_dateutil() print_raw("") print_raw("OPTIONAL USETEX DEPENDENCIES") @@ -293,8 +292,10 @@ # TODO: comment out for mpl release: print_raw("") print_raw("EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES") -if not check_for_configobj(): py_modules.append('configobj') -if not check_for_traits(): build_traits(ext_modules, packages) +if check_provide_configobj(): + py_modules.append('configobj') +if check_provide_traits(): + build_traits(ext_modules, packages) print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") Modified: branches/transforms/setupext.py =================================================================== --- branches/transforms/setupext.py 2007-11-11 21:11:35 UTC (rev 4219) +++ branches/transforms/setupext.py 2007-11-12 13:53:38 UTC (rev 4220) @@ -99,16 +99,35 @@ numpy_inc_dirs = [] # Based on the contents of setup.cfg, determine if the status block -# should be displayed +# should be displayed, if missing external packages should be provided display_status = True +provide_pytz = True +provide_dateutil = True +provide_configobj = True +provide_traits = True if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() config.read("setup.cfg") try: - if config.get("status", "suppress"): - display_status = False + display_status = not config.getboolean("status", "suppress") except: pass + try: + provide_pytz = config.getboolean("provide_packages", "pytz") + except: + pass + try: + provide_dateutil = config.getboolean("provide_packages", "dateutil") + except: + pass + try: + provide_configobj = config.getboolean("provide_packages", "configobj") + except: + pass + try: + provide_traits = config.getboolean("provide_packages", "enthought.traits") + except: + pass if display_status: def print_line(char='='): @@ -300,7 +319,7 @@ print_status("Qt", "no") return False else: - print_status("Qt", "Qt: %s, pyqt: %s" % + print_status("Qt", "Qt: %s, PyQt: %s" % (convert_qt_version(pyqtconfig.Configuration().qt_version), pyqtconfig.Configuration().pyqt_version_str)) return True @@ -312,7 +331,7 @@ print_status("Qt4", "no") return False else: - print_status("Qt4", "Qt: %s, pyqt: %s" % + print_status("Qt4", "Qt: %s, PyQt4: %s" % (convert_qt_version(pyqtconfig.Configuration().qt_version), pyqtconfig.Configuration().pyqt_version_str)) return True @@ -337,57 +356,73 @@ print_status("datetime", "present, version unknown") return True -def check_for_pytz(hasdatetime=True): +def check_provide_pytz(hasdatetime=True): try: import pytz except ImportError: - if hasdatetime: print_status("pytz", "mpl-provided") - else: print_status("pytz", "no") - return False + if hasdatetime and provide_pytz: + print_status("pytz", "matplotlib will provide") + return True + else: + print_status("pytz", "no") + return False else: print_status("pytz", pytz.__version__) - return True + return False -def check_for_dateutil(hasdatetime=True): +def check_provide_dateutil(hasdatetime=True): try: import dateutil except ImportError: - if hasdatetime: print_status("dateutil", "mpl-provided") - else: print_status("dateutil", "no") - return False + if hasdatetime and provide_dateutil: + print_status("dateutil", "matplotlib will provide") + return True + else: + print_status("dateutil", "no") + return False else: try: print_status("dateutil", dateutil.__version__) except AttributeError: print_status("dateutil", "present, version unknown") - return True + return False -def check_for_configobj(): +def check_provide_configobj(): try: import configobj except ImportError: - print_status("configobj", "mpl-provided") - return False + if provide_configobj: + print_status("configobj", "matplotlib will provide") + return True + else: + print_status("configobj", "no") + return False else: print_status("configobj", configobj.__version__) - return True + return False -def check_for_traits(): - gotit = False +def check_provide_traits(): try: from enthought import traits - gotit = True try: from enthought.traits import version except: print_status("enthought.traits", "unknown and incompatible version: < 2.0") - return gotit + return False else: - if version.version.endswith('mpl'): gotit = False - print_status("enthought.traits", version.version) + if version.version.endswith('mpl'): + print_status("enthought.traits", "matplotlib will provide") + return True + else: + print_status("enthought.traits", version.version) + return False except ImportError: - print_status("enthought.traits", "no") - return gotit + if provide_traits: + print_status("enthought.traits", "matplotlib will provide") + return True + else: + print_status("enthought.traits", "no") + return False def check_for_dvipng(): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-11 21:12:00
|
Revision: 4219 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4219&view=rev Author: jswhit Date: 2007-11-11 13:11:35 -0800 (Sun, 11 Nov 2007) Log Message: ----------- use numpy arrays to create Shapely instances (10% speedup), allow for the possibility to use full res coastlines. Modified Paths: -------------- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-10 23:26:36 UTC (rev 4218) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-11 21:11:35 UTC (rev 4219) @@ -670,6 +670,8 @@ area_thresh = 100. elif resolution == 'h': area_thresh = 10. + elif resolution == 'f': + area_thresh = 1. else: raise ValueError, "boundary resolution must be one of 'c','l','i' or 'h'" self.area_thresh = area_thresh @@ -792,7 +794,9 @@ # numpy array (first column is lons, second is lats). polystring = bdatfile.read(bytecount) # binary data is little endian. - b = npy.reshape(npy.fromstring(polystring,dtype='<f4'),(npts,2)) + b = npy.array(npy.fromstring(polystring,dtype='<f4'),'f8') + b.shape = (npts,2) + b2 = b.copy() # if map boundary polygon is a valid one in lat/lon # coordinates (i.e. it does not contain either pole), # the intersections of the boundary geometries @@ -819,21 +823,20 @@ lats.append(-90.) poly = PolygonShape(zip(lons,lats)) antart = True - b = npy.empty((len(lons),2),npy.float32) + b = npy.empty((len(lons),2),npy.float64) b[:,0] = lons; b[:,1] = lats else: antart = False # create Shapely geometry from lons/lons array. - blons = b[:,0]; blats = b[:,1] - poly = Shape(zip(blons,blats)) + poly = Shape(b) # create duplicate polygons shifted by -360 and +360 # (so as to properly treat polygons that cross # Greenwich meridian). if not antart: - blons = b[:,0]-360 - poly1 = Shape(zip(blons,blats)) - blons = b[:,0]+360 - poly2 = Shape(zip(blons,blats)) + b2[:,0] = b[:,0]-360 + poly1 = Shape(b2) + b2[:,0] = b[:,0]+360 + poly2 = Shape(b2) polys = [poly1,poly,poly2] else: # Antartica already extends from -360 to +720. polys = [poly] @@ -874,17 +877,15 @@ # projection region and boundary geometries in map # projection coordinates. else: - blons = b[:,0]; blats = b[:,1] # transform coordinates from lat/lon # to map projection coordinates. # special case for ortho, compute coastline polygon # vertices in stereographic coords. if name == 'gshhs' and self.projection == 'ortho': - bx, by = maptran(blons, blats) + b[:,0], b[:,1] = maptran(b[:,0], b[:,1]) else: - bx, by = self(blons, blats) - goodmask = npy.logical_and(bx<1.e20,by<1.e20) - badmask = npy.logical_or(bx>1.e20,by>1.e20) + b[:,0], b[:,1] = self(b[:,0], b[:,1]) + goodmask = npy.logical_and(b[:,0]<1.e20,b[:,1]<1.e20) # if less than two points are valid in # map proj coords, skip this geometry. if npy.sum(goodmask) <= 1: continue @@ -892,8 +893,8 @@ # if not a polygon, # just remove parts of geometry that are undefined # in this map projection. - bx = npy.compress(goodmask, bx) - by = npy.compress(goodmask, by) + bx = npy.compress(goodmask, b[:,0]) + by = npy.compress(goodmask, b[:,1]) # for orthographic projection, all points # outside map projection region are eliminated # with the above step, so we're done. @@ -902,10 +903,10 @@ polygon_types.append(type) continue # create a Shapely geometry object. - poly = Shape(zip(bx,by)) + poly = Shape(b) # if geometry instersects map projection # region, and doesn't have any invalid points, process it. - if not badmask.any() and boundarypolyxy.intersects(poly): + if goodmask.all() and boundarypolyxy.intersects(poly): # if geometry intersection calculation fails, # just move on. try: @@ -935,14 +936,11 @@ if name == 'gshhs' and\ self._fulldisk and\ areafrac > 0.99: continue - bx = b[:,0]; by = b[:,1] # inverse transform from stereographic # to lat/lon. - blons, blats = maptran(bx, by, inverse=True) - # forward transform from lat/lon to + b[:,0], b[:,1] = maptran(b[:,0], b[:,1], inverse=True) # orthographic. - bx, by = self(blons, blats) - b[:,0] = bx; b[:,1] = by + b[:,0], b[:,1]= self(b[:,0], b[:,1]) polygons.append(zip(b[:,0],b[:,1])) polygon_types.append(type) return polygons, polygon_types This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:26:37
|
Revision: 4218 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4218&view=rev Author: dsdale Date: 2007-11-10 15:26:36 -0800 (Sat, 10 Nov 2007) Log Message: ----------- expand comments in build report Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-10 23:21:38 UTC (rev 4217) +++ trunk/matplotlib/setupext.py 2007-11-10 23:26:36 UTC (rev 4218) @@ -360,7 +360,7 @@ import pytz except ImportError: if hasdatetime and provide_pytz: - print_status("pytz", "mpl-provided") + print_status("pytz", "matplotlib will provide") return True else: print_status("pytz", "no") @@ -374,7 +374,7 @@ import dateutil except ImportError: if hasdatetime and provide_dateutil: - print_status("dateutil", "mpl-provided") + print_status("dateutil", "matplotlib will provide") return True else: print_status("dateutil", "no") @@ -391,7 +391,7 @@ import configobj except ImportError: if provide_configobj: - print_status("configobj", "mpl-provided") + print_status("configobj", "matplotlib will provide") return True else: print_status("configobj", "no") @@ -410,14 +410,14 @@ return False else: if version.version.endswith('mpl'): - print_status("enthought.traits", "mpl-provided") + print_status("enthought.traits", "matplotlib will provide") return True else: print_status("enthought.traits", version.version) return False except ImportError: if provide_traits: - print_status("enthought.traits", "mpl-provided") + print_status("enthought.traits", "matplotlib will provide") return True else: print_status("enthought.traits", "no") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:21:48
|
Revision: 4217 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4217&view=rev Author: dsdale Date: 2007-11-10 15:21:38 -0800 (Sat, 10 Nov 2007) Log Message: ----------- moved setup.cfg to setup.cfg.template, so local modifications can be made without affecting the trunk Added Paths: ----------- trunk/matplotlib/setup.cfg.template Removed Paths: ------------- trunk/matplotlib/setup.cfg Deleted: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 23:20:44 UTC (rev 4216) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:21:38 UTC (rev 4217) @@ -1,24 +0,0 @@ -# Rename this file to setup.cfg to modify matplotlib's -# build options. - -[egg_info] -tag_svn_revision = 1 - -[status] -# To suppress display of the dependencies and their versions -# at the top of the build log, uncomment the following line: -# -#suppress = True - -[provide_packages] -# by default, matplotlib checks for a few dependencies and -# installs them if missing. This feature can be turned off -# by uncommenting the following lines: -# -## date/timezone support: -#pytz = False -#dateutil = False -# -## experimental config package support: -#enthought.traits = False -#configobj = False Copied: trunk/matplotlib/setup.cfg.template (from rev 4216, trunk/matplotlib/setup.cfg) =================================================================== --- trunk/matplotlib/setup.cfg.template (rev 0) +++ trunk/matplotlib/setup.cfg.template 2007-11-10 23:21:38 UTC (rev 4217) @@ -0,0 +1,24 @@ +# Rename this file to setup.cfg to modify matplotlib's +# build options. + +[egg_info] +tag_svn_revision = 1 + +[status] +# To suppress display of the dependencies and their versions +# at the top of the build log, uncomment the following line: +# +#suppress = True + +[provide_packages] +# by default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines: +# +## date/timezone support: +#pytz = False +#dateutil = False +# +## experimental config package support: +#enthought.traits = False +#configobj = False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:20:55
|
Revision: 4216 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4216&view=rev Author: dsdale Date: 2007-11-10 15:20:44 -0800 (Sat, 10 Nov 2007) Log Message: ----------- dont use spaces in setup.cfg section names Modified Paths: -------------- trunk/matplotlib/setup.cfg trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 23:10:15 UTC (rev 4215) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:20:44 UTC (rev 4216) @@ -10,7 +10,7 @@ # #suppress = True -[provide packages] +[provide_packages] # by default, matplotlib checks for a few dependencies and # installs them if missing. This feature can be turned off # by uncommenting the following lines: Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-10 23:10:15 UTC (rev 4215) +++ trunk/matplotlib/setupext.py 2007-11-10 23:20:44 UTC (rev 4216) @@ -112,19 +112,19 @@ except: pass try: - provide_pytz = config.getboolean("provide packages", "pytz") + provide_pytz = config.getboolean("provide_packages", "pytz") except: pass try: - provide_dateutil = config.getboolean("provide packages", "dateutil") + provide_dateutil = config.getboolean("provide_packages", "dateutil") except: pass try: - provide_configobj = config.getboolean("provide packages", "configobj") + provide_configobj = config.getboolean("provide_packages", "configobj") except: pass try: - provide_traits = config.getboolean("provide packages", "enthought.traits") + provide_traits = config.getboolean("provide_packages", "enthought.traits") except: pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:10:33
|
Revision: 4215 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4215&view=rev Author: dsdale Date: 2007-11-10 15:10:15 -0800 (Sat, 10 Nov 2007) Log Message: ----------- added a comment in setup.cfg, will rename to setup.cfg.template Modified Paths: -------------- trunk/matplotlib/setup.cfg Modified: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 23:08:19 UTC (rev 4214) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:10:15 UTC (rev 4215) @@ -1,3 +1,6 @@ +# Rename this file to setup.cfg to modify matplotlib's +# build options. + [egg_info] tag_svn_revision = 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:08:40
|
Revision: 4214 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4214&view=rev Author: dsdale Date: 2007-11-10 15:08:19 -0800 (Sat, 10 Nov 2007) Log Message: ----------- added flags in setup.cfg to disable providing external packages like pytz and datetime Modified Paths: -------------- trunk/matplotlib/setup.cfg trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:08:19 UTC (rev 4214) @@ -4,4 +4,18 @@ [status] # To suppress display of the dependencies and their versions # at the top of the build log, uncomment the following line: -# suppress = 1 \ No newline at end of file +# +#suppress = True + +[provide packages] +# by default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines: +# +## date/timezone support: +#pytz = False +#dateutil = False +# +## experimental config package support: +#enthought.traits = False +#configobj = False Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setup.py 2007-11-10 23:08:19 UTC (rev 4214) @@ -13,10 +13,8 @@ rc = {'backend':'PS', 'numerix':'numpy'} -# build the image support module - requires agg and Numeric or -# numarray. You can build the image module with either Numeric or -# numarray or both. By default, matplotlib will build support for -# whatever array packages you have installed. +# build the image support module - requires agg. By default, matplotlib will +# build support for whatever array packages you have installed. BUILD_IMAGE = 1 # Build the antigrain geometry toolkit. Agg makes heavy use of @@ -82,9 +80,10 @@ build_subprocess, build_ttconv, print_line, print_status, print_message, \ print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \ check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, \ - check_for_cairo, check_for_traits, check_for_pytz, check_for_dateutil, \ - check_for_configobj, check_for_dvipng, check_for_ghostscript, \ - check_for_latex, check_for_pdftops, check_for_datetime + check_for_cairo, check_provide_traits, check_provide_pytz, \ + check_provide_dateutil, check_provide_configobj, check_for_dvipng, \ + check_for_ghostscript, check_for_latex, check_for_pdftops, \ + check_for_datetime #import distutils.sysconfig # jdh @@ -240,8 +239,8 @@ print_raw("OPTIONAL DATE/TIMEZONE DEPENDENCIES") hasdatetime = check_for_datetime() -hasdateutil = check_for_dateutil(hasdatetime) -haspytz = check_for_pytz(hasdatetime) +provide_dateutil = check_provide_dateutil(hasdatetime) +provide_pytz = check_provide_pytz(hasdatetime) if hasdatetime: # dates require python23 datetime # only install pytz and dateutil if the user hasn't got them @@ -272,8 +271,8 @@ add_dateutil() else: # only add them if we need them - if not haspytz: add_pytz() - if not hasdateutil: add_dateutil() + if provide_pytz: add_pytz() + if provide_dateutil: add_dateutil() print_raw("") print_raw("OPTIONAL USETEX DEPENDENCIES") @@ -285,8 +284,10 @@ # TODO: comment out for mpl release: print_raw("") print_raw("EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES") -if not check_for_configobj(): py_modules.append('configobj') -if not check_for_traits(): build_traits(ext_modules, packages) +if check_provide_configobj(): + py_modules.append('configobj') +if check_provide_traits(): + build_traits(ext_modules, packages) print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setupext.py 2007-11-10 23:08:19 UTC (rev 4214) @@ -98,16 +98,35 @@ numpy_inc_dirs = [] # Based on the contents of setup.cfg, determine if the status block -# should be displayed +# should be displayed, if missing external packages should be provided display_status = True +provide_pytz = True +provide_dateutil = True +provide_configobj = True +provide_traits = True if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() config.read("setup.cfg") try: - if config.get("status", "suppress"): - display_status = False + display_status = not config.getboolean("status", "suppress") except: pass + try: + provide_pytz = config.getboolean("provide packages", "pytz") + except: + pass + try: + provide_dateutil = config.getboolean("provide packages", "dateutil") + except: + pass + try: + provide_configobj = config.getboolean("provide packages", "configobj") + except: + pass + try: + provide_traits = config.getboolean("provide packages", "enthought.traits") + except: + pass if display_status: def print_line(char='='): @@ -336,57 +355,73 @@ print_status("datetime", "present, version unknown") return True -def check_for_pytz(hasdatetime=True): +def check_provide_pytz(hasdatetime=True): try: import pytz except ImportError: - if hasdatetime: print_status("pytz", "mpl-provided") - else: print_status("pytz", "no") - return False + if hasdatetime and provide_pytz: + print_status("pytz", "mpl-provided") + return True + else: + print_status("pytz", "no") + return False else: print_status("pytz", pytz.__version__) - return True + return False -def check_for_dateutil(hasdatetime=True): +def check_provide_dateutil(hasdatetime=True): try: import dateutil except ImportError: - if hasdatetime: print_status("dateutil", "mpl-provided") - else: print_status("dateutil", "no") - return False + if hasdatetime and provide_dateutil: + print_status("dateutil", "mpl-provided") + return True + else: + print_status("dateutil", "no") + return False else: try: print_status("dateutil", dateutil.__version__) except AttributeError: print_status("dateutil", "present, version unknown") - return True + return False -def check_for_configobj(): +def check_provide_configobj(): try: import configobj except ImportError: - print_status("configobj", "mpl-provided") - return False + if provide_configobj: + print_status("configobj", "mpl-provided") + return True + else: + print_status("configobj", "no") + return False else: print_status("configobj", configobj.__version__) - return True + return False -def check_for_traits(): - gotit = False +def check_provide_traits(): try: from enthought import traits - gotit = True try: from enthought.traits import version except: print_status("enthought.traits", "unknown and incompatible version: < 2.0") - return gotit + return False else: - if version.version.endswith('mpl'): gotit = False - print_status("enthought.traits", version.version) + if version.version.endswith('mpl'): + print_status("enthought.traits", "mpl-provided") + return True + else: + print_status("enthought.traits", version.version) + return False except ImportError: - print_status("enthought.traits", "no") - return gotit + if provide_traits: + print_status("enthought.traits", "mpl-provided") + return True + else: + print_status("enthought.traits", "no") + return False def check_for_dvipng(): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-10 22:41:52
|
Revision: 4213 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4213&view=rev Author: jswhit Date: 2007-11-10 14:41:51 -0800 (Sat, 10 Nov 2007) Log Message: ----------- add back in accidentally deleted line Modified Paths: -------------- trunk/toolkits/basemap-testing/setup.py Modified: trunk/toolkits/basemap-testing/setup.py =================================================================== --- trunk/toolkits/basemap-testing/setup.py 2007-11-10 20:42:39 UTC (rev 4212) +++ trunk/toolkits/basemap-testing/setup.py 2007-11-10 22:41:51 UTC (rev 4213) @@ -74,6 +74,7 @@ boundaryfiles = [] for resolution in ['c','l','i','h']: boundaryfiles = boundaryfiles + glob.glob("lib/matplotlib/toolkits/basemap/data/*_"+resolution+".dat") +boundaryfiles = [os.path.join('data',os.path.basename(bfile)) for bfile in boundaryfiles] basemap_datafiles = boundaryfiles + ['data/5minmask.bin'] package_data = {'matplotlib.toolkits.basemap':pyproj_datafiles+basemap_datafiles} setup( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-11-10 20:42:40
|
Revision: 4212 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4212&view=rev Author: jswhit Date: 2007-11-10 12:42:39 -0800 (Sat, 10 Nov 2007) Log Message: ----------- obsolete Removed Paths: ------------- trunk/toolkits/basemap-testing/utils/dumpcoast.sh Deleted: trunk/toolkits/basemap-testing/utils/dumpcoast.sh =================================================================== --- trunk/toolkits/basemap-testing/utils/dumpcoast.sh 2007-11-10 18:24:23 UTC (rev 4211) +++ trunk/toolkits/basemap-testing/utils/dumpcoast.sh 2007-11-10 20:42:39 UTC (rev 4212) @@ -1,2 +0,0 @@ -#!/bin/csh -pscoast -M -Dl -R0.001/360/-90/90 -JQ180/4.5i -A5000 -W >! GMT_coastlines.txt This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |