[Numpy-discussion] NOOB Alert: Looping Through Text Files...

2011-01-14 Thread Benjamin Root
On Friday, January 14, 2011, dstaley wrote: > > Warning, I am a python noob.  Not only do I not know python, I really don't > know anything about programming outside of ArcInfo and the ancient AML > language.  Regardless, here is my problem > > Let's say I have three text files (test1.txt, tes

[Numpy-discussion] special function xlogy with 0log0=0

2011-01-14 Thread josef . pktd
I'm trying to fix again a case with x*log(y) which was a converted log(0**0), where x and y should broadcast. Is it possible to get a special function for this. It shows up very often, and any cheap fix, e.g. term = x*np.log(y) term[(x==0)*(y==0)] = 0 raises a warning (which I now also see) x*

Re: [Numpy-discussion] NOOB Alert: Looping Through Text Files...

2011-01-14 Thread Zachary Pincus
> textlist = ["test1.txt", "test2.txt", "test3.txt"] > > for i in textlist: > text_file = open(textlist, "a") > text_file.write("\nI suck at Python and need help") > text_file.close() > > But, this doesn't work. It gives me the error: > > coercing to Unicode: need string or buffe

[Numpy-discussion] NOOB Alert: Looping Through Text Files...

2011-01-14 Thread dstaley
Warning, I am a python noob. Not only do I not know python, I really don't know anything about programming outside of ArcInfo and the ancient AML language. Regardless, here is my problem Let's say I have three text files (test1.txt, test2.txt and test3.txt). Each text file has 1 line of te

[Numpy-discussion] isposinf returns array, isinf doesn't

2011-01-14 Thread josef . pktd
maybe just cosmetic, I just found this >>> stats.poisson.b 1.#INF >>> np.isinf(stats.poisson.b) True >>> np.isinf(-stats.poisson.b) True >>> np.isposinf(stats.poisson.b) array(True, dtype=bool) >>> np.isneginf(stats.poisson.b) array(False, dtype=bool) >>> np.isneginf(-stats.poisson.b) array(True,

Re: [Numpy-discussion] NaN value processing in weave.inline code

2011-01-14 Thread Joon Ro
Oops .. I guess isnan() inside the weave code just works fine. Should have tried this first. By the way, is there any speed lost doing this? Should I convert all NaN values into a integer and use it inside the weave inline c code?-Joon On Fri, 14 Jan 2011 14:03:16 -0600, Joon Ro wrote: Hi,I was wo

Re: [Numpy-discussion] NaN value processing in weave.inline code

2011-01-14 Thread Keith Goodman
On Fri, Jan 14, 2011 at 12:03 PM, Joon Ro wrote: > Hi, > I was wondering if it is possible to process (in if statement - check if the > given value is NaN) numpy NaN value inside the weave.inline c code. > > testcode = ''' > if (test(0)) { >       return_val = test(0); > } > ''' > > err = weave.in

[Numpy-discussion] NaN value processing in weave.inline code

2011-01-14 Thread Joon Ro
Hi,I was wondering if it is possible to process (in if statement - check if the given value is NaN) numpy NaN value inside the weave.inline c code.testcode = '''if (test(0)) {      return_val = test(0);}'''err = weave.inline(testcode, ['test'], type_converters = converters.blit

Re: [Numpy-discussion] Is python 3 supported or not?

2011-01-14 Thread Sebastian Haase
On Fri, Jan 14, 2011 at 9:26 AM, Gael Varoquaux wrote: > On Thu, Jan 13, 2011 at 10:49:17AM -0800, David Cortesi wrote: >> As to why I'm using Python 3, it's because I'm starting a new project >> with no prior dependencies and want the current and future language -- >> which is now TWO FRAKKIN' YE

Re: [Numpy-discussion] Is python 3 supported or not?

2011-01-14 Thread Gael Varoquaux
On Thu, Jan 13, 2011 at 10:49:17AM -0800, David Cortesi wrote: > As to why I'm using Python 3, it's because I'm starting a new project > with no prior dependencies and want the current and future language -- > which is now TWO FRAKKIN' YEARS OLD! -- but that's a rant for another > time. Oh, you're