Re: [Numpy-discussion] Reading String type to find long "magic word"

2013-04-19 Thread Val Kalatsky
+ 1] Let us now how to assign significance to the result and to find optimal 'magic' Val On Fri, Apr 19, 2013 at 6:01 PM, Bakhtiyor Zokhidov < bakhtiyor_zokhi...@mail.ru> wrote: > Hello everybody, > > I just have one long string > type:Thesampletextthatcouldber

Re: [Numpy-discussion] np.unique for one bi-dimensional array

2012-07-24 Thread Val Kalatsky
.unique(x) zip(xu['a'], xu['b'], np.bincount(np.searchsorted(xu, x))) [(4, 3, 2), (4, 4, 2), (4, 5, 1), (5, 4, 1)] Val On Tue, Jul 24, 2012 at 5:09 PM, Giuseppe Amatulli < giuseppe.amatu...@gmail.com> wrote: > Hi, > > would like to identify unique pairs of num

Re: [Numpy-discussion] fast access and normalizing of ndarray slices

2012-05-31 Thread Val Kalatsky
module to speed up your operations. Val On Thu, May 31, 2012 at 8:27 AM, Wolfgang Kerzendorf wrote: > Hey Val, > > Well it doesn't matter what I do, but specifically I do factor = > sum(data_array[start_point:start_point+length_data]) and then > data[array[start_point:sta

Re: [Numpy-discussion] fast access and normalizing of ndarray slices

2012-05-30 Thread Val Kalatsky
What do you mean by "normalized it"? Could you give the output of your procedure for the sample input data. Val On Thu, May 31, 2012 at 12:36 AM, Wolfgang Kerzendorf wrote: > Dear all, > > I have an ndarray which consists of many arrays stacked behind each other > (only

Re: [Numpy-discussion] Bus error when using flat on sliced, memmap'd array

2012-05-30 Thread Val Kalatsky
Confirmed on Ubuntu, np.__version__ 1.5.1 and 1.6.1 (backtraces are bellow). Something seems to be broken before it comes to memcpy and/or _aligned_contig_to_strided_size1. Val - np.__version__ 1.6.1 Program received signal SIGSEGV

Re: [Numpy-discussion] numpy.random.gamma returns 0 for small shape parameters

2012-05-28 Thread Val Kalatsky
You'll need some patience to get non-zeros, especially for k=1e-5 In [84]: np.sum(np.random.gamma(1e-5,size=100)!=0.0) Out[84]: 7259 that's less than 1%. For k=1e-4 it's ~7% Val On Mon, May 28, 2012 at 10:33 PM, Uri Laserson wrote: > I am trying to sample from a Diri

Re: [Numpy-discussion] Quaternion data type

2012-05-05 Thread Val Kalatsky
Hi Tod, Would you consider bundling the quaternion dtype with your package. I think everybody wins: your package would become stronger and Martin's dtype would become easily available. Thanks Val On Sat, May 5, 2012 at 6:27 AM, Tom Aldcroft wrote: > On Fri, May 4, 2012 at 11:44 PM, Ilan

Re: [Numpy-discussion] Slice specified axis

2012-04-05 Thread Val Kalatsky
hack, so your solution wins again. Cheers Val On Thu, Apr 5, 2012 at 2:52 PM, Tony Yu wrote: > Is there a way to slice an nd-array along a specified axis? It's easy to > slice along a fixed axis, e.g.: > > axis = 0: > >>> array[start:end] > > axis = 1: > >

Re: [Numpy-discussion] One question about the numpy.linalg.eig() routine

2012-04-03 Thread Val Kalatsky
to do something different, I cared about eigenvalues only (BTW my Hamiltonians were carefully crafted). Cheers Val PS I doubt anybody on this list cares to hear more about Berry's phase, should take this discussion off-line 2012/4/3 Hongbin Zhang > Hej Val, > > Thank you very mu

Re: [Numpy-discussion] One question about the numpy.linalg.eig() routine

2012-04-02 Thread Val Kalatsky
ro component of each eigenvector be positive real number. Finally to the point: it seems that numpy.linalg.eig uses these "rotations" to turn the diagonal elements in the eigenvector matrix to real positive numbers, that's why the numpy solutions looks neat. Val PS Probably nobody ca

Re: [Numpy-discussion] One question about the numpy.linalg.eig() routine

2012-04-02 Thread Val Kalatsky
arbitrary phase factor with absolute value = 1. As you can see this factor is -1 for the 2nd eigenvector and -0.99887305445887753-0.047461785427773337j for the other one. Val 2012/4/2 Hongbin Zhang > Dear Python-users, > > I am currently very confused about the Scipy routine to o

Re: [Numpy-discussion] About np array and recarray

2012-03-21 Thread Val Kalatsky
Will this do what you need to accomplish? import datetime np.array([(datetime.datetime.strptime(i[0], "%Y-%m-%d").date(), i[1]) for i in a], dtype=[('date', 'object'), ('count', 'int')]) Val On Wed, Mar 21, 2012 at 11:48 PM, Yan Tang wrote:

Re: [Numpy-discussion] float96 on windows32 is float64?

2012-03-15 Thread Val Kalatsky
769313486e+308 nexp =11 min=-max - On Thu, Mar 15, 2012 at 11:38 PM, Matthew Brett wrote: > Hi, > > On Thu, Mar 15, 2012 at 9:33 PM, Val Kalatsky wrote: > > > > I just happened to have an xp6

Re: [Numpy-discussion] float96 on windows32 is float64?

2012-03-15 Thread Val Kalatsky
I just happened to have an xp64 VM running: My version of numpy (1.6.1) does not have float128 (see more below what I get in ipython session). If you need to test something else please let me know. Val --- Enthought Python Distribution -- www.enthought.com Python 2.7.2 |EPD 7.2-2 (64-bit

Re: [Numpy-discussion] about sympy

2012-03-10 Thread Val Kalatsky
Can you? The question should be: Why sympy does not have Fresnel integrals? On Sun, Mar 11, 2012 at 1:06 AM, aa wrote: > why sympy cannot integrate sin(x**2)?? > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/m

Re: [Numpy-discussion] subclassing array in c

2012-03-08 Thread Val Kalatsky
-Ubuntu SMP Sun Sep 19 20:32:27 UTC 2010 x86_64 GNU/Linux In [4]: np.__version__ Out[4]: '1.5.1' I am afraid I will not be able to help testing it on super-nova versions of numpy. Cheers Val On Thu, Mar 8, 2012 at 1:49 AM, Christoph Gohle wrote: > Dear Val, > > I agree

Re: [Numpy-discussion] subclassing array in c

2012-03-07 Thread Val Kalatsky
]: ua.unit Out[4]: 'liter' On Wed, Mar 7, 2012 at 7:15 PM, Val Kalatsky wrote: > > Seeing the backtrace would be helpful. > Can you do whatever leads to the segfault > from python run from gdb? > Val > > > On Wed, Mar 7, 2012 at 7:04 PM, Christoph

Re: [Numpy-discussion] subclassing array in c

2012-03-07 Thread Val Kalatsky
Seeing the backtrace would be helpful. Can you do whatever leads to the segfault from python run from gdb? Val On Wed, Mar 7, 2012 at 7:04 PM, Christoph Gohle wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I have been struggeling for quite some time now.

Re: [Numpy-discussion] Determining the 'viewness' of an array, and flags.owndata confusion

2012-02-28 Thread Val Kalatsky
]: True In [76]: id(c8.base.base.base)==id(c1) Out[76]: True The graph of dependencies is only a tree, so sooner or later you'll get to the root. Val On Tue, Feb 28, 2012 at 8:06 PM, Jonathan Rocher wrote: > Thank you all for your answers. Kurt and I were training new developers on >

Re: [Numpy-discussion] is there an efficient way to get a random set of subsets/combinations?

2012-02-20 Thread Val Kalatsky
Hi Slava, Since your k is only 10, here is a quickie: import numpy as np arr = np.arange(n) for i in range(k): np.random.shuffle(arr) print np.sort(arr[:p]) If your ever get non-unique entries in a set of k=10 for your n and p, consider yourself lucky:) Val On Mon, Feb 20, 2012 at 10

Re: [Numpy-discussion] Strange PyArray_FromObject() behavior

2012-02-16 Thread Val Kalatsky
send more info. 3) Something is seriously corrupted, probably not the case, because segfault would follow quickly. Please provide more info. Val PS Is it something related to what we'll be working on (Trilinos)? On Thu, Feb 16, 2012 at 11:09 AM, Spotz, William F wrote: > I have a user

Re: [Numpy-discussion] matrix indexing

2012-02-07 Thread Val Kalatsky
instead of arr1d. 3) Caveat: np.unique is a major memory hogger, be prepared to waste ~1GB. Val On Tue, Feb 7, 2012 at 10:34 PM, Aronne Merrelli wrote: > > > On Mon, Feb 6, 2012 at 11:44 AM, Naresh Pai wrote: > >> I have two large matrices, say, ABC and DEF, each with a shape of 7000

Re: [Numpy-discussion] need advice on installing NumPy onto a Windows 7 with Python2.7 (32-bit)

2012-01-26 Thread Val Kalatsky
p for your setup. On the hand, I've done multiple EPD installations on various platforms and never had problems. Val On Thu, Jan 26, 2012 at 11:09 PM, William McLendon wrote: > Hi, > > I am trying to install NumPy (using > numpy-1.6.1-win32-superpack-python2.7) on a Windows 7 machi

Re: [Numpy-discussion] array metadata

2012-01-25 Thread Val Kalatsky
I believe there are no provisions made for that in ndarray. But you can subclass ndarray. Val On Wed, Jan 25, 2012 at 12:10 PM, Emmanuel Mayssat wrote: > Is there a way to store metadata for an array? > For example, date the samples were collected, name of the operator, etc. >

Re: [Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread Val Kalatsky
Just what Bruce said. You can run the following to confirm: np.mean(data - data.mean()) If for some reason you do not want to convert to float64 you can add the result of the previous line to the "bad" mean: bad_mean = data.mean() good_mean = bad_mean + np.mean(data - bad_mean) Val O

Re: [Numpy-discussion] Index update

2012-01-10 Thread Val Kalatsky
A - np.digitize(A, S) Should do the trick, just make sure that S is sorted and A and S do not overlap, if they do remove those items from A using set operations. Val On Tue, Jan 10, 2012 at 2:14 PM, Mads Ipsen wrote: > ** > Hi, > > Suppose you have N items, say N = 10. > > Now

Re: [Numpy-discussion] Ufuncs and flexible types, CAPI

2012-01-10 Thread Val Kalatsky
rable consequences. Yep, 1.3.0 is old, but 1.7 has same loop prototype (with some minor cosmetic change): (char **args, intp *dimensions, intp *steps, void *func) -> (char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) it probably has not change from the conception. Thanks Val On

[Numpy-discussion] Ufuncs and flexible types, CAPI

2011-12-30 Thread Val Kalatsky
OnFail: the resolution took place and did not succeed, the user is given a chance to fix it. In most of the case these callbacks are NULLs. I could patch numpy with a generic method that does it, but it's a shame not to use the good ufunc machine. Thanks for tips and suggestions. Val Kal

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread Miguel de Val-Borro
Dear Dileep, the numpy.where function returns the elements from A or 0 depending if the condition in the first argument is satisfied: B = np.where(A >= 0, A, 0) Miguel On Mon, Aug 01, 2011 at 03:01:13PM +0530, dileep kunjaai wrote: > Dear sir, >How can we fill a particular value in the place

Re: [Numpy-discussion] reading in files with fixed with format

2011-07-07 Thread Miguel de Val-Borro
The function numpy.genfromtxt reads text files into arrays. There is an example on how to deal with fixed-width columns using the delimiter argument in the docstring and in the I/O chapter of the user guide: http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html#the-delimiter-argument Migu

Re: [Numpy-discussion] Problem with Numpy and array

2011-05-12 Thread Miguel de Val-Borro
On Thu, May 12, 2011 at 12:21:46PM +0200, Claudia Chan Yone wrote: > Hi, > > I have a problem with the Numpy module, but I think it is a very basic issue > for many of you... > I have a file with numerical data (2 columns, and 5 lignes) as : > 1 2 > 3 4 > ... ... > > And I woulid like to convert

Re: [Numpy-discussion] help me

2011-03-25 Thread Miguel de Val-Borro
On Fri, Mar 25, 2011 at 05:28:50PM +0530, dileep kunjaai wrote: > Dear sir, > I have a numpy array,,. in which i have to choose only different values > only, > For example > > Let A= [ 20. 21. 22. 23. 24. 25. 20. 21. 22. 23. 24. 25. > 20. 21. 22. 23. 24. 25. 20. 21. 22. 23.

Re: [Numpy-discussion] Anybody going to PyCon?

2011-03-07 Thread Miguel de Val-Borro
Hi Gökhan, I will present a poster about astronomical data reduction and visualization on Sunday. I will arrive to Atlanta on Wednesday morning to attend a couple of tutorials before the conference and look forward to participating in sprints or other activities. Regards, Miguel On Mon, Mar 07,

Re: [Numpy-discussion] very large matrices.

2007-05-14 Thread val
an option in this type of problems. Of course, more physical details would be helpful in better understanding your problem. good luck, val - Original Message - From: "Dave P. Novakovic" <[EMAIL PROTECTED]> To: "Discussion of Numerical Python" Sent: Sund