David Cournapeau | 2 Jul 2007 06:45
Picon
Picon

[scikits] setuptools, tests and subpackages

Hi,

    I would like to know if anyone knowledgable about setuptools knows 
the best way to tell setuptools how to call unittests in a packages 
containing subpackages ? In a scipy package, having a test function in 
__init__ is enough to get the unittests added to the whole scipy test 
suite, but with setuptools, how do I do that ?

    cheers,

    David
Robert Kern | 2 Jul 2007 18:21
Picon
Gravatar

Re: [scikits] setuptools, tests and subpackages

David Cournapeau wrote:
> Hi,
> 
>     I would like to know if anyone knowledgable about setuptools knows 
> the best way to tell setuptools how to call unittests in a packages 
> containing subpackages ? In a scipy package, having a test function in 
> __init__ is enough to get the unittests added to the whole scipy test 
> suite, but with setuptools, how do I do that ?

http://peak.telecommunity.com/DevCenter/setuptools#test-build-package-and-run-a-unittest-suite

--

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco
Niels L. Ellegaard | 2 Jul 2007 21:31
Picon

Re: equivalent to online Octave calculator?

dmitrey <openopt <at> ukr.net> writes:
> has numpy/scipy project something equivalent to online Octave calculator?
> http://www.online-utility.org/math/math_calculator.jsp

I found web a webpage that allows you to try of python online, but it
doesn't provide scipy.

http://www.mired.org/home/mwm/try_python/

                   Niels
David Cournapeau | 3 Jul 2007 08:16
Picon
Picon

Implementing a distance matrix between two sets of vectors concept

Hi,

    for my machine learning toolbox, I need the concept of distance 
matrix, that is for two sets of vectors v and u (N u and M v), of 
dimension d, I want to compute the matrix D such as d(i,j) = 
distance(v_i, u_j). This is easy to do in numpy, but for big datasets, 
this becomes difficult without a significance loss of efficiency or big 
memory consumption.
    So I am thinking about implementing it in C. I think the overall 
concept is useful for other people, so before implementing something, I 
was wondering if other people would need/use it, and what would they need:
    - several distance (Euclidian, Mahalanobis, etc...), which would be 
a separate object to handle different sets of parameters.
    - C Api ?
    - datatypes ? Layout ? Contiguity ?
    - handling Nan ?

     cheers,

    David
Bill Baxter | 3 Jul 2007 11:36
Picon
Gravatar

Re: Implementing a distance matrix between two sets of vectors concept

I would use it. 

I only need Euclidean distance,
Python API only is ok. 
Data-types: float and double would do it for me.  Double only if it's too much effort to do both.
Order -- all combos of F and C both would be nice, but not critical
Strides -- with strides better than without, but not critical
nan -- don't need it.

--bb

On 7/3/07, David Cournapeau < david <at> ar.media.kyoto-u.ac.jp> wrote:
Hi,

    for my machine learning toolbox, I need the concept of distance
matrix, that is for two sets of vectors v and u (N u and M v), of
dimension d, I want to compute the matrix D such as d(i,j) =
distance(v_i, u_j). This is easy to do in numpy, but for big datasets,
this becomes difficult without a significance loss of efficiency or big
memory consumption.
    So I am thinking about implementing it in C. I think the overall
concept is useful for other people, so before implementing something, I
was wondering if other people would need/use it, and what would they need:
    - several distance (Euclidian, Mahalanobis, etc...), which would be
a separate object to handle different sets of parameters.
    - C Api ?
    - datatypes ? Layout ? Contiguity ?
    - handling Nan ?

     cheers,

    David
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev

_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
Christopher Hanley | 3 Jul 2007 18:25

ndimage problems

Hi,

We have found two problems with ndimage.  I have filed a ticket #455 on 
the scipy trac page.  The first problem can be seen with this example:

 > import numpy as n
 > from scipy import ndimage as nd
 > a = n.ones((10,5),dtype=n.float32) * 12.3
 > x = nd.rotate(a,90.0)
 > x
Out[17]:
array([[ 12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019,  12.30000019,  12.30000019,
         0.        ,   0.        ],
      [ 12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019],
      [ 12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019],
      [ 12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019],
      [ 12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019,  12.30000019,  12.30000019,
        12.30000019,  12.30000019]], dtype=float32)
}}}

Notice that the last two entries of the first row are now 0.

The second problem has to do with the reversing of byte order if you 
have big-endian data on a little endian machine.  Please see the example 
below:

 >>> a = N.ones ((2,3), dtype=N.float32) * 12.3
 >>> a = a.byteswap()
 >>> a.dtype = a.dtype.newbyteorder (">")
 >>> print a
[[ 12.30000019 12.30000019 12.30000019]
[ 12.30000019 12.30000019 12.30000019]]
 >>> print ndimage.rotate (a, 90.)
[[ 0.00000000e+00 -4.28378144e+08]
[ 0.00000000e+00 -4.28378144e+08]
[ -4.28378144e+08 -4.28378144e+08]]

I have taken a look at the ndimage python code and cannot find any 
explicit calls to byteswap.  I'm guessing something is funny in one of 
the c-api calls.  I haven't been able to track it down yet.

Chris
Peter Skomoroch | 3 Jul 2007 20:10
Picon

Re: Implementing a distance matrix between two sets of vectors concept

I've rolled my own in the past.  If the vectors are really large and you are holding a collection of them, you probably want to use a sparse matrix data structure in either numpy or C.

On 7/3/07, Bill Baxter <wbaxter <at> gmail.com> wrote:
I would use it. 

I only need Euclidean distance,
Python API only is ok. 
Data-types: float and double would do it for me.  Double only if it's too much effort to do both.
Order -- all combos of F and C both would be nice, but not critical
Strides -- with strides better than without, but not critical
nan -- don't need it.

--bb


On 7/3/07, David Cournapeau < david <at> ar.media.kyoto-u.ac.jp> wrote:
Hi,

    for my machine learning toolbox, I need the concept of distance
matrix, that is for two sets of vectors v and u (N u and M v), of
dimension d, I want to compute the matrix D such as d(i,j) =
distance(v_i, u_j). This is easy to do in numpy, but for big datasets,
this becomes difficult without a significance loss of efficiency or big
memory consumption.
    So I am thinking about implementing it in C. I think the overall
concept is useful for other people, so before implementing something, I
was wondering if other people would need/use it, and what would they need:
    - several distance (Euclidian, Mahalanobis, etc...), which would be
a separate object to handle different sets of parameters.
    - C Api ?
    - datatypes ? Layout ? Contiguity ?
    - handling Nan ?

     cheers,

    David
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev


_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev




--
Peter N. Skomoroch
peter.skomoroch <at> gmail.com
http://www.datawrangling.com
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
Lino Mastrodomenico | 4 Jul 2007 01:22
Picon

PEP 368: Standard image protocol and class

[Sorry for the cross-posting, but I think this may be relevant for
both NumPy and ndimage.]

Hello everyone,

I have submitted to the Python core developers a new PEP (Python
Enhancement Proposal):

   http://www.python.org/dev/peps/pep-0368/

It proposes two things:

 * the creation of a standard image protocol/interface that can be
hopefully implemented interoperably by most Python libraries that
manipulate images;

 * the addition to the Python standard library of a basic
implementation of the new protocol.

The new image protocol is heavily inspired by a subset of the NumPy
array interface, with a few image-specific additions and changes (e.g.
the "size" attribute of an image is a tuple (width, height)).

Of course it would be wonderful if these new image objects could
interoperate out-of-the-box with numpy arrays and ndimage functions.
There is another proposal that would be very useful for that, PEP 3118
by Travis Oliphant and Carl Banks:

    http://www.python.org/dev/peps/pep-3118/

The image PEP (368) currently lists only modes based on uint8/16/32
numbers, but the final version will probably also include modes based
on float32 and float16 (converted in software to/from float32/64 when
necessary).

A discussion about it is currently going on in the python-3000 mailing list:

<http://mail.python.org/pipermail/python-3000/2007-July/thread.html#8648>

Any suggestion, comment or criticism from the NumPy/SciPy people would
be very useful, but IMHO keeping the discussion only on the
python-3000 ML may be a good idea, to avoid duplicating answers on
different mailing lists.

Thanks in advance.

--

-- 
Lino Mastrodomenico
E-mail: l.mastrodomenico <at> gmail.com
Bill Baxter | 4 Jul 2007 03:24
Picon
Gravatar

Re: PEP 368: Standard image protocol and class

I'm not subscribed to the main Python list, so I'll just ask here.

It looks like the protocol doesn't support any floating point image formats, judging from the big table of formats in the PEP.  These are becoming more important these days in computer graphics as a way to pass around high dynamic range images.  OpenEXR is the main example of such a format: http://www.openexr.com/.  I think a PEP that aims to be a generic image protocol should support at least 32 bit floats if not 64-bit doubles and 16 bit "Half"s used by some GPUs (and supported by the OpenEXR format).

---bb

On 7/4/07, Lino Mastrodomenico <l.mastrodomenico <at> gmail.com> wrote:
[Sorry for the cross-posting, but I think this may be relevant for
both NumPy and ndimage.]

Hello everyone,

I have submitted to the Python core developers a new PEP (Python
Enhancement Proposal):

   http://www.python.org/dev/peps/pep-0368/

It proposes two things:

* the creation of a standard image protocol/interface that can be
hopefully implemented interoperably by most Python libraries that
manipulate images;

* the addition to the Python standard library of a basic
implementation of the new protocol.

The new image protocol is heavily inspired by a subset of the NumPy
array interface, with a few image-specific additions and changes ( e.g.
the "size" attribute of an image is a tuple (width, height)).

Of course it would be wonderful if these new image objects could
interoperate out-of-the-box with numpy arrays and ndimage functions.
There is another proposal that would be very useful for that, PEP 3118
by Travis Oliphant and Carl Banks:

    http://www.python.org/dev/peps/pep-3118/

The image PEP (368) currently lists only modes based on uint8/16/32
numbers, but the final version will probably also include modes based
on float32 and float16 (converted in software to/from float32/64 when
necessary).

A discussion about it is currently going on in the python-3000 mailing list:

<http://mail.python.org/pipermail/python-3000/2007-July/thread.html#8648 >

Any suggestion, comment or criticism from the NumPy/SciPy people would
be very useful, but IMHO keeping the discussion only on the
python-3000 ML may be a good idea, to avoid duplicating answers on
different mailing lists.

Thanks in advance.

--
Lino Mastrodomenico
E-mail: l.mastrodomenico <at> gmail.com
_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev

_______________________________________________
Scipy-dev mailing list
Scipy-dev <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-dev
David Cournapeau | 4 Jul 2007 09:52
Picon
Picon

Re: Implementing a distance matrix between two sets of vectors concept

Peter Skomoroch wrote:
> I've rolled my own in the past.  If the vectors are really large and 
> you are holding a collection of them, you probably want to use a 
> sparse matrix data structure in either numpy or C.
Mmm, not sure to understand what you mean. The problem is that you have 
{u_1, ... , u_N} and {v_1, ..., v_M} vectors, and you want the distance 
for any possible combination {u_i, v_j}, which is a real (eg the actual 
size of the matrix in memory does not depends on the dimension of the 
data, only on N and M). I don't see how sparsity can help help here ?

David

Gmane