On Tue, Feb 10, 2009 at 9:40 PM, A B wrote:
> Hi,
>
> How do I write a loadtxt command to read in the following file and
> store each data point as the appropriate data type:
>
> 12|h|34.5|44.5
> 14552|bbb|34.5|42.5
>
> Do the strings have to be read in separately from the numbers?
>
> Why would a
Hi,
How do I write a loadtxt command to read in the following file and
store each data point as the appropriate data type:
12|h|34.5|44.5
14552|bbb|34.5|42.5
Do the strings have to be read in separately from the numbers?
Why would anyone use 'S10' instead of 'string'?
dt = {'names': ('gender',
You are correct! Thanks to all!
MJ
-Original Message-
From: numpy-discussion-boun...@scipy.org
[mailto:numpy-discussion-boun...@scipy.org] On Behalf Of Keith Goodman
Sent: Tuesday, February 10, 2009 6:07 PM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] Permutations
Yeah, good point. The second argsort isn't needed. That should speed things up.
The double argsort ranks the values in the array. But we don't need that here.
On Tue, Feb 10, 2009 at 5:31 PM, wrote:
> very nice. What's the purpose of the second `.argsort(0)` ? Doesn't
> it also work without it
very nice. What's the purpose of the second `.argsort(0)` ? Doesn't
it also work without it, or am I missing something in how this works?>
Josef
On 2/10/09, Mark Janikas wrote:
> Thanks to all for your replies. I want this to work on any vector so I was
> thinking this...?
>
> import numpy as
Thanks to all for your replies. I want this to work on any vector so I was
thinking this...?
import numpy as np
import timeit
x = np.array([4.,5.,10.,3.,5.,6.,7.,2.,9.,1.])
nx = 10
ny = 100
def weirdshuffle4(x, ny):
nx = len(x)
indices = np.random.random_sample((nx,ny)).argsort(0).argso
Got it. Thanks!
On Tue, Feb 10, 2009 at 1:50 PM, Keith Goodman wrote:
> On Tue, Feb 10, 2009 at 1:41 PM, Mark Miller
> wrote:
>> 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?
>
>
On Tue, Feb 10, 2009 at 1:41 PM, Mark Miller wrote:
> 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?
I took a quick look at the apply_along_axis code. It is numpy code
(not c) and it u
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 sim
2009/2/10 Stéfan van der Walt :
> x = np.arange(dim)
> y = np.arange(dim)[:, None]
> z = np.arange(dim)[:, None, None]
Do not operate heavy machinery or attempt broadcasting while tired or
under the influence. That order was incorrect:
> z = np.arange(dim)
> y = np.arange(dim)[:, None]
> x = np.
2009/2/10 Robert Kern :
> x = np.arange(dim)[:,np.newaxis,np.newaxis]
> y = np.arange(dim)[np.newaxis,:,np.newaxis]
> z = np.arange(dim)[np.newaxis,np.newaxis,:]
Yes, sorry, I should have copied from my terminal.
I think I had
x = np.arange(dim)
y = np.arange(dim)[:, None]
z = np.arange(dim)[
Perhaps you can do something along the following lines to get around
this limitation:
#
# parameterizes the original function by delta, size.
def parameterized_function(delta, size, function):
center = (size-1)/2.0
return lambda i: function( (i-center)*delta )
# the func
On Tue, Feb 10, 2009 at 12:41 PM, Keith Goodman wrote:
> On Tue, Feb 10, 2009 at 12:28 PM, Keith Goodman wrote:
>> On Tue, Feb 10, 2009 at 12:18 PM, Keith Goodman wrote:
>>> On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote:
I want to create an array that contains a column of permutatio
On Tue, Feb 10, 2009 at 12:28 PM, Keith Goodman wrote:
> On Tue, Feb 10, 2009 at 12:18 PM, Keith Goodman wrote:
>> On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote:
>>> I want to create an array that contains a column of permutations for each
>>> simulation:
>>>
>>> import numpy as NUM
>>>
>
On Tue, Feb 10, 2009 at 12:18 PM, Keith Goodman wrote:
> On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote:
>> I want to create an array that contains a column of permutations for each
>> simulation:
>>
>> import numpy as NUM
>>
>> import numpy.random as RAND
>>
>> x = NUM.arange(4.)
>>
>> res
On Tue, Feb 10, 2009 at 11:29 AM, Mark Janikas wrote:
> I want to create an array that contains a column of permutations for each
> simulation:
>
> import numpy as NUM
>
> import numpy.random as RAND
>
> x = NUM.arange(4.)
>
> res = NUM.zeros((4,100))
>
>
> for sim in range(100):
>
> res[:,sim] =
On Tue, Feb 10, 2009 at 10:19, Stéfan van der Walt wrote:
> Hi Paul
>
> 2009/2/10 Paul Rudin :
>>
>> I've just written this snippet of code:
>>
>> result = numpy.empty((dim, dim, dim), numpy.bool)
>> for x in xrange(dim):
>>for y in xrange(dim):
>>for z in xrange(dim):
>>re
Hello All,
I want to create an array that contains a column of permutations for each
simulation:
import numpy as NUM
import numpy.random as RAND
x = NUM.arange(4.)
res = NUM.zeros((4,100))
for sim in range(100):
res[:,sim] = RAND.permutation(x)
Is there a way to do this without a loop? Thank
Hi Paul
2009/2/10 Paul Rudin :
>
> I've just written this snippet of code:
>
> result = numpy.empty((dim, dim, dim), numpy.bool)
> for x in xrange(dim):
>for y in xrange(dim):
>for z in xrange(dim):
>result[x, y, z] = ((xnear[y, z] < xfar[y, z]) and
>
Hi,
Recarrays seem to sprout extra axes when they are nested:
In [98]: np.__version__
Out[98]: '1.2.0'
In [99]: d1 = dtype( [ ('a',uint8,2), ('b',uint8,1) ] )
In [100]: d2 = dtype( [ ('c',uint8,1), ('d',d1,1) ] )
In [101]: d3 = dtype( [ ('c',uint8,1), ('d',d1,2) ] )
In [102]: a1 = zeros
Hi Hans
2009/2/10 Hans Meine :
> If you look at the patch I posted (OK, that was some weeks ago, so I'll attach
> it again for your convenience), that's (more or less) exactly what I proposed.
Would you mind adding some tests to the patch?
Cheers
Stéfan
__
This problem is on a 32bit Solaris 8 system.
==
FAIL: Test find_duplicates
--
Traceback (most recent call last):
File "/usr/ra/pyssg/2.5.1/numpy/lib/tests/test
On Tuesday 10 February 2009 11:11:38 Markus Rosenstihl wrote:
> i usually do something like this:
>
> a = random.rand(3000)
> a.resize((1000,3))
> vec_norms = sqrt(sum(a**2,axis=1))
If you look at the patch I posted (OK, that was some weeks ago, so I'll attach
it again for your convenience), that
I've just written this snippet of code:
result = numpy.empty((dim, dim, dim), numpy.bool)
for x in xrange(dim):
for y in xrange(dim):
for z in xrange(dim):
result[x, y, z] = ((xnear[y, z] < xfar[y, z]) and
(ynear[x, z] < yfar[x, z]) and
> 2009/2/10 James Watson :
> I want to make sure diffs are against latest code, but keep getting
> this svn error:
> svn update
> svn: OPTIONS of 'http://scipy.org/svn/numpy/trunk': Could not read
> status line: Connection reset by peer (http://scipy.org)
There is some problem at the moment.
This
I'm taking Chuck and Bruce's suggestions and making sure that the
changes are compatible with Python 2.4 and 2.6.
I want to make sure diffs are against latest code, but keep getting
this svn error:
svn update
svn: OPTIONS of 'http://scipy.org/svn/numpy/trunk': Could not read
status line: Connectio
Hi Stephen,
A Tuesday 10 February 2009, Stephen Simmons escrigué:
> I have lots of LZO-compressed datasets created with PyTables.
> There's a real barrier to using both h5py and PyTables if the fast
> decompressor options are just LZF on h5py and LZO on PyTables.
You can always use ptrepack utili
Am 20.11.2008 um 11:11 schrieb Hans Meine:
> Hi,
>
> I have a 2D matrix comprising a sequence of vectors, and I want to
> compute the
> norm of each vector. np.linalg.norm seems to be the best bet, but
> it does not
> support axis. Wouldn't this be a nice feature?
Hi,
i usually do somethi
A Monday 09 February 2009, Ondrej Certik escrigué:
> On Mon, Feb 9, 2009 at 12:15 PM, Andrew Collette
wrote:
> > =
> > Announcing HDF5 for Python (h5py) 1.1
> > =
> >
> > What is h5py?
> > -
> >
> > HDF5 for Pytho
Hi Stephen,
There are no immediate plans to support LZO in h5py, and in fact I'm
starting to regret including any fast compressor at all as I'm now
responsible for maintaining it. :) The reason for the dichotomy is
that LZO is released under the GPL, which is incompatible with h5py's
license. The
30 matches
Mail list logo