Re: [Numpy-discussion] Short-hand array creation in `numpy.mat` style

2014-07-18 Thread Mark Miller
On Fri, Jul 18, 2014 at 3:37 AM, Nathaniel Smith n...@pobox.com wrote: On Thu, Jul 17, 2014 at 11:10 PM, Charles G. Waldman char...@crunch.io wrote: -1 on the 'arr' name. I think if we're going to support this function at all (which I'm not convinced is a good idea), it should be

Re: [Numpy-discussion] New functions.

2011-06-01 Thread Mark Miller
I'd love to see something like a count_unique function included. The numpy.unique function is handy, but it can be a little awkward to efficiently go back and get counts of each unique value after the fact. -Mark On Wed, Jun 1, 2011 at 8:17 AM, Keith Goodman kwgood...@gmail.com wrote: On Tue,

Re: [Numpy-discussion] New functions.

2011-06-01 Thread Mark Miller
...@gmail.com wrote: On Wed, Jun 1, 2011 at 11:31 AM, Mark Miller markperrymil...@gmail.com wrote: I'd love to see something like a count_unique function included. The numpy.unique function is handy, but it can be a little awkward to efficiently go back and get counts of each unique value

Re: [Numpy-discussion] np.choose() question

2010-06-08 Thread Mark Miller
Not pretty, but it works: idx array([[4, 2], [3, 1]]) times array([100, 101, 102, 103, 104]) numpy.reshape(times[idx.flatten()],idx.shape) array([[104, 102], [103, 101]]) On Tue, Jun 8, 2010 at 10:09 AM, Gökhan Sever gokhanse...@gmail.com wrote: On Tue, Jun 8,

Re: [Numpy-discussion] Fancier indexing

2008-05-22 Thread Mark Miller
You're just trying to do this...correct? import numpy items = numpy.array([0,3,2,1,4,2],dtype=int) unique = numpy.unique(items) unique array([0, 1, 2, 3, 4]) counts=numpy.histogram(items,unique) counts (array([1, 1, 2, 1, 1]), array([0, 1, 2, 3, 4])) counts[0] array([1, 1, 2, 1, 1]) On

[Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
To anyone who can help: I recently got around to installing numpy 1.04 over an older version (numpy 1.04dev3982) on a Windows Vista machine. Since then, I have been unable to compile some of my extensions using f2py. I also tested a fresh install of numpy 1.04 on a new XP machine that has never

[Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
To anyone who can help: I recently got around to installing numpy 1.04 over an older version (numpy 1.04dev3982) on a Windows Vista machine. Since then, I have been unable to compile some of my extensions using f2py. I also tested a fresh install of numpy 1.04 on a new XP machine that has never

Re: [Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
Super...I'll give it a try. Or should I just wait for the numpy 1.1 release? thanks, -Mark On Fri, May 23, 2008 at 2:45 PM, Robert Kern [EMAIL PROTECTED] wrote: On Fri, May 23, 2008 at 4:00 PM, Mark Miller [EMAIL PROTECTED] wrote: File C:\Python25\lib\site-packages\numpy\f2py\rules.py

Re: [Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
up, I rarely need to fiddle with them again. So I don't have a specific feel for what might be happening here. thanks, -Mark On Fri, May 23, 2008 at 3:01 PM, Robert Kern [EMAIL PROTECTED] wrote: On Fri, May 23, 2008 at 4:48 PM, Mark Miller [EMAIL PROTECTED] wrote: Super...I'll give

Re: [Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
Ignore last message: I seem to have figured out the next environmental variable that needed to be set. Still some lingering issues, but I'll work on them some more before pestering here again. thanks, -Mark On Fri, May 23, 2008 at 3:48 PM, Mark Miller [EMAIL PROTECTED] wrote: Thank you

Re: [Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
It appears to be there: dllcrt2.o in g95\lib. I'll re-install g95 to see if it helps. I'll also give gfortran in the meantime too. -Mark On Fri, May 23, 2008 at 4:05 PM, Robert Kern [EMAIL PROTECTED] wrote: On Fri, May 23, 2008 at 5:59 PM, Mark Miller [EMAIL PROTECTED] wrote

Re: [Numpy-discussion] f2py errors: any help interpreting?

2008-05-23 Thread Mark Miller
gfortran is doing the trick. Must be a g95 misconfiguration or some other thing that I have no ability to comprehend. Thanks for the tip about the buggy numpy 1.04. That seemed to be the most serious hurdle. -Mark On Fri, May 23, 2008 at 4:12 PM, Mark Miller [EMAIL PROTECTED] wrote

Re: [Numpy-discussion] Masked arrays and pickle/unpickle

2008-07-17 Thread Mark Miller
On Thu, Jul 17, 2008 at 3:18 PM, Pierre GM [EMAIL PROTECTED] wrote: Dang, forgot about that. Having a dictionary of options would be cool, but we can't store it inside a regular ndarray. If we write to a file, we may want to write a header first that would store all the metadata we need.

[Numpy-discussion] just curious...why does numpy.where() return tuples?

2008-09-08 Thread Mark Miller
Just for my own benefit, I am curious about this. I am running into problems because I need to archive the result (tuple) returned by a numpy.where statement. Pickle does not seem to like to deal with numpy scalars, and numpy's archiving functions (memmap) can't work on the tuple that gets

Re: [Numpy-discussion] F2PY ?? Has anyone worked with the F2PY generator?

2008-09-08 Thread Mark Miller
If numpy is installed, then f2py will be too. On the windows environment, there is a file called f2py.py that you can call from the command line. It should be in the 'scripts' directory of your Python installation. Try something like this: python c:\python25\scripts\f2py.py (of course change

Re: [Numpy-discussion] 1.2.0rc2 tagged! --PLEASE TEST--

2008-09-15 Thread Mark Miller
Warning, errors, and failures here on XP Pro (numpy installed with the python 2.5 superpack). Just passing it along, and apologies if these have already been caught. import numpy numpy.__version__ '1.2.0rc2' numpy.test() Running unit tests for numpy NumPy version 1.2.0rc2 NumPy is installed

Re: [Numpy-discussion] 1.2.0rc2 tagged! --PLEASE TEST--

2008-09-15 Thread Mark Miller
OK..thanks. That did the trick. All clear now, save for 3 known failures. Again, thanks for letting me know about this. -Mark On Mon, Sep 15, 2008 at 11:03 AM, Jarrod Millman [EMAIL PROTECTED]wrote: On Mon, Sep 15, 2008 at 10:49 AM, Mark Miller [EMAIL PROTECTED] wrote: Warning, errors

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Miller
Out of curiosity, why wouldn't numpy.apply_along_axis be a reasonable approach here. Even more curious: why is it slower than the original explicit loop? Learning, -Mark import numpy as np import timeit def baseshuffle(nx, ny): x = np.arange(nx) res = np.zeros((nx,ny),int) for

Re: [Numpy-discussion] Permutations in Simulations`

2009-02-10 Thread Mark Miller
Got it. Thanks! On Tue, Feb 10, 2009 at 1:50 PM, Keith Goodman kwgood...@gmail.com wrote: On Tue, Feb 10, 2009 at 1:41 PM, Mark Miller markperrymil...@gmail.com wrote: Out of curiosity, why wouldn't numpy.apply_along_axis be a reasonable approach here. Even more curious: why is it slower

Re: [Numpy-discussion] How to find indices of values in an array (indirect in1d) ?

2015-12-30 Thread Mark Miller
I'm not 100% sure that I get the question, but does this help at all? >>> a = numpy.array([3,2,8,7]) >>> b = numpy.array([1,3,2,4,5,7,6,8,9]) >>> c = set(a) & set(b) >>> c #contains elements of a that are in b (and vice versa) set([8, 2, 3, 7]) >>> indices = numpy.where([x in c for x in b])[0]

Re: [Numpy-discussion] How to find indices of values in an array (indirect in1d) ?

2015-12-30 Thread Mark Miller
, Nicolas P. Rougier < nicolas.roug...@inria.fr> wrote: > > Yes, it is the expected result. Thanks. > Maybe the set(a) & set(b) can be replaced by np.where[np.in1d(a,b)], no ? > > > On 30 Dec 2015, at 18:42, Mark Miller <markperrymil...@gmail.com> wrote: > &