[Numpy-discussion] recfunctions.stack_arrays

2009-01-27 Thread Ryan May
together a patch. Thanks, Ryan P.S. Thanks so much for your work on putting those utility functions in recfunctions.py It makes it so much easier to have these functions available in the library itself rather than needing to reinvent the wheel over and over. -- Ryan May Graduate Research

Re: [Numpy-discussion] Bug with mafromtxt

2009-01-26 Thread Ryan May
Pierre GM wrote: On Jan 24, 2009, at 6:23 PM, Ryan May wrote: Ok, thanks. I've dug a little further, and it seems like the problem is that a column of all missing values ends up as a column of all None's. When you create a (masked) array from a list of None's, you end up with an object

Re: [Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Ryan May
(this is actually an even bigger problem when executing fftw plans), however type(a) still gives me class 'fftw3.planning.AlignedArray'. This might help some: http://www.scipy.org/Subclasses Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

[Numpy-discussion] Bug with mafromtxt

2009-01-24 Thread Ryan May
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 with mafromtxt

2009-01-24 Thread Ryan May
differently in this case, but on the other I understand why things work this way. Ryan On Jan 24, 2009, at 5:58 PM, Ryan May wrote: Pierre, I've found what I consider to be a bug in the new mafromtxt (though apparently it existed in earlier versions as well). If you have an entire column

[Numpy-discussion] Pattern for reading non-simple binary files

2009-01-23 Thread Ryan May
insight would be appreciated. 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] Numpy performance vs Matlab.

2009-01-07 Thread Ryan May
think you may have reduced the complexity a bit too much. The python code above sets all of the elements equal to a[i,j,1]. Is there any reason you can't use slicing to avoid the loops? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] Alternative to record array

2008-12-29 Thread Ryan May
ms per loop Timing for my example: In [2]: timeit data['age']+=1 10 loops, best of 3: 150 ms per loop Hope this helps. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy

Re: [Numpy-discussion] genloadtxt : last call

2008-12-17 Thread Ryan May
to how much the new function can do (and how much work you've done). Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org

Re: [Numpy-discussion] Unexpected MaskedArray behavior

2008-12-17 Thread Ryan May
Pierre GM wrote: On Dec 16, 2008, at 1:57 PM, Ryan May wrote: I just noticed the following and I was kind of surprised: a = ma.MaskedArray([1,2,3,4,5], mask=[False,True,True,False,False]) b = a*5 b masked_array(data = [5 -- -- 20 25], mask = [False True True False False

[Numpy-discussion] Unexpected MaskedArray behavior

2008-12-16 Thread Ryan May
was expecting that the underlying data wouldn't get modified while masked. Is this actual behavior expected? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion

Re: [Numpy-discussion] genloadtxt : last call

2008-12-16 Thread Ryan May
(ints, floats, etc.) to compare against after conversion to determine if they're missing. This might needlessly complicate the function, which I know you've already taken pains to optimize. If there's no good way to do it, I'm content to live with a workaround. Ryan -- Ryan May Graduate

Re: [Numpy-discussion] genloadtxt : last call

2008-12-08 Thread Ryan May
put the module in numpy.lib.io ? Elsewhere ? Thx for any comment and suggestions. Current version works out of the box for me. Thanks for running point on this. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] genloadtxt: second serving

2008-12-04 Thread Ryan May
and not somewhere in core numpy itself (missing values aside)? You have a pretty good masked array agnostic wrapper that IMO could go in numpy, though maybe not as loadtxt. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] np.loadtxt : yet a new implementation...

2008-12-03 Thread Ryan May
, this does not work because calling view does not work for object arrays. I'm just looking for a simple way to store date/time in my record array (currently a string field). Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Proposal : Here's an extension

Re: [Numpy-discussion] np.loadtxt : yet a new implementation...

2008-12-02 Thread Ryan May
an explicit delimiter has been provided, it strikes me that the code shouldn't try to further- interpret it... Does anyone else have any opinion here? I agree. If the user explicity passes something as a delimiter, we should use it and not try to be too smart. +1 Ryan -- Ryan May

Re: [Numpy-discussion] np.loadtxt : yet a new implementation...

2008-12-02 Thread Ryan May
of names in the file and expects that data to be laid out the same. Other than those, it's working fine for me here. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy

Re: [Numpy-discussion] np.loadtxt : yet a new implementation...

2008-12-01 Thread Ryan May
. 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] More loadtxt() changes

2008-11-26 Thread Ryan May
John Hunter wrote: On Tue, Nov 25, 2008 at 11:23 PM, Ryan May [EMAIL PROTECTED] wrote: Updated patch attached. This includes: * Updated docstring * New tests * Fixes for previous issues * Fixes to make new tests actually work I appreciate any and all feedback. I'm having trouble

Re: [Numpy-discussion] More loadtxt() changes

2008-11-26 Thread Ryan May
Manuel Metz wrote: Ryan May wrote: 3) Better support for missing values. The docstring mentions a way of handling missing values by passing in a converter. The problem with this is that you have to pass in a converter for *every column* that will contain missing values. If you have a text

[Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
of boilerplace (declaring dtypes, converters). While it's nothing I can't write, it still would be easier to write it once within loadtxt and have it for everyone. Any support for *any* of these ideas? Any suggestions on how the user should pass in the information? Thanks, Ryan -- Ryan May Graduate

Re: [Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
would see what you thought first. 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] More loadtxt() changes

2008-11-25 Thread Ryan May
Pierre GM wrote: On Nov 25, 2008, at 2:06 PM, Ryan May wrote: 1) It looks like the function returns a structured array rather than a rec array, so that fields are obtained by doing a dictionary access. Since it's a dictionary access, is there any reason that the header needs to be munged

Re: [Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
On Nov 25, 2008, at 2:37 PM, Ryan May wrote: What about doing the parsing and type inference in a loop and holding onto the already split lines? Then loop through the lines with the converters that were finally chosen? In addition to making my usecase work, this has the benefit of not doing

Re: [Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
fill value)? I'll post that when I'm done and we can see if it looks like too much functionality stapled together or not. Sounds like a plan. Wouldn't mind getting more feedback from fellow users before we get too deep, however... Agreed. Anyone? -- Ryan May Graduate Research Assistant

Re: [Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
on the code and on the original idea of adding these capabilities to loadtxt(). Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Index: lib/io.py === --- lib/io.py (revision 6099) +++ lib

Re: [Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
.) * I'd probably get rid of StringConverter._get_from_dtype, as it is not needed outside the __init__. You may wanna stick to the original __init__. Done. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] More loadtxt() changes

2008-11-25 Thread Ryan May
Pierre GM wrote: On Nov 25, 2008, at 10:02 PM, Ryan May wrote: Pierre GM wrote: * Your locked version of update won't probably work either, as you force the converter to output a string (you set the status to largest possible, that's the one that outputs strings). Why don't you set

[Numpy-discussion] Minimum dtype

2008-11-25 Thread Ryan May
=numpy.int32. 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] More loadtxt() changes

2008-11-25 Thread Ryan May
Pierre GM wrote: On Nov 25, 2008, at 10:02 PM, Ryan May wrote: Pierre GM wrote: * Your locked version of update won't probably work either, as you force the converter to output a string (you set the status to largest possible, that's the one that outputs strings). Why don't you set

[Numpy-discussion] numpy.loadtxt requires seek()?

2008-11-20 Thread Ryan May
to write up the patch for either . 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] numpy.loadtxt requires seek()?

2008-11-20 Thread Ryan May
Stéfan van der Walt wrote: 2008/11/20 Ryan May [EMAIL PROTECTED]: Does anyone know why numpy.loadtxt(), in checking the validity of a filehandle, checks for the seek() method, which appears to have no bearing on whether an object will work? I think this is simply a naive mistake on my part

[Numpy-discussion] Matlib docstring typos

2008-11-12 Thread Ryan May
/adding small things like this.) 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] Matlib docstring typos

2008-11-12 Thread Ryan May
Pauli Virtanen wrote: Hi, Wed, 12 Nov 2008 10:16:35 -0600, Ryan May wrote: Here's a quick diff to fix some typos in the docstrings for matlib.zeros and matlib.ones. They're causing 2 (of many) failures in the doctests for me on SVN HEAD. There are probably bound to be more

Re: [Numpy-discussion] setting element

2008-11-12 Thread Ryan May
, axis=0): slices = [slice(None)] * len(array.shape) slices[axis] = index array[slices] = value (Adapted from the code for numpy.diff) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Ryan May
, self).__setitem__(*args) def notify(self, *args): print 'notify:', args with also overriding setslice? I haven't given this much thought, but you'd also likely need to do this for the infix operators (+=, etc.). Ryan -- Ryan May Graduate Research Assistant School of Meteorology

Re: [Numpy-discussion] Loadtxt .bz2 support

2008-10-22 Thread Ryan May
Charles R Harris wrote: On Tue, Oct 21, 2008 at 1:30 PM, Ryan May [EMAIL PROTECTED] wrote: Hi, I noticed numpy.loadtxt has support for gzipped text files, but not for bz2'd files. Here's a 3 line patch to add bzip2 support to loadtxt. Ryan -- Ryan May Graduate Research Assistant

[Numpy-discussion] Loadtxt .bz2 support

2008-10-21 Thread Ryan May
Hi, I noticed numpy.loadtxt has support for gzipped text files, but not for bz2'd files. Here's a 3 line patch to add bzip2 support to loadtxt. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Index: numpy/lib/io.py

Re: [Numpy-discussion] Need **working** code example of 2-D arrays

2008-10-13 Thread Ryan May
of Tongue In Cheek :) It looks like you received some good answers to your question, but let us know if your problems persist and we'll help you sort it out. Well said. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] Array shape

2008-10-03 Thread Ryan May
give the shape you're expecting. 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] profiling line by line

2008-09-18 Thread Ryan May
, 32-bit machine. I am telling you all the time Robert to use Debian that it just works and you say, no no, gentoo is the best. :) And what's wrong with that? :) Once you get over the learning curve, Gentoo works just fine. Must be Robert K.'s fault. :) Ryan -- Ryan May Graduate Research

Re: [Numpy-discussion] A bug in loadtxt and how to convert a string array (hex data) to decimal?

2008-09-18 Thread Ryan May
={0:lambda s:int(s,16)}) HTH, 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 Ryan May
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

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

[Numpy-discussion] BUG in numpy.loadtxt?

2008-09-04 Thread Ryan May
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

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

Re: [Numpy-discussion] min() of array containing NaN

2008-08-15 Thread Ryan May
were specifically designed to add functions that work well with masked/invalid data points. Why reinvent the wheel here? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy

Re: [Numpy-discussion] 1.1.1rc1 to be tagged tonight

2008-07-20 Thread Ryan May
', 25.301), ('BOB', 27.899)], dtype=[('stid', '|S4'), ('temp', 'f8')]) Thanks, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma --- io.py.bak 2008-07-18

[Numpy-discussion] Masked array fill_value

2008-07-19 Thread Ryan May
]: masked_array(data = --, mask = True, fill_value=1e+20) In [12]: np.__version__ Out[12]: '1.1.0' Is there a reason that the fill_value isn't inherited from the parent array? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] Masked array fill_value

2008-07-19 Thread Ryan May
Eric Firing wrote: Ryan May wrote: Hi, I just noticed this and found it surprising: In [8]: from numpy import ma In [9]: a = ma.array([1,2,3,4],mask=[False,False,True,False],fill_value=0) In [10]: a Out[10]: masked_array(data = [1 2 -- 4], mask = [False False True False

[Numpy-discussion] numpy.loadtext() fails with dtype + usecols

2008-07-18 Thread Ryan May
this in for 1.1.1? Thanks, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma --- io.py.bak 2008-07-18 18:12:17.0 -0400 +++ io.py 2008-07-16 22:49:13.0 -0400 @@ -292,8 +292,13 @@ if converters is None: converters

Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Ryan May
,axis=axis) nd = len(y.shape) slice1 = [slice(None)]*nd slice2 = [slice(None)]*nd slice1[axis] = slice(1,None) slice2[axis] = slice(None,-1) return add.reduce(d * (y[slice1]+y[slice2])/2.0,axis) For me, this works fine with supplying x for axis != -1. Ryan -- Ryan May

Re: [Numpy-discussion] A correction to numpy trapz function

2008-07-12 Thread Ryan May
add an extra dimension to the end. Once I resize x, I can get this to work. You might want to look at this: http://www.scipy.org/EricsBroadcastingDoc Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Re: [Numpy-discussion] Doctest items

2008-07-01 Thread Ryan May
matplotlib code. 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] Doctest items

2008-07-01 Thread Ryan May
Robert Kern wrote: On Tue, Jul 1, 2008 at 19:19, Ryan May [EMAIL PROTECTED] wrote: Robert Kern wrote: On Tue, Jul 1, 2008 at 17:50, Fernando Perez [EMAIL PROTECTED] wrote: On Tue, Jul 1, 2008 at 1:41 PM, Pauli Virtanen [EMAIL PROTECTED] wrote: But it's a custom tweak to doctest, so it might

Re: [Numpy-discussion] ndarray methods vs numpy module functions

2008-06-23 Thread Ryan May
as module functions? Hi Bob, this is a very good question. I think the answers are a) historical reasons AND, more importantly, differing personal preferences b) I would file the missing data.diff() as a bug. It's not. Care to elaborate? -- Ryan May Graduate Research Assistant School

Re: [Numpy-discussion] Bug in numpy all() function

2008-02-06 Thread Ryan May
a built in function that will do what you want. However, you would mask that builtin with the from numpy import *. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion

Re: [Numpy-discussion] New to ctypes. Some problems with loading shared library.

2008-02-05 Thread Ryan May
= N.ctypeslib.load_library('test1ctypes.so', '.') or try to get gcc to make a test1ctypes.dylib. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http

Re: [Numpy-discussion] Nasty bug using pre-initialized arrays

2008-01-07 Thread Ryan May
Charles R Harris wrote: On Jan 7, 2008 8:47 AM, Ryan May [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Stuart Brorson wrote: I realize NumPy != Matlab, but I'd wager that most users would think that this is the natural behavior.. Well, that behavior won't

Re: [Numpy-discussion] weibull distribution has only one parameter?

2007-11-12 Thread Ryan May
the distribution differently than multiplying the distribution/density function by a number. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http

Re: [Numpy-discussion] Convert array type

2007-10-08 Thread Ryan May
array will have count elements, otherwise its size is determined by the size of string. If sep is not empty then the string is interpreted in ASCII mode and converted to the desired number type using sep as the separator between elements (extra whitespace is ignored). Ryan -- Ryan

Re: [Numpy-discussion] Accessing a numpy array in a mmap fashion

2007-08-30 Thread Ryan May
the documentation is eluding me at the moment. 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] 16bit Integer Array/Scalar Inconsistency

2007-08-02 Thread Ryan May
, but the inconsistency with scalar operation made debugging my problem more difficult. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http

[Numpy-discussion] scipy.io.loadmat incompatible with Numpy 1.0.2

2007-04-09 Thread Ryan May
is, does scipy need an update, or did something unintended creep into Numpy 1.0.2? (Hence the cross-post) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ___ Numpy-discussion mailing list Numpy-discussion

Re: [Numpy-discussion] scipy.io.loadmat incompatible with Numpy 1.0.2

2007-04-09 Thread Ryan May
Travis Oliphant wrote: Ryan May wrote: Hi, As far as I can tell, the new Numpy 1.0.2 broke scipy.io.loadmat. Yes, it was the one place that scipy used the fact that field selection of a 0-d array returned a scalar. This has been changed in NumPy 1.0.2 to return a 0-d array

<    1   2