[Numpy-discussion] Unique() function and avoiding Loop

2013-07-05 Thread Bakhtiyor Zokhidov
Hi everybody, I have a problem with sorting out the following function. What I expect is that I showed as an example below. Two problems are encountered to achieve the result: 1) The function sometimes can't not sort as expected: I showed an example for that below. 2) I could not do vectorizat

[Numpy-discussion] Avoiding messy code in Python

2013-06-12 Thread Bakhtiyor Zokhidov
Hi, I have some code more or less 500 lines, but very messy code. All codes containing several functions are in one module, besides, without documentation and testing. Could anyone give me some advice to organize my messy code in an accurate style including test function as well? Any answers

Re: [Numpy-discussion] Equvalent function for Ceil() and Floor()

2013-05-20 Thread Bakhtiyor Zokhidov
NOAA Federal : >On Mon, May 20, 2013 at 8:54 AM, Bakhtiyor Zokhidov >< bakhtiyor_zokhi...@mail.ru > wrote: > >> what about the following example: >>>>>new_ceil(-0.24, 0.25) >> -0.0 > >ceil rounds toward +inf (and floor towards -inf) -- this is exactl

Re: [Numpy-discussion] Equvalent function for Ceil() and Floor()

2013-05-20 Thread Bakhtiyor Zokhidov
thanks a lot what about the following example: >>>new_ceil(-0.24, 0.25) -0.0 ??? thanks in advance for the reply Понедельник, 20 мая 2013, 16:37 +01:00 от Robert Kern : >On Mon, May 20, 2013 at 4:21 PM, Bakhtiyor Zokhidov >< bakhtiyor_zokhi...@mail.ru > wrote: >> H

[Numpy-discussion] Equvalent function for Ceil() and Floor()

2013-05-20 Thread Bakhtiyor Zokhidov
Hello, I am using ceil() and floor() function to get upper and lower value of some numbers. Let's say: import math x1 = 0.35 y1 = 4.46 >>> math.ceil(x1) 1.0 >>> math.floor(y1) 4.0 The problem is that If I want to get upper and lower values for the certain step, for example, step = 0.25, ceil(

[Numpy-discussion] Matching line points with grid coordinates numerically

2013-05-06 Thread Bakhtiyor Zokhidov
Dear Python users, I am having difficulty with numerically scaling to match line coordinates vs grid cell size coordinates. I want to calculate the following function: F =   distance_of_crossed_line x intersected_cell_value The problem here is that when I calculate crossed_line_length in line c

Re: [Numpy-discussion] "Lists" and "Join" function needed

2013-05-05 Thread Bakhtiyor Zokhidov
Thanks for the answer in Stackoverflow. I checked it out. Суббота, 4 мая 2013, 21:24 -04:00 от Warren Weckesser : >On 5/4/13, Bakhtiyor Zokhidov < bakhtiyor_zokhi...@mail.ru > wrote: >> >> Hi, >> I have the following code which represents intersected point of ea

[Numpy-discussion] "Lists" and "Join" function needed

2013-05-04 Thread Bakhtiyor Zokhidov
Hi, I have the following code which represents intersected point of each cell in the given two points, A(x0,y0) and B(x1,y1). def intersected_points(x0, x1, y0, y1): # slope m = (y1 - y0 )/( x1 - x0) # Boundary of the selected points x_ceil = ceil( min (x0, x1 )) x_floor = floor( max(x0, x1)) y

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

2013-04-19 Thread Bakhtiyor Zokhidov
.view('int8').astype(float) >f -= f.mean() >maybe_here = np.argmax(np.convolve(f,f))/2 >magic = 10 >print s[maybe_here - magic:maybe_here + magic + 1] > > >Let us now how to assign significance to the result and to find optimal 'magic' > >Val > > &

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

2013-04-19 Thread Bakhtiyor Zokhidov
Hello everybody, I just have one long string type:ThesampletextthatcouldbereadedthesameinbothordersArozaupalanalapuazorA The result I want to take is ArozaupalanalapuazorA - which means reading directly each letter should be the same as reading reversely ...  Is there any function which can d