[matplotlib-devel] new colormap
Hi All, As part of nipy[1] we have a spectral colormap which we use and would like to include it upstream as part of matplotlib. I'm working on a patch but before I submit it, I need some advice on how boilerplate.py should be used. I've made the required additions to _cm.py, pylab.py and boilerplate.py and when I run boilerplate.py it generates a spectral() function as it does for all the other colormaps. My question is, how should the output of boilerplate.py be included into pylab.py? Should I just cut and paste the output, or is there some automagic tool for doing it? Cheers, Tim Leslie [1] http://neuroimaging.scipy.org/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] segfault in dynamic_demo.py
When running examples/dynamic_demo I get a segfault with the following backtrace. Does anyone have any thoughts on what might be causing this? I'm using python 2.4 .4c1 and the latest svn version of mpl/numpy/scipy. Cheers, Tim #0 0x004be54f in PyFrame_New () #1 0x00476004 in PyEval_EvalCodeEx () #2 0x004bf233 in PyClassMethod_New () #3 0x00413bf0 in PyObject_Call () #4 0x0046faf1 in PyEval_CallObjectWithKeywords () #5 0x2b041ffb412f in init_gobject () from /var/lib/python-support/python2.4/gtk-2.0/gobject/_gobject.so #6 0x2b042035218b in g_source_get_current_time () from /usr/lib/libglib-2.0.so.0 #7 0x2b0420351c84 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #8 0x2b0420354acd in g_main_context_check () from /usr/lib/libglib-2.0.so.0 #9 0x2b0420354dda in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #10 0x2b0420a645f3 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 #11 0x2b04295fb601 in wxEventLoop::Run () from /usr/lib/libwx_gtk2u_core-2.6.so.0 #12 0x2b042968411b in wxAppBase::MainLoop () from /usr/lib/libwx_gtk2u_core-2.6.so.0 #13 0x2b0428c88487 in wxPyApp::MainLoop () from /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core_.so #14 0x2b0428ce928f in wxPyFileSystemHandler::FindFirst () from /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core_.so #15 0x00413bf0 in PyObject_Call () #16 0x00473fd0 in PyEval_EvalFrame () #17 0x004767d6 in PyEval_EvalCodeEx () #18 0x004bf233 in PyClassMethod_New () #19 0x00413bf0 in PyObject_Call () #20 0x00419930 in PyClass_IsSubclass () #21 0x00413bf0 in PyObject_Call () #22 0x00472619 in PyEval_EvalFrame () #23 0x00475546 in PyEval_EvalFrame () #24 0x004767d6 in PyEval_EvalCodeEx () #25 0x00474a5a in PyEval_EvalFrame () #26 0x004767d6 in PyEval_EvalCodeEx () #27 0x00476882 in PyEval_EvalCode () #28 0x0049b1e2 in PyRun_FileExFlags () #29 0x0049b3e0 in PyRun_SimpleFileExFlags () #30 0x00410b9a in Py_Main () #31 0x2b041fd400c4 in __libc_start_main () from /lib/libc.so.6 #32 0x00410079 in _start () - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] new colormap
> "Tim" == Tim Leslie <[EMAIL PROTECTED]> writes: Tim> colormaps. My question is, how should the output of Tim> boilerplate.py be included into pylab.py? Should I just cut Tim> and paste the output, or is there some automagic tool for Tim> doing it? Yep, just cut the stuff below ### Do not edit below this point and paste in the boilerplate output. JDH - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] segfault in dynamic_demo.py
> "Tim" == Tim Leslie <[EMAIL PROTECTED]> writes: Tim> When running examples/dynamic_demo I get a segfault with the Tim> following backtrace. Does anyone have any thoughts on what Tim> might be causing this? I'm using python 2.4 .4c1 and the Tim> latest svn version of mpl/numpy/scipy. Look at the first few lines of dynamic_demo.py #!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk It is using gtk explicitly. Your output indicates you are using ewx Tim> wxEventLoop::Run () from /usr/lib/libwx_gtk2u_core-2.6.so.0 Tim> #12 0x2b042968411b in wxAppBase::MainLoop () from Tim> /usr/lib/libwx_gtk2u_core-2.6.so.0 #13 0x2b0428c88487 in Tim> wxPyApp::MainLoop () from Tim> /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core_.so Tim> #14 0x2b0428ce928f in wxPyFileSystemHandler::FindFirst () Maybe you are mixing backends and GUI mainloops. Make sure your backend and GUI agree -- eg examples/dynamic_demo_wx.py JDH - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] new colormap
On 12/20/06, John Hunter <[EMAIL PROTECTED]> wrote: > "Tim" == Tim Leslie <[EMAIL PROTECTED]> writes: Tim> colormaps. My question is, how should the output of Tim> boilerplate.py be included into pylab.py? Should I just cut Tim> and paste the output, or is there some automagic tool for Tim> doing it? Yep, just cut the stuff below ### Do not edit below this point and paste in the boilerplate output. Thanks, that all seems to have worked fine. I've attached the patch with this email. John, I was wondering if I have svn write access. I seem to recall I had it a year or two ago, but I can't find any evidence to back this up, so maybe I'm mistaken. Could you check for me? Cheers, Tim JDH Index: lib/matplotlib/_cm.py === --- lib/matplotlib/_cm.py (revision 2941) +++ lib/matplotlib/_cm.py (working copy) @@ -14,6 +14,7 @@ + _bone_data = {'red': ((0., 0., 0.),(1.0, 1.0, 1.0)), 'green': ((0., 0., 0.),(1.0, 1.0, 1.0)), 'blue': ((0., 0., 0.),(1.0, 1.0, 1.0))} @@ -338,6 +339,41 @@ 'green': ((0., 0., 0.),(1.0, 1.0, 1.0)), 'blue': ((0., 1., 1.),(1.0, 0.5, 0.5))} +_spectral_data = {'red': [(0.0, 0.0, 0.0), (0.05, 0.4667, 0.4667), + (0.10, 0.5333, 0.5333), (0.15, 0.0, 0.0), + (0.20, 0.0, 0.0), (0.25, 0.0, 0.0), + (0.30, 0.0, 0.0), (0.35, 0.0, 0.0), + (0.40, 0.0, 0.0), (0.45, 0.0, 0.0), + (0.50, 0.0, 0.0), (0.55, 0.0, 0.0), + (0.60, 0.0, 0.0), (0.65, 0.7333, 0.7333), + (0.70, 0.9333, 0.9333), (0.75, 1.0, 1.0), + (0.80, 1.0, 1.0), (0.85, 1.0, 1.0), + (0.90, 0.8667, 0.8667), (0.95, 0.80, 0.80), + (1.0, 0.80, 0.80)], + 'green': [(0.0, 0.0, 0.0), (0.05, 0.0, 0.0), +(0.10, 0.0, 0.0), (0.15, 0.0, 0.0), +(0.20, 0.0, 0.0), (0.25, 0.4667, 0.4667), +(0.30, 0.6000, 0.6000), (0.35, 0.6667, 0.6667), +(0.40, 0.6667, 0.6667), (0.45, 0.6000, 0.6000), +(0.50, 0.7333, 0.7333), (0.55, 0.8667, 0.8667), +(0.60, 1.0, 1.0), (0.65, 1.0, 1.0), +(0.70, 0.9333, 0.9333), (0.75, 0.8000, 0.8000), +(0.80, 0.6000, 0.6000), (0.85, 0.0, 0.0), +(0.90, 0.0, 0.0), (0.95, 0.0, 0.0), +(1.0, 0.80, 0.80)], + 'blue': [(0.0, 0.0, 0.0), (0.05, 0.5333, 0.5333), + (0.10, 0.6000, 0.6000), (0.15, 0.6667, 0.6667), + (0.20, 0.8667, 0.8667), (0.25, 0.8667, 0.8667), + (0.30, 0.8667, 0.8667), (0.35, 0.6667, 0.6667), + (0.40, 0.5333, 0.5333), (0.45, 0.0, 0.0), + (0.5, 0.0, 0.0), (0.55, 0.0, 0.0), + (0.60, 0.0, 0.0), (0.65, 0.0, 0.0), + (0.70, 0.0, 0.0), (0.75, 0.0, 0.0), + (0.80, 0.0, 0.0), (0.85, 0.0, 0.0), + (0.90, 0.0, 0.0), (0.95, 0.0, 0.0), + (1.0, 0.80, 0.80)]} + + autumn = colors.LinearSegmentedColormap('autumn', _autumn_data, LUTSIZE) bone = colors.LinearSegmentedColormap('bone ', _bone_data, LUTSIZE) cool = colors.LinearSegmentedColormap('cool', _cool_data, LUTSIZE) @@ -352,10 +388,10 @@ spring = colors.LinearSegmentedColormap('spring', _spring_data, LUTSIZE) summer = colors.LinearSegmentedColormap('summer', _summer_data, LUTSIZE) winter = colors.LinearSegmentedColormap('winter', _winter_data, LUTSIZE) +spectral = colors.LinearSegmentedColormap('spectral', _spectral_data, LUTSIZE) - datad = { 'autumn': _autumn_data, 'bone': _bone_data, @@ -370,7 +406,8 @@ 'prism': _prism_data, 'spring': _spring_data, 'summer': _summer_data, -'winter': _winter_data +'winter': _winter_data, +'spectral': _spectral_data } # 34 colormaps based on color specifications and designs Index: lib/matplotlib/pylab.py === --- lib/matplotlib/pylab.py (revision 2941) +++ lib/matplotlib/pylab.py (working copy) @@ -102,6 +102,7 @@ spring - set the default colormap to spring summer - set the default colormap to summer winter - set the default colormap to winter + spectral - set the default colormap to spectral _Event handling @@ -513,6 +514,7 @@ spring - set the default colormap to spring summer - set the default colormap to summer winter - set the default colormap to winter +spectral - set the default colormap to spectral """ pass @@ -522,7 +524,7
Re: [matplotlib-devel] new colormap
> "Tim" == Tim Leslie <[EMAIL PROTECTED]> writes: Tim> John, I was wondering if I have svn write access. I seem to Tim> recall I had it a year or two ago, but I can't find any Tim> evidence to back this up, so maybe I'm mistaken. Could you Tim> check for me? I don't see you on the devel list. A few months ago I purged everyone who had not made a commit in a year or so and maybe you were removed then (and posted here to this effect). In general, I don't mind adding people and certainly welcome the relief of not having to manage patches, but the devel list had grown to long. Why don't we manage this submission through the existing devels, and if the patches become fast and furious, I'm more than happy to (re)add you. If your patch doesn't make it in within 48 hours please post here with a complaint. JKDH - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] new colormap
> "John" == John Hunter <[EMAIL PROTECTED]> writes: John> If your patch doesn't make it in within 48 hours please post John> here with a complaint. OK, I committed it. In addition to the files you modified, you should consider CHANGELOG and API_CHANGES. The former for non-trivial commits, the latter for API_CHANGES. With this commit, I made an entry to CHANGELOG. Many thanks, JDH - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel