Robert Kern | 4 Nov 2003 03:08
Picon

Bug in F-distribution

In answering a SciPy question on c.l.py, I noticed that there's a bug in the PPF
of the F-distribution.

from scipy.stats.distributions import f
x1 = 4.26
Fx1 = f.cdf(x1, 2, 9)
x2 = f.ppf(Fx1, 2, 9)
x3 = f.ppf(1.0-Fx1, 2, 9)

# x1 is not even close to x2
# but x3 is

--

-- 
Robert Kern
kern <at> ugcs.caltech.edu

"In the fields of Hell where the grass grows high
 Are the graves of dreams allowed to die."
                     -- Richard Harter
Fernando Perez | 13 Nov 2003 23:19
Picon
Favicon

Strange import-related bug caused by scipy

Here's how to reproduce it.

Start with two very simple files:

planck[import]> cat one.py
from weave import inline,converters

planck[import]> cat two.py
import scipy

import one

Here's what happens if you execfile() these:

planck[import]> python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> execfile("one.py")
 >>> execfile("two.py")
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "two.py", line 3, in ?
     import one
   File "one.py", line 1, in ?
     from weave import inline,converters
ImportError: cannot import name converters

Now, the funny thing is that if you reverse the order of the imports in two.py 
and put 'import scipy' _last_, then there's no problem.   Somehow, the games 
(Continue reading)

Pearu Peterson | 15 Nov 2003 23:19
Favicon

Re: Strange import-related bug caused by scipy


On Thu, 13 Nov 2003, Fernando Perez wrote:

> Here's how to reproduce it.
> 
> Start with two very simple files:
> 
> planck[import]> cat one.py
> from weave import inline,converters
> 
> planck[import]> cat two.py
> import scipy
> 
> import one
> 
> Here's what happens if you execfile() these:
> 
> 
> planck[import]> python
> Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
> [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> execfile("one.py")
>  >>> execfile("two.py")
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "two.py", line 3, in ?
>      import one
>    File "one.py", line 1, in ?
>      from weave import inline,converters
(Continue reading)

Arnd Baecker | 16 Nov 2003 10:57
Picon

band matrices in scipy

Hi,

I am in the progress of wrapping the Lapack dsbev.f routine
(for band-matrices). Thanks to the amazing f2py I got pretty far
(actually in addition the good docs and Fernandos notes helped a lot!).
Once this is finished I would be happy to see this included in scipy ;-).

But before this could happen I have a couple of questions
(sorry, the text below is long,  but I wanted to be explicit ;-):
  - Is the following way of calling dsbev from python alright,
    (eg., I omitted ldab on the python side.)
    Would that parameter be useful to someone so that it is
    better to expose it (the full details of my few pyf lines are at
    the end of this mail)?

    In [7]: MODULENAME.dsbev?
    Type:           fortran
    String Form:    <fortran object at 0x4028ebf0>
    Namespace:      Interactive
    Docstring:
        dsbev - Function signature:
          w,z,info = dsbev(ab,[compute_v,lower])
        Required arguments:
          ab : input rank-2 array('d') with bounds (ldab,*)
        Optional arguments:
          compute_v := 1 input int
          lower := 0 input int
        Return objects:
          w : rank-1 array('d') with bounds (n)
          z : rank-2 array('d') with bounds (ldz,ldz)
(Continue reading)

Pearu Peterson | 16 Nov 2003 22:50
Favicon

Re: band matrices in scipy


Hi,

On Sun, 16 Nov 2003, Arnd Baecker wrote:

> I am in the progress of wrapping the Lapack dsbev.f routine
> (for band-matrices). Thanks to the amazing f2py I got pretty far
> (actually in addition the good docs and Fernandos notes helped a lot!).
> Once this is finished I would be happy to see this included in scipy ;-).

Great!

> But before this could happen I have a couple of questions
> (sorry, the text below is long,  but I wanted to be explicit ;-):
>   - Is the following way of calling dsbev from python alright,
>     (eg., I omitted ldab on the python side.)
>     Would that parameter be useful to someone so that it is
>     better to expose it (the full details of my few pyf lines are at
>     the end of this mail)?
> 
>     In [7]: MODULENAME.dsbev?
>     Type:           fortran
>     String Form:    <fortran object at 0x4028ebf0>
>     Namespace:      Interactive
>     Docstring:
>         dsbev - Function signature:
>           w,z,info = dsbev(ab,[compute_v,lower])
>         Required arguments:
>           ab : input rank-2 array('d') with bounds (ldab,*)
>         Optional arguments:
(Continue reading)

Robert Kern | 16 Nov 2003 23:45
Picon

Re: band matrices in scipy

On Sun, Nov 16, 2003 at 03:50:39PM -0600, Pearu Peterson wrote:

[snip]

> However, help(MODULENAME.dsbev) could certainly give more
> information than just '<fortran object>'. The reason why it
> does not may be due to the fact that a <fortran object> does not
> have a __doc__ attribute, instead, when one tries to access
> <fortran object>.__doc__ then getattr function is called
> that generates documentation on fly. This is f2py feature to 
> reduce the size of extension modules.

Looking through pydoc.py (which the builtin help() calls), the problem
is that pydoc.py does not recognize a fortranobject as a function-alike.
For the interested, look at the method Doc.document. It uses the inspect
module, and that only seems to recognize the builtin function-like
types. I'll file a bug report asking for something a little smarter.

In the meantime, SciPy's info() and IPython's ? magic work just fine.

--

-- 
Robert Kern
kern <at> ugcs.caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
Nils Wagner | 17 Nov 2003 17:58
Picon

From NASTRAN to MATLAB to Scipy [Fwd: loadop4/saveop4]

Dear experts,

I was looking for a NASTRAN/MATLAB interface. The result of
my inquiry is enclosed. Maybe Scipy can use this interface as well.

Any comments or suggestions ?

Nils
Favicon
From: Dear experts, I was looking for a NASTRAN/MATLAB interface. The result of my inquiry is enclosed. Maybe Scipy can use this interface as well. Any comments or suggestions ? Nils <al <at> danial.org>
Subject: loadop4/saveop4
Date: 2003-11-16 18:05:05 GMT

hello Nils,

I saw your post on the NA Digest asking about tools to
read/write .op4 files within matlab.  The answer is yes, 
such tools exist, are freely available and work great (ok, 
(Continue reading)

José Fonseca | 18 Nov 2003 01:28
Picon
Favicon

Re: From NASTRAN to MATLAB to Scipy [Fwd: loadop4/saveop4]

I haven't come around to write a parser for Nastran Output4 files as I
haven't yet needed those. But I've recently writed a parser for Output2
(both binary and neutral) result files, and I even wrote a very simple
NASTRAN OP2 -> VTK which (at the moment only) extracts the mode shapes
of a modal analysis.

See the parsers at
http://mefriss1.swan.ac.uk/cgi-bin/viewcvs.cgi/python/Nastran/ and the
converter at
http://mefriss1.swan.ac.uk/cgi-bin/viewcvs.cgi/python/nas2vtk.py

On Mon, 17 Nov 2003 17:58:37 +0100, Nils Wagner wrote:
> Dies ist eine mehrteilige Nachricht im MIME-Format.
> --------------C36602AAD19189372FC5B129
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Dear experts,
>
> I was looking for a NASTRAN/MATLAB interface. The result of
> my inquiry is enclosed. Maybe Scipy can use this interface as well.
>
> Any comments or suggestions ?
>
>
> Nils

[....]

I may or may not eventually implement those in python, but in any case,
(Continue reading)

Nils Wagner | 18 Nov 2003 10:06
Picon

scipy.test() FAILED (failures=6, errors=8) in latest cvs

Just a short report of scipy.test() with latest cvs

Nils

>>> scipy.__version__
'0.2.1_249.4430'
>>> Numeric.__version__
'23.1'
Python 2.1.2 (#1, Feb 25 2002, 18:04:21)
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "copyright", "credits" or "license" for more information.

======================================================================
ERROR: check_cdf
(scipy.stats.distributions.test_distributions.test_fatiguelife)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 5, in check_cdf
  File "/usr/local/lib/python2.1/site-packages/scipy/stats/stats.py",
line 1521, in kstest
    vals = sb.sort(rvs(*args,**kwds))
  File
"/usr/local/lib/python2.1/site-packages/scipy/stats/distributions.py",
line 432, in rvs
    vals = reshape(self._rvs(*args),size)
  File
"/usr/local/lib/python2.1/site-packages/scipy/stats/distributions.py",
line 1195, in _rvs
    z = norm(size=self._size)
  File
(Continue reading)

Nils Wagner | 18 Nov 2003 11:11
Picon
Favicon

scipy.test()FAILED(failures=8, errors=2)

Hi all, 

This is the result of scipy.test() when using 

Python 2.3+ (#1, Sep 23 2003, 23:07:16) 
[GCC 3.3.1 (SuSE Linux)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> scipy.__version__ 
'0.2.1_249.4433' 
 >>> Numeric.__version__ 
'23.1' 

====================================================================== 
ERROR: check_data 
(scipy.stats.morestats.test_morestats.test_binom_test) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
  File "/usr/lib/python2.3/site-packages/scipy/stats/tests/
test_morestats.py", line 101, in check_data 
    pval = stats.binom_test(100,250) 
  File "/usr/lib/python2.3/site-packages/scipy/stats/morestats.py", line 
683, in binom_test 
    d = distributions.binom.pdf(x,n,p) 
AttributeError: binom_gen instance has no attribute 'pdf' 

====================================================================== 
ERROR: check_pdf 
(scipy.stats.distributions.test_distributions.test_randint) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
(Continue reading)


Gmane