How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
All: I've got a script that runs really slow because I'm reading from a stream a byte at a time: // TERRIBLE for y in range( height ): for color in range(4): for x in range( width ): pixelComponent = fileIO.read(4) buffer = unpack("!f",pix

RE: How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
08 09:11:23 -0700> From: [EMAIL PROTECTED]> To: [EMAIL > PROTECTED]> CC: python-list@python.org> Subject: Re: How do I use the unpack > function?> > Marlin Rowley wrote:> > All:> >> > I've got a script that runs > really slow because I'm r

RE: How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
hon.org> Subject: Re: How do I use the unpack > function?> > Marlin Rowley wrote:> > Thanks for the advice!> > > > However, I > assumed that:> > > > fourbytes = pixelComponent[:4]> > > > would shave that > byte off the array in pixelCom

RE: How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
tes and can be any format. > Date: Thu, 15 May 2008 10:09:45 -0700 > From: [EMAIL PROTECTED] > CC: python-list@python.org > Subject: Re: How do I use the unpack function? > > John Machin wrote: > > On May 16, 2:11 am, Gary Herron <[EMAIL PROTECTED]> wrote: > >

RE: How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
Thanks. I'll churn on this for awhile.. > Date: Thu, 15 May 2008 16:00:03 -0700> From: [EMAIL PROTECTED]> To: > python-list@python.org> Subject: Re: How do I use the unpack function?> > > Marlin Rowley wrote:> > Hey Gary!> > Please keep such discus

numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
All: I'm getting different floating point values when I use numpy vs. unpack(). frgba = numpy.frombuffer(, dtype=float32) buffer = unpack("!f", byte) frgba[0] != buffer[0] why? This is forcing me use the unpack() function since it's giving me the correct values. What am I doing wrong?

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
Thank you! That solved it! -M > To: python-list@python.org> From: [EMAIL PROTECTED]> Subject: Re: > numpy.frombuffer != unpack() ??> Date: Fri, 16 May 2008 17:25:00 -0500> > > Marlin Rowley wrote:> > All:> > > > I'm getting different float

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
M > To: python-list@python.org> From: [EMAIL PROTECTED]> Subject: Re: > numpy.frombuffer != unpack() ??> Date: Fri, 16 May 2008 17:25:00 -0500> > > Marlin Rowley wrote:> > All:> > > > I'm getting different floating point > values when I use numpy vs

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
008 17:08:20 -0700> From: [EMAIL PROTECTED]> To: [EMAIL > PROTECTED]; python-list@python.org> Subject: Re: numpy.frombuffer != unpack() > ??> > Marlin Rowley wrote:> > All:> > > > Say I have an array:> > > > a = > ([''],

RE: numpy.frombuffer != unpack() ??

2008-05-16 Thread Marlin Rowley
array of floats: rgbrgbrgbrgb[from height-1]rgbrgbrgb[height = 0] this is my final array to be drawn on the screen! > To: python-list@python.org> From: [EMAIL PROTECTED]> Subject: Re: > numpy.frombuffer != unpack() ??> Date: Fri, 16 May 2008 18:50:38 -0500> >

how to use the transpose function in numpy?

2008-05-17 Thread Marlin Rowley
All: Say I have a series of arrays arranged like so: [[[0,1,2,3] [4,5,6,7] [8,9,10,11] [12,13,14,15]] [[16,17,18,19] [20,21,22,23] [24,25,26,27] [28,29,30,31]]] Now if I do this: transpose((2,0,1)), I get this: [[[0,4,8,12] [16,20,24,28]] [[1,5,9,13] [17,21,25,29]] [[2,6,10,14][18,22,26,3

RE: numpy.frombuffer != unpack() ??

2008-05-17 Thread Marlin Rowley
10,14][3,7,11,15][16,20,24,28][17,21,25,29][18,22,26,30][19,23,27,31] How do I do this? -M > Date: Sat, 17 May 2008 08:58:08 -0700> From: [EMAIL PROTECTED]> To: [EMAIL > PROTECTED]> CC: python-list@python.org> Subject: Re: numpy.frombuffer != > unpack() ??> > Marli

RE: numpy.frombuffer != unpack() ??

2008-05-17 Thread Marlin Rowley
hon.org> Subject: Re: numpy.frombuffer != > unpack() ??> > Marlin Rowley wrote:> > Actually in my traversal of the > never-ending maze of understanding > > arrays in python, I stumbled that the > data in the wrong sequence.> >> > Let's get back to this transpos

unpack() exploration!

2008-05-19 Thread Marlin Rowley
All: I've got a script that runs really slow because I'm reading from a stream a byte at a time: // TERRIBLE for y in range( height ): for color in range(4): for x in range( width ): pixelComponent = fileIO.read(4) buffer = unpack("!f"

Rearranging elements (cont..)

2008-05-19 Thread Marlin Rowley
All: Say I have an array: a = ([''],['']) How do I make it so that I now have: starting with first element (a[0]) new_arr[0] = 'r' new_arr[1] = 'g' new_arr[2] = 'b' new_arr[3] = 'a' new_arr[4] = 'r' . continuing "through" a[1] with the same new_arr new_

More on numpy trickiness.

2008-05-19 Thread Marlin Rowley
All: Say I have an array: a = ([''],['']) How do I make it so that I now have: starting with first element (a[0])new_arr[0] = 'r'new_arr[1] = 'g'new_arr[2] = 'b'new_arr[3] = 'a'new_arr[4] = 'r'. continuing "through" a[1] with the same new_arrnew_arr[N] = 'r'ne

arrays

2008-05-19 Thread Marlin Rowley
All: Say I have an array: a = ([''],['']) How do I make it so that I now have: starting with first element (a[0])new_arr[0] = 'r'new_arr[1] = 'g'new_arr[2] = 'b'new_arr[3] = 'a'new_arr[4] = 'r'. continuing "through" a[1] with the same new_arrnew_arr[N] = 'r'ne

How do I make a copy of my class object?

2008-05-22 Thread Marlin Rowley
All: I have a class object which has the usual data members and functions. I'm trying to make a copy of this class (which includes wx.Bitmap objects) but deepcopy() doesn't seem to work. How would I do this? -M _ E-mail for the

RE: How do I make a copy of my class object?

2008-05-22 Thread Marlin Rowley
ct?> Date: Thu, 22 May 2008 17:52:02 -0400> > > "Marlin Rowley" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL > PROTECTED]> > I have a class object which has the usual data members and > functions.> > I'm trying to make a copy of this c

Reading floats through Telnet object?

2008-04-10 Thread Marlin Rowley
Is there any function that allows reading a stream of floats through the Telnet Object? There doesn't seem to be a way to control reading from the socket accept read_until() and that requires a string. -M _ Use video conversation

RE: How is GUI programming in Python?

2008-04-15 Thread Marlin Rowley
Hmm.. I'm just now learning wxPython and it's very very easy to me. Perhaps because I've delved into other GUI APIs like GLUT and Windows DirectX. Programming in C++ seems a pain when coming from Python. I'll let you know more when I delve more into it. -M > From: [EMAIL PROTECTED]> Subj

Passing the output of a thread to the caller.

2008-04-16 Thread Marlin Rowley
I have a thread that I've created from a main program. I started this thread and passed it a function to execute. Within this function are 'print' statements. While they are directly translated to the stdout, I would love to return them back to the program itself and store them in an object.

Which event to use for out of focus window?

2008-04-18 Thread Marlin Rowley
I think I've found a bug in the wx Library. I've created an event : EVT_IDLE that does something when the event is triggered, however, if your mouse pointer is out-of-focus on the window, the EVT_IDLE doesn't get called. It's only when the window is put into focus that the IDLE event is ca

RE: Which event to use for out of focus window?

2008-04-18 Thread Marlin Rowley
Bump. From: [EMAIL PROTECTED] To: python-list@python.org Subject: Which event to use for out of focus window? Date: Fri, 18 Apr 2008 10:25:40 -0500 I think I've found a bug in the wx Library. I've created an event : EVT_IDLE that does something when the event is triggered, however, i

Having problems with wxPython - HELP!!

2008-04-25 Thread Marlin Rowley
I'm desperately spending too much time trying to understand wxPython and it's leading me nowhere. I'm trying to make a script that will create a window, and then immediately fill this window with a background color. I also want to be able to fill this window with a background color anytime I n