Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread David Huard
Hi Ryan,

I applied your patch in r5788 on the trunk.
I noticed there was another bug occurring when both converters and usecols
are provided.
I've added regression tests for both bugs. Could you confirm that everything
is fine on your side ?

Thanks,

On Thu, Sep 4, 2008 at 4:47 PM, Ryan May [EMAIL PROTECTED] wrote:

 Travis E. Oliphant wrote:
  Ryan May wrote:
  Stefan (or anyone else who can comment),
 
  It appears that the usecols argument to loadtxt no longer accepts numpy
  arrays:
 
 
  Could you enter a ticket so we don't lose track of this.  I don't
  remember anything being intentional.
 

 Done: #905
 http://scipy.org/scipy/numpy/ticket/905

 I've attached a patch that does the obvious and coerces usecols to a
 list when it's not None, so it will work for any iterable.

 I don't think it was a conscious decision, just a consequence of the
 rewrite using different methods.  There are two problems:

 1) It's an API break, technically speaking
 2) It currently doesn't even accept tuples, which are used in the
 docstring.

 Can we hurry and get this into 1.2?

 Thanks,
 Ryan

 --
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread Ryan May
David Huard wrote:
 Hi Ryan,
 
 I applied your patch in r5788 on the trunk.
 I noticed there was another bug occurring when both converters and 
 usecols are provided.
 I've added regression tests for both bugs. Could you confirm that 
 everything is fine on your side ?
 

I can confirm that it works fine for me.  Can you or someone else 
backport this to the 1.2 branch so that this bug is fixed in the next 
release?

Thanks,

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread David Huard
Done in r5790.

On Fri, Sep 5, 2008 at 12:36 PM, Ryan May [EMAIL PROTECTED] wrote:

 David Huard wrote:
  Hi Ryan,
 
  I applied your patch in r5788 on the trunk.
  I noticed there was another bug occurring when both converters and
  usecols are provided.
  I've added regression tests for both bugs. Could you confirm that
  everything is fine on your side ?
 

 I can confirm that it works fine for me.  Can you or someone else
 backport this to the 1.2 branch so that this bug is fixed in the next
 release?

 Thanks,

 Ryan

 --
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-05 Thread Ryan May
Thanks a bunch for getting these done.

David Huard wrote:
 Done in r5790.
 
 On Fri, Sep 5, 2008 at 12:36 PM, Ryan May [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 David Huard wrote:
   Hi Ryan,
  
   I applied your patch in r5788 on the trunk.
   I noticed there was another bug occurring when both converters and
   usecols are provided.
   I've added regression tests for both bugs. Could you confirm that
   everything is fine on your side ?
  
 
 I can confirm that it works fine for me.  Can you or someone else
 backport this to the 1.2 branch so that this bug is fixed in the next
 release?
 
 Thanks,
 
 Ryan
 
 --
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org mailto:Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion
 
 
 
 
 
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion


-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] BUG in numpy.loadtxt?

2008-09-04 Thread Ryan May
Stefan (or anyone else who can comment),

It appears that the usecols argument to loadtxt no longer accepts numpy 
arrays:

 from StringIO import StringIO
 text = StringIO('1 2 3\n4 5 6\n')
 data = np.loadtxt(text, usecols=np.arange(1,3))

ValueErrorTraceback (most recent call last)

/usr/lib64/python2.5/site-packages/numpy/lib/io.py in loadtxt(fname, 
dtype, comments, delimiter, converters, skiprows, usecols, unpack)
 323 first_line = fh.readline()
 324 first_vals = split_line(first_line)
-- 325 N = len(usecols or first_vals)
 326
 327 dtype_types = flatten_dtype(dtype)

ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()

 data = np.loadtxt(text, usecols=np.arange(1,3).tolist())
 data
array([[ 2.,  3.],
[ 5.,  6.]])

Was it a conscious design decision that the usecols no longer accept 
arrays? The new behavior (in 1.1.1) breaks existing code that one of my 
colleagues has.  Can we get a patch in before 1.2 to get this working 
with arrays again?

Thanks,

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-04 Thread Travis E. Oliphant
Ryan May wrote:
 Stefan (or anyone else who can comment),

 It appears that the usecols argument to loadtxt no longer accepts numpy 
 arrays:
   

Could you enter a ticket so we don't lose track of this.  I don't 
remember anything being intentional.

-Travis

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] BUG in numpy.loadtxt?

2008-09-04 Thread Ryan May
Travis E. Oliphant wrote:
 Ryan May wrote:
 Stefan (or anyone else who can comment),

 It appears that the usecols argument to loadtxt no longer accepts numpy 
 arrays:
   
 
 Could you enter a ticket so we don't lose track of this.  I don't 
 remember anything being intentional.
 

Done: #905
http://scipy.org/scipy/numpy/ticket/905

I've attached a patch that does the obvious and coerces usecols to a 
list when it's not None, so it will work for any iterable.

I don't think it was a conscious decision, just a consequence of the 
rewrite using different methods.  There are two problems:

1) It's an API break, technically speaking
2) It currently doesn't even accept tuples, which are used in the docstring.

Can we hurry and get this into 1.2?

Thanks,
Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion