[Numpy-discussion] parsing tab separated files into dictionaries - alternative to genfromtxt?

2009-11-11 Thread per freem
hi all, i've been using genfromtxt to parse tab separated files for plotting purposes in matplotlib. the problem is that genfromtxt seems to give only two ways to access the contents of the file: one is by column, where you can use: d = genfromtxt(...) and then do d['header_name1'] to access the

[Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

2009-10-17 Thread per freem
hi all, in my code, i use the function 'logsumexp' from scipy.maxentropy a lot. as far as i can tell, this function has no vectorized version that works on an m-x-n matrix. i might be doing something wrong here, but i found that this function can run extremely slowly if used as follows: i have an

Re: [Numpy-discussion] [SciPy-User] vectorized version of 'multinomial' sampling function

2009-10-13 Thread per freem
On Tue, Oct 13, 2009 at 7:59 PM, David Warde-Farley wrote: > On 13-Oct-09, at 5:01 PM, per freem wrote: > >> hi all, >> >> i have a series of probability vector that i'd like to feed into >> multinomial to get an array of vector outcomes back. for example, >&

[Numpy-discussion] simple array multiplication question

2009-10-12 Thread per freem
hi all, i am trying to write a simple product of 3 arrays (as vectorized code) but am having some difficulty. i have three arrays, one is a list containing several lists: p = array([[ 0.2, 0.8], [ 0.5, 0.5], [ 0.3, 0.7]]) each list in the array 'p' is of size N -- in this case N = 2. i have a

[Numpy-discussion] performance of scipy: potential inefficiency in logsumexp and sampling from multinomial

2009-10-12 Thread per freem
hi all, i have a piece of code that relies heavily on sampling from multinomial distributions and using their results to compute log probabilities. my code makes heavy use of 'multinomial' from scipy, and of 'logsumexp'. my code is unusually slow, and profiling it with Python's "cPickle" module r

[Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread per freem
hi all, i'm trying to find nonzero elements in an array, as follows: a = array([[1, 0], [1, 1], [1, 1], [0, 1]]) i want to find all elements that are [1,1]. i tried: nonzero(a == [1,0]) but i cannot interpret the output. the output i get is: (array([0, 0, 1, 2]), array([0, 1

[Numpy-discussion] pdf for multivariate normal function?

2009-07-23 Thread per freem
hi all, i'm trying to find the function for the pdf of a multivariate normal pdf. i know that the function "multivariate_normal" can be used to sample from the multivariate normal distribution, but i just want to get the pdf for a given vector of means and a covariance matrix. is there a function