[matplotlib-devel] mlab cohere_pairs patch

2009-08-11 Thread Ariel Rokem
Hi,

here is a suggested patch for mlab's cohere_pairs function. The old version
was broken, due to some outdated code.

Cheers,

Ariel

-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


mlab_cohere_pairs_patch.py
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-11 Thread Ariel Rokem
Hi -

I would like to do that, but now, after I grabbed the most recent svn from
main source and tried to build it (so that I can replicate the broken-ness
of the code) I get this:


ASR:matplotlib arokem$ python setup.py install

BUILDING MATPLOTLIB
matplotlib: 1.0.svn
python: 2.5.2 |EPD 4.0.30001| (r252:60911, Sep 19 2008,
12:00:24)  [GCC 4.0.1 (Apple Computer, Inc. build
5370)]
  platform: darwin

REQUIRED DEPENDENCIES
 numpy: 1.3.0.dev5972
 freetype2: 9.17.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.37
   Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
  wxPython: 2.8.7.1
* WxAgg extension not required for wxPython >= 2.8
  Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
   Mac OS X native: yes
Qt: no
   Qt4: Qt: 4.5.2, PyQt4: 4.5.2
 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.4
  pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
dvipng: 1.9
   ghostscript: 8.57
 latex: 3.141592

[Edit setup.cfg to suppress the above messages]



... lots more output to the shell - everything looks OK...

g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
-bundle -undefined dynamic_lookup
build/temp.macosx-10.3-i386-2.5/src/ft2font.o
build/temp.macosx-10.3-i386-2.5/src/mplutils.o
build/temp.macosx-10.3-i386-2.5/CXX/cxx_extensions.o
build/temp.macosx-10.3-i386-2.5/CXX/cxxsupport.o
build/temp.macosx-10.3-i386-2.5/CXX/IndirectPythonInterface.o
build/temp.macosx-10.3-i386-2.5/CXX/cxxextensions.o -L/opt/local/lib
-L/usr/local/lib -L/usr/lib -L/sw/lib -lfreetype -lz -lz -lstdc++ -lm -o
build/lib.macosx-10.3-i386-2.5/matplotlib/ft2font.so
-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libxml2.2.dylib, file
is not of required architecture for architecture ppc
collect2: ld returned 1 exit status
ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/Qb/QbU9SmFNHoWnC7v-nTJYrE+++TI/-Tmp-//ccuiy1nA.out (No such
file or directory)
error: command 'g++' failed with exit status 1

Am I doing something wrong? I promise to follow your instructions, if I can
make it work :-)

Thanks,

Ariel


On Tue, Aug 11, 2009 at 5:14 PM, John Hunter  wrote:

> On Tue, Aug 11, 2009 at 5:02 PM, Ariel Rokem wrote:
>
> > here is a suggested patch for mlab's cohere_pairs function. The old
> version
> > was broken, due to some outdated code.
>
> Thanks Ariel for the patch.  Could you explain your patch in words --
> what was broken before and how you fixed it.  Also, while your patch
> is particularly simple, since it is just a single function
> replacement, we encourage people to submit svn diffs against HEAD or
> the branch they are patching.  It just makes life simpler for us,
> since we (fortunately) get a lot of contributions.  I strongly
> encourage people to include a complete, free-standing example that I
> can run unmodified  which shows the undesired behavior pre-patch and
> the desired behavior post-patch, with a clear verbal of what to look
> for.  I wrote this function 5 years ago, and while I remember it
> pretty well, I will not be as familiar with it after such a long
> hiatus as you are now.
>
> http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto
>
> JDH
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-11 Thread Ariel Rokem
Resending, with CC to list.

Thanks for the help! Nightmare of the living crash-test dummy...

I tried following your instructions. Here's what that looks like:

ASR:matplotlib arokem$ make build_os105
make: *** No rule to make target `build_os105'.  Stop.
ASR:matplotlib arokem$ cd release/osx
ASR:osx arokem$ open README.txt

I read the README - decide to skip reinstalling python and numpy, and
skipped to the next step ...

ASR:osx arokem$  unset PKG_CONFIG_PATH
ASR:osx arokem$ make fetch_deps dependencies
make: *** No rule to make target `fetch_deps'.  Stop.
ASR:osx arokem$ make fetch
wget http://www.zlib.net/zlib-1.2.3.tar.gz &&\
wget
http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.33.tar.bz2&&\
wget
http://download.savannah.gnu.org/releases/freetype/freetype-2.3.7.tar.bz2&&\
wget
http://pypi.python.org/packages/source/b/bdist_mpkg/bdist_mpkg-0.4.4.tar.gz&&;
\
tar xvfz bdist_mpkg-0.4.4.tar.gz &&\
echo "You need to to install bdist_mpkg-0.4.4 now"
/bin/sh: wget: command not found
make: *** [fetch] Error 127

I googled "wget" - downloaded wget source-code, installed wget.

ASR:osx arokem$ make fetch

seemed to work now, after fetch got everything, I continued with the crib
sheet from the README.txt (which has an error in it, the 6th step there is
'cd ..'. That didn't work - instead I ran 'make deps' in the directory I
previously ended up in '/release/osx/', that worked)
Finally:

ASR:osx arokem$ make installers
unset PKG_CONFIG_PATH &&\
tar xvfz matplotlib-0.99.0.tar.gz && \
cd matplotlib-0.99.0 && \
rm -rf build && \
cp ../data/setup.cfg ../data/ReadMe.txt . &&\
export CFLAGS="-Os -arch ppc -arch i386
-I/Users/arokem/source/matplotlib/release/osx/zlib-1.2.3
-I/Users/arokem/source/matplotlib/release/osx/libpng-1.2.33
-I/Users/arokem/source/matplotlib/release/osx/freetype-2.3.7/include" &&\
export LDFLAGS="-arch ppc -arch i386
-L/Users/arokem/source/matplotlib/release/osx/zlib-1.2.3
-L/Users/arokem/source/matplotlib/release/osx/libpng-1.2.33
-L/Users/arokem/source/matplotlib/release/osx/freetype-2.3.7" &&\
/Library/Frameworks/Python.framework/Versions/2.6/bin/bdist_mpkg
--readme=ReadMe.txt &&\
hdiutil create -srcdir dist/matplotlib-0.99.0-py2.6-macosx10.5.mpkg
dist/matplotlib-0.99.0-py2.6-macosx10.5.dmg &&\
python2.6 setupegg.py bdist_egg
tar (child): matplotlib-0.99.0.tar.gz: Cannot open: No such file or
directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
make: *** [installers] Error 2

But the version number I have here is matplotlib-1.0.svn (is that what I am
supposed to have? I grabbed the svn as instructed on the webpage you linked
to before), so I go and edit the Makefile, to reflect that. I run that
again, it does a lot of stuff (I have the full output saved, if you want to
see that). Then, finally:

g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -bundle
-undefined dynamic_lookup -arch ppc -arch i386
-L/Users/arokem/source/matplotlib/release/osx/zlib-1.2.3
-L/Users/arokem/source/matplotlib/release/osx/libpng-1.2.33
-L/Users/arokem/source/matplotlib/release/osx/freetype-2.3.7 -Os -arch ppc
-arch i386 -I/Users/arokem/source/matplotlib/release/osx/zlib-1.2.3
-I/Users/arokem/source/matplotlib/release/osx/libpng-1.2.33
-I/Users/arokem/source/matplotlib/release/osx/freetype-2.3.7/include
build/temp.macosx-10.3-fat-2.5/src/ft2font.o
build/temp.macosx-10.3-fat-2.5/src/mplutils.o
build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o
build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o
build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o
build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/opt/local/lib
-L/usr/local/lib -L/usr/lib -L/sw/lib -lfreetype -lz -lz -lstdc++ -lm -o
build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required
architecture
ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libxml2.2.dylib, file
is not of required architecture for architecture ppc
collect2: ld returned 1 exit status
ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/Qb/QbU9SmFNHoWnC7v-nTJYrE+++TI/-Tmp-//ccp3hmVy.out (No such
file or directory)
error: command 'g++' failed with exit status 1
make: *** [installers] Error 1

So - I am back to square 1, it seems. Do you know where I should go from
here?

Cheers,

Ariel


On Tue, Aug 11, 2009 at 6:37 PM, John Hunter  wrote:

> On Tue, Aug 11, 2009 at 8:29 PM, Ariel Rokem wrote:
>
> > Am I doing something wrong? I promise

Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-12 Thread Ariel Rokem
ate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/Qb/QbU9SmFNHoWnC7v-nTJYrE+++TI/-Tmp-//ccud2g4d.out (No such
file or directory)
error: command 'g++' failed with exit status 1
make: *** [installers] Error 1

Any ideas?

Cheers,

Ariel



On Wed, Aug 12, 2009 at 3:42 AM, John Hunter  wrote:

> On Wed, Aug 12, 2009 at 2:26 AM, Fernando Perez
> wrote:
>
> > By the way John, in this particular case, I don't think the change
> > warrants a before/after example, because the before case is "it
> > doesn't run" :)  The code today makes calls to Numeric routines like
> > typecode() that simply don't exist anymore, so it's totally broken:
>
> Great -- this is just the kind of explanation I need. Though if we had
> an example, it is unlikely that the code would go so long w/o being
> exercised.  We do supply some eeg data with mpl -- see
> examples/pylab_examples/mri_with_eeg.py, so Ariel may want to write a
> simple cohere_pairs examples which just generates a scatter plot or
> something else to show the output and then we can include it in
> backend driver do it is will be unlikely to suffer bit rot going
> forward.
>
> > Ariel, if you are still struggling with the binary build, since your
> > changes are confined to a pure python file, you can submit the patch
> > by simply running:
> >
> > - svn udpate
> > - modify in-place mlab.py with your version of cohere_pairs
> > - svn diff > mlab_cohere_pairs.diff
>
> udpate = update
>
> That will be fine -- I would like to help Ariel get his svn build
> going, but if that is a distraction it doesn't need to slow the patch
> down.  For bugfixes we encourage patches against the release branch
>
>  svn co
> https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint
> mpl99<https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint%0Ampl99>
>
> JDH
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-12 Thread Ariel Rokem
Hi again - a string of strange things just happened. After this recent chain
of failures, I decided to try to do some random attempts at making this
work.

First, I ran 'sudo python setup.py install' in the directory into which I
had checked out the mpl source. After going through all of the above, that
now went without a hitch(?!). I started ipython and imported matplotlib, but
was disappointed to see that I was still importing 0.98.3, which is the
version I previously had.

I then ran:

ASR:~ arokem$ easy_install matplotlib
Searching for matplotlib
Best match: matplotlib 0.99.0
Removing matplotlib 0.98.3.0001 from easy-install.pth file
Adding matplotlib 0.99.0 to easy-install.pth file

Using
/Library/Frameworks/Python.framework/Versions/4.0.30001/lib/python2.5/site-packages
Processing dependencies for matplotlib
Finished processing dependencies for matplotlib

Now, when I open ipython and import matplotlib, the version I have is 0.99,
and it seems to work (opens plots and such). So - somehow the process
worked, but how?

Cheers,

Ariel



On Wed, Aug 12, 2009 at 10:08 AM, Ariel Rokem  wrote:

> Hi Fernando and John,
>
> regardless of the clunky way in which I was trying to introduce our patch,
> I still want to be able to build MPL from source on my machine. It is a
> distraction, but, hey, it's a distraction on top of a distraction on top of
> a distraction, so at this point, I might as well be distracted. Besides, it
> should end up being useful, and not only for me. Yesterday, there was
> someone on the matplotlib-users list with exactly the same problem in
> building MPL from source (sourceforge is not responding at the moment, so I
> can't post a link to that message). If this is not a good time to
> trouble-shoot this, let me know and we can come back to this in a couple of
> weeks. It does seem like cohere_pairs has not gotten a lot of use, so the
> patch can also languish for another couple of weeks andI can get stuff done
> regardless of solving this problem, but I would love to be able to solve
> this, with your help.
>
> So - I now checked out 0.99, running 'make build_osx105' (you do realize
> the 'x' stands for '10', don't you?) didn't work, so I followed the
> instructions in source/osx/README
>
> I still get exactly the same error as before:
>
> g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -bundle
> -undefined dynamic_lookup -arch ppc -arch i386
> -L/Users/arokem/source/mpl99/release/osx/zlib-1.2.3
> -L/Users/arokem/source/mpl99/release/osx/libpng-1.2.33
> -L/Users/arokem/source/mpl99/release/osx/freetype-2.3.7 -Os -arch ppc -arch
> i386 -I/Users/arokem/source/mpl99/release/osx/zlib-1.2.3
> -I/Users/arokem/source/mpl99/release/osx/libpng-1.2.33
> -I/Users/arokem/source/mpl99/release/osx/freetype-2.3.7/include
> build/temp.macosx-10.3-fat-2.5/src/ft2font.o
> build/temp.macosx-10.3-fat-2.5/src/mplutils.o
> build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o
> build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o
> build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o
> build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/opt/local/lib
> -L/usr/local/lib -L/usr/lib -L/sw/lib -lfreetype -lz -lz -lstdc++ -lm -o
> build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
> -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
> ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
> architecture
> ld warning: in /opt/local/lib/libz.dylib, file is not of required
> architecture
> ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libxml2.2.dylib, file
> is not of required architecture for architecture ppc
> collect2: ld returned 1 exit status
> ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
> lipo: can't open input file:
> /var/folders/Qb/QbU9SmFNHoWnC7v-nTJYrE+++TI/-Tmp-//cceiN12W.out (No such
> file or directory)
> error: command 'g++' failed with exit status 1
> make: *** [installers] Error 1
>
> So - there is still some problem with the architecture. BTW - this closely
> resembles errors I used to get when trying to install ETS, but in the recent
> release of ETS,  this problem seems to have been solved. Here's something
> from enthought-dev, in that direction:
> https://mail.enthought.com/pipermail/enthought-dev/2009-June/022153.html
>
> I tried following Robert Kern's suggestion and edited
> /Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/config/Makefile
> in order to remove the '-arch ppc' flag from the CFLAGS and LDFLAGS
> variables, and from one other place in that file, but that didn't seem to
> help. Even though now g++ is called without the possibly offending '-arch
> ppc' flag, somethow that flag is ge

Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-12 Thread Ariel Rokem
Hi - scratch that. Only *seems* to be working. Actually it hangs when I run
scripts that open figures. I am going to undo all this and forget I ever
started down this path.

Cheers,

Ariel

On Wed, Aug 12, 2009 at 11:10 AM, Ariel Rokem  wrote:

> Hi again - a string of strange things just happened. After this recent
> chain of failures, I decided to try to do some random attempts at making
> this work.
>
> First, I ran 'sudo python setup.py install' in the directory into which I
> had checked out the mpl source. After going through all of the above, that
> now went without a hitch(?!). I started ipython and imported matplotlib, but
> was disappointed to see that I was still importing 0.98.3, which is the
> version I previously had.
>
> I then ran:
>
> ASR:~ arokem$ easy_install matplotlib
> Searching for matplotlib
> Best match: matplotlib 0.99.0
> Removing matplotlib 0.98.3.0001 from easy-install.pth file
> Adding matplotlib 0.99.0 to easy-install.pth file
>
> Using
> /Library/Frameworks/Python.framework/Versions/4.0.30001/lib/python2.5/site-packages
> Processing dependencies for matplotlib
> Finished processing dependencies for matplotlib
>
> Now, when I open ipython and import matplotlib, the version I have is 0.99,
> and it seems to work (opens plots and such). So - somehow the process
> worked, but how?
>
> Cheers,
>
> Ariel
>
>
>
> On Wed, Aug 12, 2009 at 10:08 AM, Ariel Rokem  wrote:
>
>> Hi Fernando and John,
>>
>> regardless of the clunky way in which I was trying to introduce our patch,
>> I still want to be able to build MPL from source on my machine. It is a
>> distraction, but, hey, it's a distraction on top of a distraction on top of
>> a distraction, so at this point, I might as well be distracted. Besides, it
>> should end up being useful, and not only for me. Yesterday, there was
>> someone on the matplotlib-users list with exactly the same problem in
>> building MPL from source (sourceforge is not responding at the moment, so I
>> can't post a link to that message). If this is not a good time to
>> trouble-shoot this, let me know and we can come back to this in a couple of
>> weeks. It does seem like cohere_pairs has not gotten a lot of use, so the
>> patch can also languish for another couple of weeks andI can get stuff done
>> regardless of solving this problem, but I would love to be able to solve
>> this, with your help.
>>
>> So - I now checked out 0.99, running 'make build_osx105' (you do realize
>> the 'x' stands for '10', don't you?) didn't work, so I followed the
>> instructions in source/osx/README
>>
>> I still get exactly the same error as before:
>>
>> g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -bundle
>> -undefined dynamic_lookup -arch ppc -arch i386
>> -L/Users/arokem/source/mpl99/release/osx/zlib-1.2.3
>> -L/Users/arokem/source/mpl99/release/osx/libpng-1.2.33
>> -L/Users/arokem/source/mpl99/release/osx/freetype-2.3.7 -Os -arch ppc -arch
>> i386 -I/Users/arokem/source/mpl99/release/osx/zlib-1.2.3
>> -I/Users/arokem/source/mpl99/release/osx/libpng-1.2.33
>> -I/Users/arokem/source/mpl99/release/osx/freetype-2.3.7/include
>> build/temp.macosx-10.3-fat-2.5/src/ft2font.o
>> build/temp.macosx-10.3-fat-2.5/src/mplutils.o
>> build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o
>> build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o
>> build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o
>> build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/opt/local/lib
>> -L/usr/local/lib -L/usr/lib -L/sw/lib -lfreetype -lz -lz -lstdc++ -lm -o
>> build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
>> -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
>> ld warning: in /opt/local/lib/libfreetype.dylib, file is not of required
>> architecture
>> ld warning: in /opt/local/lib/libz.dylib, file is not of required
>> architecture
>> ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libxml2.2.dylib, file
>> is not of required architecture for architecture ppc
>> collect2: ld returned 1 exit status
>> ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
>> lipo: can't open input file:
>> /var/folders/Qb/QbU9SmFNHoWnC7v-nTJYrE+++TI/-Tmp-//cceiN12W.out (No such
>> file or directory)
>> error: command 'g++' failed with exit status 1
>> make: *** [installers] Error 1
>>
>> So - there is still some problem with the architecture. BTW - this closely
>> resembles errors I used to get when trying to install ETS, but in the recent
>> release of ETS,  this

Re: [matplotlib-devel] Building matplotlib on os x

2009-08-13 Thread Ariel Rokem
Resending with CC to list:

D'oh. I forgot to do that. OK - now I went back and ran:

env ARCHFLAGS='-arch i386' python setup.py install

That also went with no hitches

Then, in Python:

>>> import matplotlib
>>> matplotlib.__version__
'0.98.5.2'

So - still no version update. I ran:

'easy_install matplotlib', which somehow seems to change the path
setting to find the most recent version of things (maybe someone here
can tell me how this happens?) now:

>>> import matplotlib
>>> matplotlib.__version__
'0.99.0'

However, now, when I run a script that has plotting in it, in ipython,
the script hangs after plotting. That is, it puts up the first figure
in the script (a simple bar graph) and then doesn't do anything more.
So - on the one hand, it doesn't crash while building and installing.
On the other hand, it doesn't work.

Cheers,

Ariel

On Thu, Aug 13, 2009 at 5:19 AM, Jeff Whitaker wrote:
> Ariel Rokem wrote:
>>
>> Hi - that's interesting - I am actually on OS10.5. For some reason,
>> the MPL libraries get built under a directory called
>> "lib.macosx-10.3-fat-2.5" and the SDK set in the Python Makefile is
>> /Developer/SDKs/MacOSX10.4u.sdk, which is why you see these mentioned
>> in the output.
>>
>> Wondering if that is the cause of the problems, I reset the SDK in the
>> Makefile to /Developer/SDKs/MacOSX10.5.sdk (in the definition of
>> BASECFLAGS, as well as LDFLAGS). As before, I removed the '-arch ppc'
>> (from these two places, as well) and ran 'env ARCHFLAGS='-arch i386'
>> python setup.py build'
>>
>> This time I don't get any compilation errors at all. It just runs
>> through. However, when I import matplotlib in python, I still get:
>>
>
> Ariel:  Did you run 'python setup.py install'?
>
> -Jeff
>
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Building matplotlib on os x

2009-08-13 Thread Ariel Rokem
Hi Jeff,

> import matplotlib
> matplotlib.__version__
>
>>
>> '0.98.5.2'
>>
>
> Ariel:  This tells me you really didn't install it, or you installed it in a
> different version of python than you are trying to import it with.

That does sound reasonable - but how do you explain what followed?

>> So - still no version update. I ran:
>>
>> 'easy_install matplotlib', which somehow seems to change the path
>> setting to find the most recent version of things (maybe someone here
>> can tell me how this happens?) now:
>>
>>
>
> import matplotlib
> matplotlib.__version__
>
>>
>> '0.99.0'



> We'll need more details on this one - a simple script that triggers it and
> what backend you're using, for starters.
>

Here's a simple script that triggers this behavior:

from matplotlib import pylab
pylab.plot([0,1])
pylab.show()

When I run that from ipython, it hangs and doesn't respond to attempts
to keyboard interrupt.

When I run it from the terminal it also hangs, running it with
--verbose-helpful, I get:

backend MacOSX version unknown

Is there another way to figure out which backend is being used?

Cheers,

Ariel

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Building matplotlib on os x

2009-08-13 Thread Ariel Rokem
Hi Jeff,


>
> You are using the macosx backend.  Can you try another backend, say TkAgg,
> by running:
>
> python test.py -dTkAgg ??
>
> -Jeff


tried that as well - it doesn't plot and produces the following traceback:

ASR:Desktop arokem$ python example.py -dTkAgg
Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/lib-tk/Tkinter.py",
line 1414, in __call__
return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 212, in resize
self.show()
  File 
"/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 216, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
  File 
"/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib/backends/tkagg.py",
line 19, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
id(bbox_array))
TclError

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Building matplotlib on os x

2009-08-13 Thread Ariel Rokem
Hi - it was something to do with that. When I now *add*:

./matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg,

which was the version that EPD instaled, to easy-install.pth, I get
back version 0.98.5


On Thu, Aug 13, 2009 at 9:25 AM, Gael
Varoquaux wrote:
> On Thu, Aug 13, 2009 at 09:30:22AM -0600, Jeff Whitaker wrote:
>> Ariel Rokem wrote:
>> > Resending with CC to list:
>
>> > D'oh. I forgot to do that. OK - now I went back and ran:
>
>> > env ARCHFLAGS='-arch i386' python setup.py install
>
>> > That also went with no hitches
>
>> > Then, in Python:
>
>
>> >>>> import matplotlib
>> >>>> matplotlib.__version__
>
>> > '0.98.5.2'
>
>
>> Ariel:  This tells me you really didn't install it, or you installed it
>> in a different version of python than you are trying to import it with.
>
>> > So - still no version update. I ran:
>
>> > 'easy_install matplotlib', which somehow seems to change the path
>> > setting to find the most recent version of things (maybe someone here
>> > can tell me how this happens?) now:
>
>
> I am not sure that Ariel didn't install things right. He might be a
> victim of setuptools' monkey patching of sys.path. Ariel, you should go
> around in the various easy_install.pth in the different folder on you
> Python path (that is the system ones as well as the ones in your
> $PYTHONPATH) and make sure that any reference to matplotlib is removed.
>
> Gaël
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] building from SVN on Mac OS X 10.5

2009-08-22 Thread Ariel Rokem
Hi folks -

just to add to the noise. Here is what eventually worked for me (with
OS 10.5.8 and EPD 4.3), with help from Mike McKerns:

0. I removed the ~/.matplotlib folder ("rm -rf ~/.matplotlib").

1. I edited 
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/config/Makefile,
removing all occurrences of "-arch ppc" (3 occurrences), changing the
line "MACOSX_DEPLOYMENT_TARGET=10.3" to
"MACOSX_DEPLOYMENT_TARGET=10.5" and changing the occurrences of
"MacOSX10.54u.sdk" into "MacOSX10.5.sdk" (3 occurrences). Here is the
full diff:

60c60
< BASECFLAGS=   -arch i386 -isysroot MacOSX10.5.sdk -fno-strict-aliasing
-Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic
---
> BASECFLAGS=   -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk  
> -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd 
> -fno-common -dynamic
66c66
< LDFLAGS=  -arch i386 -isysroot MacOSX10.5.sdk -g -L/usr/local/lib
-L/Library/Frameworks/Python.framework/Versions/4.3.0/lib
---
> LDFLAGS=  -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk 
> -g -L/usr/local/lib -L/Library/Frameworks/Python.framework/Versions/4.3.0/lib
115c115
< UNIVERSALSDK=MacOSX10.5.sdk
---
> UNIVERSALSDK=/Developer/SDKs/MacOSX10.4u.sdk
123c123
< MACOSX_DEPLOYMENT_TARGET=10.5
---
> MACOSX_DEPLOYMENT_TARGET=10.3
405c405
<   $(CC) -o $(LDLIBRARY) -arch i386 -dynamiclib \
---
>   $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \

2.  In 
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/site-packages/easy-install.pth,
I commented out the line containing the directory in which the
previous version of MPL was installed
("./matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg", in my case). If
I don't do this, when I import matplotlib, it imports the previous
version I had of MPL and just ignores the new installation. This is a
setuptools problem, so if you didn't have setuptools, good for you and
ignore this.

3. I ran the attached shell-script ("sh ./install-matplotlib.sh"),
based on a script by Mike McKerns, in the directory in which I wanted
my source to be. This script sets some local variable (CFLAGS,
LDFLAGS, PKG_CONFIG_PATH, ARCHFLAGS), removes previous installations,
downloads the source, builds and installs it. The backend seems to be
set to MacOSX.

I would be happy if someone who's had similar problems to the ones I
have had could test this procedure and see if it works for them as
well.

Cheers,

Ariel


On Fri, Aug 21, 2009 at 9:15 AM, John Hunter wrote:
> On Fri, Aug 21, 2009 at 10:41 AM, Jouni K. Seppänen wrote:
>> Eric Bruning  writes:
>>
>>> ld warning: in 
>>> /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib,
>>> missing required architecture ppc in file
>>> ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib,
>>> missing required architecture ppc in file for architecture ppc
>>
>> Somehow your gcc is picking up libraries from /usr/local/lib, where you
>> have presumably installed an x86-only version of gcc (could be a side
>> effect of installing GNU Fortran). I don't know how to prevent that,
>> except perhaps by moving /usr/local away for the duration of the
>> compilation command, e.g.
>
> I think you should edit setupext.py and edit basedir directory, and
> remove all the /sw, /usr/local, etc from basedir in the 'darwin'
> entry, which reads:
>
> darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
>                '/usr', '/sw'],
>
> Then do a clean rebuild and see if that helps.
>
> JDH
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


install-matplotlib.sh
Description: Bourne shell script
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] building from SVN on Mac OS X 10.5

2009-08-22 Thread Ariel Rokem
Resending with CC to list:

Hi - here is the diff with the suggested addition to the documentation.

Cheers,

Ariel

On Sat, Aug 22, 2009 at 1:34 PM, John Hunter wrote:
> On Sat, Aug 22, 2009 at 2:48 PM, Ariel Rokem wrote:
>> Hi folks -
>>
>> just to add to the noise. Here is what eventually worked for me (with
>> OS 10.5.8 and EPD 4.3), with help from Mike McKerns:
>
> Hey guys, this is great.  Any chance I could twist your arm into
> writing this up as a ReST FAQ and updating your script to do an svn
> checkout instead of installing the last release.  I would like to post
> this on the FAQ on the website.
>
> JDH
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


mpl99doc_install_epd.diff
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-22 Thread Ariel Rokem
Hi -

so - now, almost two weeks later, I can finally install MPL from
source. On to submitting that patch.

Here's what I get with mlab.cohere_pairs, as it is currently:

In [1]: a=np.array([[1,2,3,4],[1,2,3,4]])

In [2]: b=([1,1],[0,0])

In [3]: mlab.cohere_pairs(a,b)
---
NameError Traceback (most recent call last)

/Users/arokem/ in ()

/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib/mlab.pyc
in cohere_pairs(X, ij, NFFT, Fs, detrend, window, noverlap,
preferSpeedOverMemory, progressCallback, returnPxx)
597 windowVals = window
598 else:
--> 599 windowVals = window(np.ones((NFFT,), typecode(X)))
600 ind = range(0, numRows-NFFT+1, NFFT-noverlap)
601 numSlices = len(ind)

NameError: global name 'typecode' is not defined

So - as Fernando mentioned above, it is looking for something that
doesn't exist anymore. With the patch (diff attached), this error no
longer occurs.

Cheers,

Ariel

On Wed, Aug 12, 2009 at 11:25 AM, Ariel Rokem wrote:
> Hi - scratch that. Only *seems* to be working. Actually it hangs when I run
> scripts that open figures. I am going to undo all this and forget I ever
> started down this path.
>
> Cheers,
>
> Ariel
>
> On Wed, Aug 12, 2009 at 11:10 AM, Ariel Rokem  wrote:
>>
>> Hi again - a string of strange things just happened. After this recent
>> chain of failures, I decided to try to do some random attempts at making
>> this work.
>>
>> First, I ran 'sudo python setup.py install' in the directory into which I
>> had checked out the mpl source. After going through all of the above, that
>> now went without a hitch(?!). I started ipython and imported matplotlib, but
>> was disappointed to see that I was still importing 0.98.3, which is the
>> version I previously had.
>>
>> I then ran:
>>
>> ASR:~ arokem$ easy_install matplotlib
>> Searching for matplotlib
>> Best match: matplotlib 0.99.0
>> Removing matplotlib 0.98.3.0001 from easy-install.pth file
>> Adding matplotlib 0.99.0 to easy-install.pth file
>>
>> Using
>> /Library/Frameworks/Python.framework/Versions/4.0.30001/lib/python2.5/site-packages
>> Processing dependencies for matplotlib
>> Finished processing dependencies for matplotlib
>>
>> Now, when I open ipython and import matplotlib, the version I have is
>> 0.99, and it seems to work (opens plots and such). So - somehow the process
>> worked, but how?
>>
>> Cheers,
>>
>> Ariel
>>
>>
>>
>> On Wed, Aug 12, 2009 at 10:08 AM, Ariel Rokem  wrote:
>>>
>>> Hi Fernando and John,
>>>
>>> regardless of the clunky way in which I was trying to introduce our
>>> patch, I still want to be able to build MPL from source on my machine. It is
>>> a distraction, but, hey, it's a distraction on top of a distraction on top
>>> of a distraction, so at this point, I might as well be distracted. Besides,
>>> it should end up being useful, and not only for me. Yesterday, there was
>>> someone on the matplotlib-users list with exactly the same problem in
>>> building MPL from source (sourceforge is not responding at the moment, so I
>>> can't post a link to that message). If this is not a good time to
>>> trouble-shoot this, let me know and we can come back to this in a couple of
>>> weeks. It does seem like cohere_pairs has not gotten a lot of use, so the
>>> patch can also languish for another couple of weeks andI can get stuff done
>>> regardless of solving this problem, but I would love to be able to solve
>>> this, with your help.
>>>
>>> So - I now checked out 0.99, running 'make build_osx105' (you do realize
>>> the 'x' stands for '10', don't you?) didn't work, so I followed the
>>> instructions in source/osx/README
>>>
>>> I still get exactly the same error as before:
>>>
>>> g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
>>> -bundle -undefined dynamic_lookup -arch ppc -arch i386
>>> -L/Users/arokem/source/mpl99/release/osx/zlib-1.2.3
>>> -L/Users/arokem/source/mpl99/release/osx/libpng-1.2.33
>>> -L/Users/arokem/source/mpl99/release/osx/freetype-2.3.7 -Os -arch ppc -arch
>>> i386 -I/Users/arokem/source/mpl99/release/osx/zlib-1.2.3
>>> -I/Users/arokem/source/mpl99/release/osx/libpng-1.2.33
>>> -I/Users/arokem/source/mpl99/release/osx/freetype-2.3.7/include
>>> build/temp.macosx-10.3-fa

Re: [matplotlib-devel] mlab cohere_pairs patch

2009-08-22 Thread Ariel Rokem
Hi -

following up on this patch, as suggested, I have added a use-case of
mlab.cohere_pairs to examples/pylab_examples/mri_with_eeg.py.

Cheers,

Ariel



On Sat, Aug 22, 2009 at 4:27 PM, John Hunter wrote:
> On Sat, Aug 22, 2009 at 6:00 PM, Ariel Rokem wrote:
>
>> so - now, almost two weeks later, I can finally install MPL from
>> source. On to submitting that patch.
>
> Thanks for following up -- applied to the release branch, merged to trunk
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


pylab_example_cohere_pairs.diff
Description: Binary data
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] building on OSX

2009-08-24 Thread Ariel Rokem
Hi Eric,

you could try making changes to your Python Makefile, as described
here (in item 1):

http://matplotlib.sourceforge.net/faq/installing_faq.html#building-and-installing-from-source-on-osx-with-epd

Even if you are not installing on the basis of the EPD, it might still
solve your issue.

Cheers,

Ariel



On Mon, Aug 24, 2009 at 1:47 PM, Eric Bruning wrote:
> For some reason, it's still picking up the gfortran-installed gcc in
> /usr/local/lib, which is also listed in
> /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib (along with everything
> else in /usr/local/lib). I also still see -L /usr/local/lib even
> though the darwin setupext.py key no longer includes it.
>
> I'm flummoxed. Apparently I should back up and try without gfortran
> first, but that's a typical way to meet requirements for scipy that
> I'd like to have around.
>
> -Eric
>
> g++ -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
> -bundle -undefined dynamic_lookup -arch i386 -arch ppc
> -L/usr/local/matplotlib/lib
> -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
> -I/usr/local/matplotlib/include
> -I/usr/local/matplotlib/include/freetype2 -isysroot
> /Developer/SDKs/MacOSX10.4u.sdk
> build/temp.macosx-10.4-fat-2.6/src/ft2font.o
> build/temp.macosx-10.4-fat-2.6/src/mplutils.o
> build/temp.macosx-10.4-fat-2.6/CXX/cxx_extensions.o
> build/temp.macosx-10.4-fat-2.6/CXX/cxxsupport.o
> build/temp.macosx-10.4-fat-2.6/CXX/IndirectPythonInterface.o
> build/temp.macosx-10.4-fat-2.6/CXX/cxxextensions.o -L/usr/local/lib
> -lfreetype -lz -lstdc++ -lm -o
> build/lib.macosx-10.4-fat-2.6/matplotlib/ft2font.so
> ld warning: in 
> /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib,
> missing required architecture ppc in file
> ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib,
> missing required architecture ppc in file for architecture ppc
> collect2: ld returned 1 exit status
> lipo: can't open input file:
> /var/folders/RP/RPE-UjrSHZ4SQq6AJQBxqk+++TI/-Tmp-//ccAqigF2.out (No
> such file or directory)
> error: command 'g++' failed with exit status 1
> make: *** [mpl_build] Error 1
>
>
> On Sun, Aug 23, 2009 at 1:33 AM, John Hunter wrote:
>> The problem of building on OSX, in particular the setupext basedir
>> search path including /sw, /usr and /usr/local, appears so fraught
>> with peril --  we don't know what kinds of libs built with what kinds
>> of flags that we will find -- that I removed all the dirs from the
>> basedir for darwin.  Instead, I am hoping that the new makefile.osx
>> Makefile I have added, which will fetch and build the required libs
>> and install them into the PREFIX of your choice, will prove more
>> supportable.
>>
>> I have tested this on a couple of platforms and it worked well, but
>> there are other combinations that I do not have access to so please
>> let me know if this is not viable.  I am currently building with
>>
>>  PREFIX=/Users/jdhunter/dev make -f makefile.osx fetch deps mpl_install
>>
>> Builds with enthought python make still be broken due to the issues in the 
>> FAQ:
>>
>>  http://matplotlib.sourceforge.net/faq/installing_faq.html#building-and-installing-from-source-on-osx-with-epd
>>
>> Please kick the tires and give some feedback
>>
>> JDH
>>
>> --
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> ___
>> Matplotlib-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


Re: [matplotlib-devel] Question on sphinxext.plot_directive...

2009-09-13 Thread Ariel Rokem
Hi Fernando and all,

>
> Speaking of sphinx for books, as I've mentioned before to John, the
> last big problem is being able to cross-reference arbitrary text
> elements like you can in latex, be they chapters or sections or
> whatever, and get a number or something that's meaningful in print.
>
> I looked around, and apparently it's on the main docutils todo list:
>
> http://docutils.sourceforge.net/docs/dev/todo.html#object-numbering-and-object-references
>
> I hope we don't have to be the ones fixing that one...
>

I should also mention bibliography - using a bibtex bibliography is
also still quite impossible at the moment, without going in and
editing the .tex and running the tex (latex=>bibtex=>latex=>latex)
commands on it yourself. Does anyone of the Sphinx mavens around here
know anything about how to get Sphinx to do that for you? I am
starting to believe that Sphinx can be made to do just about anything
we would want it to for these kinds of uses.

Cheers,

Ariel

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-04 Thread Ariel Rokem
Hi everyone,

Revisiting an issue which has already been discussed previously - in order
to check whether mlab.csd really does exactly what Matlab's cpsd is doing,
we wrote a couple of scripts, one in matlab and one in Python. They both run
on the attached data. The comparison of the results show that they are very
similar. However - two elements are off by a factor of approximately 2 - the
very first element and the very last. The last one may be off just because
it is very small, the difference between the two is tiny. But for the first
one - this is not the case - there is actually a difference in the values.
This is not only due to the fact that the DC component is very small,
because even if I add a DC component to the time-series, there is still
discrepancy of a factor of ~2 for that element. Does anyone have any idea
why this would be the case?

Thanks --

Ariel



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
   8.9429666e+00   5.0100717e+00  -2.6816087e+00  -7.1501559e+00  
-8.0216237e+00  -8.4308386e+00  -8.7813313e+00  -7.1541340e+00  -3.1692794e+00  
-3.1233587e-02  -8.6932796e-01  -3.2208590e+00  -2.7708292e+00  -1.1180497e+00  
-1.1642218e+00   8.2827157e-01   7.7567196e+00   1.3427191e+01   1.2297869e+01  
 7.9463857e+00   4.3650450e+00   7.4513721e-01  -1.8071566e+00  -1.0494220e+00  
 2.7099914e-01  -6.0612992e-03   1.0650746e+00   2.7359840e+00  -2.3103312e-01  
-5.4394070e+00  -5.6020012e+00  -2.8549610e+00  -3.9441985e+00  -6.5248611e+00  
-5.5182498e+00  -3.5707725e+00  -3.3029199e+00  -1.4821612e+00   1.9829637e+00  
 2.9371484e+00   2.4922181e+00   4.6520641e+00   7.6516172e+00   7.9849900e+00  
 6.2872303e+00   3.0524810e+00  -2.6249618e+00  -8.4729269e+00  -1.1423490e+01  
-1.1515627e+01  -8.0828989e+00  -6.1605087e-02   7.3546053e+00   7.3762039e+00  
 2.7203112e+00   9.7107193e-01   2.3389000e+00   2.3308435e+00   1.0908653e+00  
 1.3983531e+00   2.7507814e+00   3.1877024e+00   2.683e+00   2.0890036e+00  
 1.5431800e+00   2.6735579e-01  -2.8915636e+00  -6.9616787e+00  -7.7022941e+00  
-2.6552425e+00   3.6478430e+00   4.5449371e+00   9.1741479e-01  -1.0349366e-01  
 3.1044471e+00   3.5481921e+00  -2.7689468e+00  -9.5888143e+00  -9.2968371e+00  
-3.1434409e+00   1.4650620e+00   4.9126975e-02  -4.4859946e+00  -5.1590780e+00  
 1.6118592e-01   4.9388060e+00   4.1399337e+00   3.0802173e+00   7.1234314e+00  
 1.0353879e+01   6.3260927e+00   5.0624656e-01  -4.3675968e-01  -2.3225964e-01  
-2.4186513e+00  -1.9095391e+00   2.5966116e+00   3.2187007e+00  -1.6422521e+00  
-2.9320855e+00   1.4858112e+00   2.1743862e+00  -3.8657803e+00  -7.4941826e+00  
-3.6778977e+00   1.4465903e+00   2.0995855e+00  -3.6925935e-01  -2.4488424e+00  
-2.2657275e+00  -3.0767826e-01  -4.3447784e-02  -3.7835013e+00  -7.7710751e+00  
-6.6156223e+00  -9.8452194e-01   3.6143927e+00   3.3559741e+00  -7.0214935e-01  
-4.0464556e+00  -3.4005198e+00   3.1925151e-01   5.6106943e+00   1.2129909e+01  
 1.5598452e+01   1.0761346e+01   2.7808335e+00   1.6264690e+00   4.3371698e+00  
 6.9655189e-01  -6.4917108e+00  -7.1557533e+00  -3.2903321e+00  -2.5653037e+00  
-2.8456560e+00  -3.8648126e-01  -3.4792857e-01  -5.4706976e+00  -8.4354584e+00  
-4.7666552e+00   1.1698809e-01   1.4126243e+00   5.2560707e-01  -1.2557422e+00  
-4.3464817e+00  -6.0548728e+00  -2.6022608e+00   3.4128104e+00   4.5097622e+00  
-6.8046372e-01  -4.1244079e+00  -2.6499816e-02   6.5978997e+00   8.9300310e+00  
 8.9028673e+00   1.0882147e+01   1.1960235e+01   7.5608590e+00   3.1334125e-01  
-4.6417949e+00  -6.9282767e+00  -7.4717365e+00  -4.8990327e+00  -5.8542748e-01  
-8.4564434e-02  -4.8146391e+00  -8.9187473e+00  -8.1146069e+00  -5.1477694e+00  
-3.292e+00  -7.1163877e-01   3.6409206e+00   6.6594649e+00   5.8487425e+00  
 3.7533921e+00   3.2460105e+00   2.9353594e+00   1.0668831e+00  -5.3054098e-01  
-4.1149627e-01  -8.1327290e-01  -3.0706932e+00  -4.5485475e+00  -3.4206624e+00  
-1.2170184e+00   9.6882742e-01   2.7440724e+00   1.8368024e+00  -1.5910131e+00  
-2.0317113e+00   2.4423217e+00   5.2609099e+00   2.5027442e+00  -5.3925455e-01  
 3.6824003e-01   2.1030815e+00   1.6465455e+00   8.1607062e-02  -1.1482050e+00  
-9.4266580e-01   1.0252083e+00   1.3283382e+00  -2.8992882e+00  -7.2661102e+00  
-6.6027869e+00  -3.7400399e+00  -2.6018526e+00  -2.3601345e-01   5.1733118e+00  
 7.6959332e+00   3.2229165e+00  -3.2443397e+00  -5.6303607e+00  -3.8377406e+00  
 2.4645472e-01   5.0569136e+00   6.3004349e+00   1.3203384e+00  -3.1151906e+00  
 1.3232982e+00   9.5677298e+00   9.5030932e+00   1.5131090e+00  -3.8561271e+00  
-4.4258970e+00  -5.7326471e+00  -7.0638856e+00  -4.7194733e+00  -2.2836642e+00  
-3.3429743e+00  -2.5434213e+00   4.5252898e+00   1.1170906e+01   8.4467296e+00  
-1.3827260e+00  -6.9978902e+00  -3.0066829e+00   2.8550972e+00   2.1056966e+00  
-1.6739241e+00  -1.9125812e+00  -1.2343693e+00  -2.3238766e+00   3.4253954e-02  
 6.2718152e+00   8.340973

Re: [matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-06 Thread Ariel Rokem
Hi - thanks Ludwig.

I don't think that a major reworking of the logic of the function is needed.
Simply replacing the line you mentioned with:

Pxy *= 1 / (np.abs(windowVals)**2).sum()
Pxy[1:-1] *= scaling_factor
if scale_by_freq:
Pxy[[0,-1]] /= Fs

seems to solve the 0 and NFFT/2 problem for the 'onesided' case (that is,
the result is very similar to the Matlab result, patch attached) and still
seems to work with twosided (because then the scaling factor is equal to 1
and it doesn't really do anything, except scale by frequency, if that is
required). In the 'twosided' case, the output in matlab is fftshift-ed
relative to the mlab output, but that's not crucial.

What does become more apparent when I do that is that in frequency bands in
which the power is rather small, the ratio discrepancies between the mlab
result and the matlab result can be rather large, on the order of a factor
of 2-2.5, even when the differences are tiny. Similarly, when the power is
rather large, there can be non-negligible differences between the two
results. Is there anything to do about that?

Cheers,

Ariel


On Fri, Feb 5, 2010 at 11:53 PM, Ludwig Schwardt
wrote:

> Hi,
>
> > From: Ariel Rokem 
> > However - two elements are off by a factor of approximately 2 - the
> > very first element and the very last. ... Does anyone have any idea
> > why this would be the case?
>
> >From a quick look at the mlab code, it looks like a bug in
> mlab._spectral_helper.
>
> The default spectrum is 'onesided' (same as for Matlab's cpsd). A
> single-sided spectrum of a real signal has double the magnitude of a
> double-sided spectrum, *except* at the origin (frequency index n = 0)
> and Nyquist frequency (n = NFFT / 2), where it is the *same* as the
> double-sided one [1]_.
>
> In the mlab code, all the spectral values are simply scaled by a
> factor of 2 (among other factors) in this line:
>
># Scale the spectrum by the norm of the window to compensate for
># windowing loss; see Bendat & Piersol Sec 11.5.2.  Also include
># scaling factors for one-sided densities and dividing by the sampling
># frequency, if desired.
>Pxy *= scaling_factor / (np.abs(windowVals)**2).sum()
>
> This should be easy to fix (although the function probably needs a
> little rework).
>
> Regards,
> Ludwig
>
> Quick reference from my bookshelf:
> ---
> .. [1] W. L. Briggs, V. E. Henson, "The DFT: An Owner's Manual for the
> Discrete Fourier Transform," Section 1.3, Problem 6 (a), p. 13.
>
>
> --
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> ___
> Matplotlib-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


one_sided_spectrum_normalization.diff
Description: Binary data
--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-07 Thread Ariel Rokem
Hi Ludwig (responding also to list),

I don't think that the cause of the discrepancy is because of the
hamming/hanning window difference. I do set the window in the matlab part to
also be a hanning window of length nfft.

Cheers,

Ariel


On Sun, Feb 7, 2010 at 7:45 AM, Ludwig Schwardt
wrote:

> Hi,
>
> On Sun, Feb 7, 2010 at 12:46 AM, Ariel Rokem  wrote:
> > I don't think that a major reworking of the logic of the function is
> needed.
> > Simply replacing the line you mentioned with:
> >
> > Pxy *= 1 / (np.abs(windowVals)**2).sum()
> > Pxy[1:-1] *= scaling_factor
> > if scale_by_freq:
> > Pxy[[0,-1]] /= Fs
>
> I agree. I was hoping the first two lines above would be sufficient.
> Then I saw scaling_factor also included Fs if scaling by frequency,
> and Pxy is of shape (numFreqs,n), i.e. not a straightforward 1-D
> array, which caused me to reserve my judgment a little bit... :-)
>
> > What does become more apparent when I do that is that in frequency bands
> in
> > which the power is rather small, the ratio discrepancies between the mlab
> > result and the matlab result can be rather large, on the order of a
> factor
> > of 2-2.5, even when the differences are tiny. Similarly, when the power
> is
> > rather large, there can be non-negligible differences between the two
> > results. Is there anything to do about that?
>
> Could this be because Matlab uses a Hamming window by default, while
> mlab uses a *Hanning* window by default? Very similar-sounding names,
> and also very similar windows numerically (but not exactly the
> same)...
>
> Ludwig
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-08 Thread Ariel Rokem
Hi -

the maximal difference in this case is of about 6 (units?), which is an
approximately 50% difference. This is in one point in the spectrum which has
a relatively small value - the maximal peaks in the spectra are on the order
of 1200, so in the grand scheme of things, not that horrible. Other large
differences are on the order of 4, which is approximately 5% or less of
those points.

Thanks - Ariel

PS for some reason, matplotlib-devel will not get your email unless you hit
"reply all", so they have been getting my emails, but not yours. I am not
sure whether that is what you intended, so I thought I would mention it.


On Mon, Feb 8, 2010 at 1:24 AM, Ludwig Schwardt
wrote:

> Hi,
>
> On Mon, Feb 8, 2010 at 5:25 AM, Ariel Rokem  wrote:
> > I don't think that the cause of the discrepancy is because of the
> > hamming/hanning window difference. I do set the window in the matlab part
> to
> > also be a hanning window of length nfft.
>
> I suspected you gave the same window to both, but I was just
> checking... :-) To find those smaller discrepancies might be a bit
> harder then, requiring a careful comparison of the various steps
> involved. Just for interest's sake, how big are the differences we are
> talking about?
>
> Regards,
> Ludwig
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-09 Thread Ariel Rokem
Hi everyone,

Mystery solved (I think)! It turns out that matlab has two functions, one
called "hann" and the other called "hanning". They both purport to produce
the hanning window, but they produce two (slightly) different things. Only
one of these (the one given by "hann") actually produces the hanning window
as it is defined in the standard reference on this (Harris 1978. And also
Wikipedia ;D). When using the "hann" function in Matlab in this little
experiment, the difference between the python and the matlab results, is on
the order of %10e-6. I think I am willing to live with that.

The only mystery that remains (I think) is - what is Matlab's "hanning"
supposed to be doing? Are there two different windows: hann and hanning (not
"hamming" - I know that's a different one)?

Cheers,

Ariel


On Mon, Feb 8, 2010 at 9:32 AM, Ariel Rokem  wrote:

> Hi -
>
> the maximal difference in this case is of about 6 (units?), which is an
> approximately 50% difference. This is in one point in the spectrum which has
> a relatively small value - the maximal peaks in the spectra are on the order
> of 1200, so in the grand scheme of things, not that horrible. Other large
> differences are on the order of 4, which is approximately 5% or less of
> those points.
>
> Thanks - Ariel
>
> PS for some reason, matplotlib-devel will not get your email unless you hit
> "reply all", so they have been getting my emails, but not yours. I am not
> sure whether that is what you intended, so I thought I would mention it.
>
>
> On Mon, Feb 8, 2010 at 1:24 AM, Ludwig Schwardt  > wrote:
>
>> Hi,
>>
>> On Mon, Feb 8, 2010 at 5:25 AM, Ariel Rokem  wrote:
>> > I don't think that the cause of the discrepancy is because of the
>> > hamming/hanning window difference. I do set the window in the matlab
>> part to
>> > also be a hanning window of length nfft.
>>
>> I suspected you gave the same window to both, but I was just
>> checking... :-) To find those smaller discrepancies might be a bit
>> harder then, requiring a careful comparison of the various steps
>> involved. Just for interest's sake, how big are the differences we are
>> talking about?
>>
>> Regards,
>> Ludwig
>>
>
>
>
> --
> Ariel Rokem
> Helen Wills Neuroscience Institute
> University of California, Berkeley
> http://argentum.ucbso.berkeley.edu/ariel
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-09 Thread Ariel Rokem
Hi - mea culpa - as pointed out by a colleague (and documented in the help
document for "hanning" in Matlab), this function produces the same window,
but without the first and last zero-weighted samples.

Cheers -- Ariel

On Tue, Feb 9, 2010 at 4:58 PM, Ariel Rokem  wrote:

> Hi everyone,
>
> Mystery solved (I think)! It turns out that matlab has two functions, one
> called "hann" and the other called "hanning". They both purport to produce
> the hanning window, but they produce two (slightly) different things. Only
> one of these (the one given by "hann") actually produces the hanning window
> as it is defined in the standard reference on this (Harris 1978. And also
> Wikipedia ;D). When using the "hann" function in Matlab in this little
> experiment, the difference between the python and the matlab results, is on
> the order of %10e-6. I think I am willing to live with that.
>
> The only mystery that remains (I think) is - what is Matlab's "hanning"
> supposed to be doing? Are there two different windows: hann and hanning (not
> "hamming" - I know that's a different one)?
>
> Cheers,
>
> Ariel
>
>
> On Mon, Feb 8, 2010 at 9:32 AM, Ariel Rokem  wrote:
>
>> Hi -
>>
>> the maximal difference in this case is of about 6 (units?), which is an
>> approximately 50% difference. This is in one point in the spectrum which has
>> a relatively small value - the maximal peaks in the spectra are on the order
>> of 1200, so in the grand scheme of things, not that horrible. Other large
>> differences are on the order of 4, which is approximately 5% or less of
>> those points.
>>
>> Thanks - Ariel
>>
>> PS for some reason, matplotlib-devel will not get your email unless you
>> hit "reply all", so they have been getting my emails, but not yours. I am
>> not sure whether that is what you intended, so I thought I would mention it.
>>
>>
>>
>> On Mon, Feb 8, 2010 at 1:24 AM, Ludwig Schwardt <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> On Mon, Feb 8, 2010 at 5:25 AM, Ariel Rokem  wrote:
>>> > I don't think that the cause of the discrepancy is because of the
>>> > hamming/hanning window difference. I do set the window in the matlab
>>> part to
>>> > also be a hanning window of length nfft.
>>>
>>> I suspected you gave the same window to both, but I was just
>>> checking... :-) To find those smaller discrepancies might be a bit
>>> harder then, requiring a careful comparison of the various steps
>>> involved. Just for interest's sake, how big are the differences we are
>>> talking about?
>>>
>>> Regards,
>>> Ludwig
>>>
>>
>>
>>
>> --
>> Ariel Rokem
>> Helen Wills Neuroscience Institute
>> University of California, Berkeley
>> http://argentum.ucbso.berkeley.edu/ariel
>>
>
>
>
> --
> Ariel Rokem
> Helen Wills Neuroscience Institute
> University of California, Berkeley
> http://argentum.ucbso.berkeley.edu/ariel
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel