Michael Droettboom | 9 Feb 14:05

Re: Bug in eps output of matplotlib

I believe the bug actually is in matplotlib, and recent ghostscript versions fail only because they have
become stricter over time.  The TTF-to-Postscript font conversion library in matplotlib (ttconv) was
hard-coded to use the "Standard" Postscript encoding (which defines the set of glyphs available for
use), and "Standard" doesn't include the "/minus" sign.  This confuses ghostscript when it tries to
convert a Type 3 Postscript font to a Type 3 PDF font.  Since detecting the correct "built-in" encoding to
use when converting an arbitrary TTF file is rather tricky (and matplotlib can use some pretty esoteric
Unicode characters when drawing math expressions), my workaround is to create a custom encoding for each
font, containing only the glyphs actually being used.  Postscript has a limita
 tion of 255 glyphs per font in a custom encoding, but in practice it should be difficult to hit this. 
Surprisingly (to me at least), using a wacky arbitrary encoding doesn't break the Find/R!
!
eplace and accessibility functions on the resulting PDF file.

So, this is now fixed in SVN trunk, I believe.  As a workaround for released versions of matplotlib, you can
set ps.fonttype to 42 which sidesteps the whole Type 3 font subsetting/encoding issue.  At least on my
machine, I had no trouble converting a PS file with Type 42 fonts to a PDF with ps2pdf/gs 8.70.

Thanks for your help tracking this down.

Mike

------------------------------------------------------------------------------
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
John Hunter | 8 Feb 18:57
Picon

problems with svnmerge

I just committed Ariel's csd changes to the 99 branch, and when I
attempted to merge I first got a failure and now the branch is not
showing up in the available branches.  Any ideas?  The branch was
listed on a 'svnmerge.py merge' command *before* the failure.

jdhunter <at> uqbar:mpl> svnmerge.py merge
/home/jdhunter/dev/bin/svnmerge.py:71: DeprecationWarning: The popen2
module is deprecated.  Use the subprocess module.
  import sys, os, getopt, re, types, tempfile, time, popen2, locale
svnmerge: multiple sources found. Explicit source argument
(-S/--source) required.
The merge sources available are:
  /branches/v0_99_maint
  /branches/mathtex

jdhunter <at> uqbar:mpl> svnmerge.py merge -Sv0_99_maint
/home/jdhunter/dev/bin/svnmerge.py:71: DeprecationWarning: The popen2
module is deprecated.  Use the subprocess module.
  import sys, os, getopt, re, types, tempfile, time, popen2, locale
property 'svnmerge-integrated' set on '.'

svnmerge: command execution failed (exit code: 1)
svn --non-interactive propdel "svnmerge-blocked" "."
svn: Attempting to delete nonexistent property 'svnmerge-blocked'

jdhunter <at> uqbar:mpl> svnmerge.py merge -Sv0_99_maint
/home/jdhunter/dev/bin/svnmerge.py:71: DeprecationWarning: The popen2
module is deprecated.  Use the subprocess module.
  import sys, os, getopt, re, types, tempfile, time, popen2, locale
svnmerge: "v0_99_maint" is neither a valid URL, nor an unambiguous
substring of a repository path, nor a working directory

jdhunter <at> uqbar:mpl> svnmerge.py merge
/home/jdhunter/dev/bin/svnmerge.py:71: DeprecationWarning: The popen2
module is deprecated.  Use the subprocess module.
  import sys, os, getopt, re, types, tempfile, time, popen2, locale
svnmerge: multiple sources found. Explicit source argument
(-S/--source) required.
The merge sources available are:
  /branches/v0_91_maint
  /branches/mathtex
  /branches/v0_98_5_maint

------------------------------------------------------------------------------
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
Ariel Rokem | 8 Feb 18:32
Picon
Favicon

Re: Comparison of mlab.csd and Matlab's cpsd

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 <ludwig.schwardt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi,

On Mon, Feb 8, 2010 at 5:25 AM, Ariel Rokem <arokem-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> 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
Matplotlib-devel@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Ariel Rokem | 8 Feb 04:25
Picon
Favicon

Re: Comparison of mlab.csd and Matlab's cpsd

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 <ludwig.schwardt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi,

On Sun, Feb 7, 2010 at 12:46 AM, Ariel Rokem <arokem-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> 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
Matplotlib-devel@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Benjamin Drung | 6 Feb 23:54

GNU/Hurd support

Hi,

we applied 40_hurd.patch for building matplotlib on Debian GNU/Hurd.

Additional attached the 10_build_fix.patch. This patch does two things.
First it enables matplotlib on all Debian architectures. The second
things is that it removes /usr/local from the basedir.

It would be nice if you can provide a configure flag for disabling
the /usr/local directory from the basedir. Then we can drop this patch.

-- 
Benjamin Drung
Ubuntu Developer (www.ubuntu.com) | Debian Maintainer (www.debian.org)
--- a/setupext.py
+++ b/setupext.py
@@ -72,6 +72,7 @@
     'gnukfreebsd7' : ['/usr'],
     'gnukfreebsd8' : ['/usr'],
     'aix5' : ['/usr/local'],
+    'gnu0' : ['/usr'],
 }
 
 import sys, os, stat
Description: Fixes path for build on Debian
Forwarded: no
Author: Sandro Tosi <morph <at> debian.org>
Last-Update: 2010-02-06

--- matplotlib-0.99.1.2.orig/setupext.py
+++ matplotlib-0.99.1.2/setupext.py
@@ -47,8 +47,12 @@ import subprocess
 
 basedir = {
     'win32'  : ['win32_static',],
-    'linux2' : ['/usr/local', '/usr'],
-    'linux'  : ['/usr/local', '/usr',],
+    'linux2-alpha' : ['/usr'],
+    'linux2-hppa' : ['/usr'],
+    'linux2-mips' : ['/usr'],
+    'linux2-sparc' : ['/usr'],
+    'linux2' : ['/usr'],
+    'linux'  : ['/usr',],
     'cygwin' : ['/usr/local', '/usr',],
     '_darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
                 '/usr', '/sw'],
@@ -63,9 +67,12 @@ basedir = {
     'freebsd5' : ['/usr/local', '/usr'],
     'freebsd6' : ['/usr/local', '/usr'],
     'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
-    'gnukfreebsd5' : ['/usr/local', '/usr'],
-    'gnukfreebsd6' : ['/usr/local', '/usr'],
+    'gnukfreebsd5' : ['/usr'],
+    'gnukfreebsd6' : ['/usr'],
+    'gnukfreebsd7' : ['/usr'],
+    'gnukfreebsd8' : ['/usr'],
     'aix5' : ['/usr/local'],
+    'gnu0' : ['/usr'],
 }
 
 import sys, os, stat
------------------------------------------------------------------------------
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
Matplotlib-devel@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Eric Firing | 7 Feb 01:02
Favicon

Re: GNU/Hurd support


Benjamin Drung wrote: > Hi, > > we applied 40_hurd.patch for building matplotlib on Debian GNU/Hurd. > > Additional attached the 10_build_fix.patch. This patch does two things. > First it enables matplotlib on all Debian architectures. The second > things is that it removes /usr/local from the basedir. > > It would be nice if you can provide a configure flag for disabling > the /usr/local directory from the basedir. Then we can drop this patch. >
Sorry, I dropped this the last time you brought it up. I have now added gnu0 as a platform, and added a "basedirlist" option to setup.cfg. See svn r8113 and 8115. The linux2-alpha etc platforms were already there. Eric ------------------------------------------------------------------------------ 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
Benjamin Drung | 7 Feb 09:05

Re: GNU/Hurd support

Am Samstag, den 06.02.2010, 14:02 -1000 schrieb Eric Firing:

> Benjamin Drung wrote: > > Hi, > > > > we applied 40_hurd.patch for building matplotlib on Debian GNU/Hurd. > > > > Additional attached the 10_build_fix.patch. This patch does two things. > > First it enables matplotlib on all Debian architectures. The second > > things is that it removes /usr/local from the basedir. > > > > It would be nice if you can provide a configure flag for disabling > > the /usr/local directory from the basedir. Then we can drop this patch. > > > > Sorry, I dropped this the last time you brought it up. I have now added > gnu0 as a platform, and added a "basedirlist" option to setup.cfg. See > svn r8113 and 8115.
Thanks. -- -- Benjamin Drung Ubuntu Developer (www.ubuntu.com) | Debian Maintainer (www.debian.org)
------------------------------------------------------------------------------
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
Matplotlib-devel@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Randy Heiland | 6 Feb 00:28
Picon
Favicon

libpng14 error

This is probably already known, but I'll go ahead and post it.  In trying to build against libpng-1.4.0, I had
to edit src/_png.cpp:

//  png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
   png_destroy_read_struct(&png_ptr, &info_ptr, NULL);

-Randy
------------------------------------------------------------------------------
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
Michael Droettboom | 8 Feb 17:01

Re: libpng14 error

Thanks for reporting this.  I wasn't aware of the issue.

Since I don't have a libpng-1.4 to verify the fix with, are you able to checkout from SVN trunk and test it?

Mike

------------------------------------------------------------------------------
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
Ariel Rokem | 5 Feb 06:27
Picon
Favicon

Comparison of mlab.csd and Matlab's cpsd

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.6855553e+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.2111192e+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.3409736e+00  
5.4121519e+00   3.9103398e+00   2.6471453e+00  -2.2564369e+00  -5.9685791e+00  -5.2084251e+00 
-5.5583585e+00  -8.5601348e+00  -9.2173592e+00  -7.7095246e+00  -6.4247195e+00  -2.9195376e+00  
1.3696917e+00   2.3600111e-01  -3.5066462e+00  -1.7906518e+00   3.0267100e+00   4.4608049e+00  
4.9647577e+00   8.1244909e+00   1.0462506e+01   9.6079485e+00   7.7730961e+00   5.8355237e+00  
4.1832824e+00   4.4872281e+00   4.7070481e+00   1.1954062e+00  -3.3703080e+00  -4.2879123e+00 
-3.7852632e+00  -5.9645982e+00  -8.4869057e+00  -7.4016607e+00  -4.3441103e+00  -2.3813524e+00  
1.2418841e-01   4.9183614e+00   7.1076542e+00   1.3607427e+00  -7.3320053e+00  -8.9727762e+00 
-3.2209033e+00   1.4899373e+00   1.0741419e+00  -1.4691569e+00  -2.5938840e+00  -1.2369807e+00  
2.0206986e-01  -1.8303922e+00  -3.9449765e+00   1.4387487e+00   1.0514320e+01   1.0769771e+01
   8.8313817e+00   4.3005055e+00  -4.1649119e+00  -6.3050160e+00  -5.2402152e+00  -7.3721800e+00 
-8.1775693e+00  -3.2534988e+00   1.7048012e+00   1.8813030e+00   1.0824107e-01  -1.1253794e+00 
-2.4968623e+00  -3.3077789e+00  -2.1535871e+00   7.4321205e-01   4.6802272e+00   7.9643259e+00  
7.9943665e+00   5.5547796e+00   4.3951321e+00   4.5254200e+00   2.3442211e+00  -1.8909218e+00 
-3.5125831e+00  -7.2464997e-01   2.7212191e+00   2.5851414e+00  -9.2755899e-01  -3.8951814e+00 
-3.6401440e+00  -1.7854451e+00  -1.5882577e+00  -3.5966400e+00  -5.5301748e+00  -5.3917715e+00 
-3.4710664e+00  -1.6020516e+00  -7.3631744e-01   2.6970500e-01   2.6573457e+00   5.4863161e+00  
6.9121613e+00   6.6655222e+00   5.6622659e+00   4.0389729e+00   9.3885229e-01  -3.9502750e+00 
-8.8257786e+00  -1.0220073e+01  -6.5514972e+00  -7.9560635e-01   2.6491715e+00   3.0176599e+00  
2.3249973e+00   1.3986930e+00   4.0408014e-01   6.3290633e-01   1.6628753e+00   6.5485073e-01 
-1.8717202e+00  -1.4627624e+00   1.9782947e+00   3.2160739e+00   1.1668544e+00  -7.5422833e-02 
-3.0476741e-01  -2.7414493e+00  -5.4076926e+00  -3.5109668e+00   1.5764495e+00   4.3840966e+00  
3.4651353e+00   1.6677022e+00   1.3278134e+00   1.9641438e+00   9.7844787e-01  -2.6541428e+00 
-5.4302555e+00  -3.6952895e+00   3.5658553e-01   1.7762362e+00   3.5450667e-02  -1.0828150e+00  
8.1605611e-01   3.7404261e+00   4.2935454e+00   2.9825690e+00   3.2110963e+00   4.3252139e+00  
2.6993864e+00   2.5772192e-01   1.2371109e+00   2.0607001e+00  -2.2704400e+00  -6.6867329e+00 
-5.4038368e+00  -3.6397915e+00  -6.2586503e+00  -7.3385415e+00  -2.7550983e+00   7.9236928e-01 
-1.8886836e+00  -5.6601482e+00  -3.8104737e+00   2.8583879e+00   7.6702934e+00   5.8872419e+00  
9.0677176e-01  -1.9440434e-01   2.3735551e+00   2.3652435e+00  -7.5500799e-01  -1.8590439e+00  
7.5920807e-03   1.8605444e+00   2.7519176e+00   2.3561563e+00  -2.1737359e-01  -2.8219683e+00 
-2.2463695e+00   7.2443146e-01   3.6353362e+00   5.4375210e+00   4.7116456e+00   1.5334323e+00  
1.3049015e-01   2.1877728e+00   2.5385513e+00  -1.5107798e+00  -4.8889180e+00  -4.1843992e+00 
-2.2828085e+00  -1.0670605e+00   2.3457513e-01   2.0273180e-01  -2.0612892e+00  -3.3606344e+00 
-2.1726779e+00  -1.3180010e+00  -1.4886559e+00  -6.8853732e-01  -3.2777472e-02  -1.2468097e+00 
-2.0177334e+00  -9.4836544e-01  -4.9327480e-01  -9.0372213e-01  -6.2469066e-02   6.9582516e-01 
-2.6679510e-01  -3.0107267e-01   1.5593932e+00   2.2971845e+00   2.3280989e+00   4.3614839e+00  
5.9911319e+00   4.4196684e+00   2.4898740e+00   1.7785859e+00  -1.7747279e-03  -1.4677343e+00 
-7.7654385e-02   6.3896630e-01  -1.8932167e+00  -3.7540125e+00  -3.6034108e+00  -4.3085200e+00 
-4.2368712e+00  -1.2982768e+00   3.4464260e-01  -4.0509169e-01   1.7701181e+00   5.9147567e+00  
5.4544044e+00   1.7826749e+00   4.6335736e-01   2.0463931e-01  -1.3535767e+00  -2.0307774e+00 
-1.9379323e+00  -3.0905695e+00  -3.1283034e+00  -5.8490829e-01   9.5482502e-01   4.8349411e-01  
5.4859920e-01   2.6505302e-01  -1.6738570e+00  -2.1912486e+00   3.2643425e-02   1.8745902e+00  
1.8733346e+00   8.7274346e-01  -6.2320768e-01  -8.6521021e-01   9.8999512e-01   1.7587751e+00  
3.6997317e-01   4.6666216e-01   1.9638847e+00   7.1586139e-01  -2.7192205e+00  -4.8546551e+00 
-5.2275700e+00  -3.6331454e+00  -3.4432594e-01   8.2170170e-01  -7.7122599e-02   2.7567014e+00  
7.0580169e+00   3.6661124e+00  -4.3602951e+00  -5.1712241e+00   9.4062577e-01   4.8370393e+00  
4.8074790e+00   3.6350180e+00   1.7355182e+00   1.1764258e+00   3.3588501e+00   4.1348665e+00  
1.5457105e+00  -8.1362250e-01  -2.4892348e+00  -4.6008297e+00  -3.5153619e+00   1.8112368e-01 
-1.3466809e+00  -7.1410649e+00  -6.9291330e+00  -6.8888605e-01   2.1900116e+00   5.3854746e-01 
-6.6370732e-01  -1.2650612e+00  -1.6732370e+00   2.4574404e-01   2.5040580e+00   1.8156371e+00  
7.8117115e-01   1.9919812e+00   2.8459795e+00   2.4198319e+00   3.0987054e+00   4.2393728e+00  
3.6648485e+00   2.1428796e+00   3.8022045e-01  -2.2021776e+00  -4.1744097e+00  -4.2930744e+00 
-4.3848972e+00  -5.2515582e+00  -5.2594541e+00  -4.4249680e+00  -3.4217885e+00  -1.0180247e+00  
1.8727737e+00   1.4909976e+00  -1.6255664e+00  -2.3798025e+00   6.6177734e-01   4.0583452e+00  
5.4193601e+00   4.7630895e+00   2.7683942e+00   1.1101528e+00   1.2818523e+00   2.5446188e+00  
3.6850506e+00   4.7988971e+00   5.2451330e+00   3.4546722e+00   3.2558037e-01  -1.3030521e+00 
-1.3554915e+00  -2.6284306e+00  -5.3897891e+00  -6.1533489e+00  -3.3546173e+00  -1.5965785e-01  
6.8257969e-01   5.0294837e-01   4.3335249e-01  -1.3020608e+00  -4.4203707e+00  -4.8678613e+00 
-1.5345759e+00   1.3920361e+00   1.2277059e+00  -5.9079942e-02  -6.7115701e-01  -1.3347163e+00 
-2.3535973e+00  -2.2881480e+00   2.0879504e-01   4.4173569e+00   7.1039609e+00   5.4811765e+00
Attachment (compare_csd.m): application/octet-stream, 367 bytes
Attachment (compare_csd.py): application/octet-stream, 345 bytes
------------------------------------------------------------------------------
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
Matplotlib-devel@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Ludwig Schwardt | 6 Feb 08:53
Picon
Gravatar

Re: Comparison of mlab.csd and Matlab's cpsd

Hi,


> From: Ariel Rokem <arokem@...> > 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

Gmane