Vineet Jain | 1 Feb 18:05 2004

question/request with Numeric compress and putmask

I'm using the Numeric arrays for financial data elements. I'm interfacing
with an external c library which does not support invalid elements. To get
around this I maintain a separate mask array in my python class which
denotes which elements are valid. I then use the compress function with the
mask array to get an array with valid elements which I pass to the c
function.

I was then going to use the putmask to assign the returned values to their
corresponding place in the original array. This obviously (after reading the
documentation) is not going to work.

Example:

financial_data 	= [10, 11, 22, 33, INVALID, INVALID, 44, 55]
full_return_value = INVALID+zeros(lenfinancial_data)

my_mask 		= [1, 1, 1, 1, 0, 0, 1, 1]
compressed_data	= compress(financiali_data, my_mask)
			  [10, 11, 22, 33, 44, 55]

return_value 	= some_c_function(compressed_data)

Now the problem I have is copying the values in return_value to their
original place in the financial_data. I was happily going to use putmask
till about an hour back when I found out that this is not going to work.

What I would like to do is:

putmask(full_return_value, my_mask, return_value)

(Continue reading)

Nadav Horesh | 2 Feb 11:49 2004

Bug in fft module?

In numarray 0.8.1 running, fft (inverse_fft, real_fft etc.) on an empty 
array results in a segmentation fault.

System: Python 2.3.3 compiled with gcc 3.3.2, on RH9.

   Nadav.

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Todd Miller | 2 Feb 14:53 2004

Re: Bug in fft module?

On Mon, 2004-02-02 at 05:49, Nadav Horesh wrote:
> In numarray 0.8.1 running, fft (inverse_fft, real_fft etc.) on an empty 
> array results in a segmentation fault.
> 
> System: Python 2.3.3 compiled with gcc 3.3.2, on RH9.

Hi Nadav,

What do you mean by "empty", zero length?

Todd

> 
>    Nadav.
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
--

-- 
Todd Miller 			
Space Telescope Science Institute
3700 San Martin Drive
Baltimore MD, 21030
(Continue reading)

Todd Miller | 2 Feb 14:58 2004

Re: numarray-0.8.1

On Fri, 2004-01-30 at 21:32, Austin Luminais wrote:
> 
> Hello, is there any place I can download a Windows installer for numarray 
> 0.8.1?  I upgraded to 0.8.2 a while back, but it does not work with 
> McMillan's Installer.  0.8.1 worked fine, but I neglected to keep a copy of it.

As a public release,  numarray-0.8.1 doesn't really exist yet;  0.8.1 is
a tag in CVS which defines a release being used internally at STScI. 
I'm not sure what you mean by 0.8.2 at all.

> 
> As for why it doesn't work with Installer, I'm not sure.  At least part of 
> the problem is that it is hardcoded to load LICENSE.TXT in __init__.py in a 
> way that is incompatible with Installer.
> I tried removing the loading of LICENSE.TXT (which I realize is a 
> questionable thing to do; I was just trying to get it working), but it 
> doesn't work after that either.

This has been fixed in CVS,  but there is no official release with it
yet.

> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
(Continue reading)

Nadav Horesh | 2 Feb 16:18 2004

RE: Bug in fft module?


-----Original Message-----
From:	Todd Miller [mailto:jmiller <at> stsci.edu]
Sent:	Mon 02-Feb-04 15:53
To:	Nadav Horesh
Cc:	numpy-discussion
Subject:	Re: [Numpy-discussion] Bug in fft module?
On Mon, 2004-02-02 at 05:49, Nadav Horesh wrote:
> In numarray 0.8.1 running, fft (inverse_fft, real_fft etc.) on an empty 
> array results in a segmentation fault.
> 
> System: Python 2.3.3 compiled with gcc 3.3.2, on RH9.

Hi Nadav,

What do you mean by "empty", zero length?

==> YES: Something like: fft(array([]))

Todd

> 
>    Nadav.
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
(Continue reading)

Todd Miller | 2 Feb 16:43 2004

RE: Bug in fft module?

On Mon, 2004-02-02 at 10:18, Nadav Horesh wrote:
> 
> 
> 
> -----Original Message-----
> From:	Todd Miller [mailto:jmiller <at> stsci.edu]
> Sent:	Mon 02-Feb-04 15:53
> To:	Nadav Horesh
> Cc:	numpy-discussion
> Subject:	Re: [Numpy-discussion] Bug in fft module?
> On Mon, 2004-02-02 at 05:49, Nadav Horesh wrote:
> > In numarray 0.8.1 running, fft (inverse_fft, real_fft etc.) on an empty 
> > array results in a segmentation fault.
> > 
> > System: Python 2.3.3 compiled with gcc 3.3.2, on RH9.
> 
> Hi Nadav,
> 
> What do you mean by "empty", zero length?
> 
> ==> YES: Something like: fft(array([]))

Looks like a bug in the fft wrapper code to me.  

I can either make it a no-op or make it raise an exception.  I'm leaning
towards the former... do you care which?

Todd

> 
(Continue reading)

Austin Luminais | 2 Feb 17:29 2004
Picon

Re: numarray-0.8.1


>
>As a public release,  numarray-0.8.1 doesn't really exist yet;  0.8.1 is
>a tag in CVS which defines a release being used internally at STScI.
>I'm not sure what you mean by 0.8.2 at all.

Thanks, I must have been confusing it with the older 0.6.1 and 0.6.2.

>This has been fixed in CVS,  but there is no official release with it
>yet.

Do you know if it has been fixed beyond the LICENSE.TXT change?
I got the new __init__.py from CVS, but I get an abnormal program 
termination with Installer.

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Travis E. Oliphant | 2 Feb 05:31 2004

Re: question/request with Numeric compress and putmask

Vineet Jain wrote:

> I'm using the Numeric arrays for financial data elements. I'm interfacing
> with an external c library which does not support invalid elements. To get
> around this I maintain a separate mask array in my python class which
> denotes which elements are valid. I then use the compress function with the
> mask array to get an array with valid elements which I pass to the c
> function.
> 
> What I would like to do is:
> 
> putmask(full_return_value, my_mask, return_value)
> 
> where return_value is treated like a list so that every 1 that is found in
> my_mask the next element in return_value is used. Is their anything that
> matches this?
> 

There are functions in SciPy to handle exactly this situation.

 >>> from scipy import *
 >>> info(insert)
  insert(arr, mask, vals)

Similar to putmask arr[mask] = vals but 1d array vals has the
same number of elements as the non-zero values of mask. Inverse of extract.
 >>> info(extract)
  extract(condition, arr)

Elements of ravel(condition) where ravel(condition) is true (1-d)
(Continue reading)

Austin Luminais | 2 Feb 18:46 2004
Picon

Re: numarray-0.8.1


Nevermind, just tried the full CVS version and it seems to be working fine.
You have to manually include .pyds that Installer doesn't catch, but that's 
always been the case.

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Chris Burns | 3 Feb 00:55 2004

conditionals not fully implemented?

Hello.

I've graduated from numeric to numarray and been enjoying all the nifty
features, but I'm puzzled by the following behaviour when using conditionals
in a function like nonzero():

>>> import numarray
>>> print numarray.__version__
0.8
>>> x = numarray.arange(10)
>>> numarray.nonzero(x < 5)
(array([0, 1, 2, 3, 4]),)

So far so good

>>> numarray.nonzero(x < 5 and x > 2)
(array([3, 4, 5, 6, 7, 8, 9]),)
>>> numarray.nonzero((x < 5 and x > 2))
(array([3, 4, 5, 6, 7, 8, 9]),)
>>> numarray.nonzero( 2 < x < 5 )
(array([0, 1, 2, 3, 4]),)
>>> numarray.nonzero( (x < 5) * (x > 2) )
(array([3, 4]),)

So, only this last construction let's me get what I want.  Am I doing something
wrong or is the use of 'and' and 'or' not implemented for conditionals?

Thanks.

Chris
(Continue reading)


Gmane