[Tutor] How best to create a sharp telemetry log file - from one long string of teletry?

Bill Gillespie billintucson@yahoo.com
Thu Jan 23 16:15:02 2003


Hi Folks,

I want to say thanks to the group for some help I recieved a few months
ago in writing a simple GUI in tkinter. The finished gui source code as
well as some screen shots of what it looks like is available here: 
http://www.noao.edu/noao/staff/gillespie/projects/oftc-gui-software-demo.html

Now I'm trying to write a nicely formatted log file out of a single
string of telemtry that I read of a serial line. 

The string had 40 different values - numbers such a "120", and titles
sucs as "OFT" There are 40 of these seperated by white space. 

What is the best way to extract just the numerical values from the long
string, and then write them into a nicely formatted log file, that will
place each numerical value into it's own column? 

I've learned about the string format codes from Alan's book (page 32)
but I do not know where to insert the formatting operation. Nor do I
understand the best way to slice up the string and then operate on the
slices. 

Alans shows an exaple that I'd like to apply that I think will give me
the format I need - but I dont know where or how to apply it to the 20
number sclices from the string. The format is this:
say for the value of 120.

'%8.2f' % 120

Here is an example of what I'm trying to do:

1) read single long telemetry string from serial line (using pyserial
module)

2) slice string up into seperate segments such as 120, 213, OFT, -8,
-311, OCI,etc. Discard all of the non-number segments and keep the
numbers. 

3) append the new telemetry slices into a new row in the log file,
using string foramtting conventions - so that the log file generates
even columns even though the number of places and sign values in the
telemetry string vary. 

 
    example target log file:

         A      B     C     D     E

        120  -130   -20    30    45
       -111   122    32   121   231 
          3    32    76    -2  -432  

Any advice most welcome - and thanks much again to the group for the
help a couple of months back.

Cheers, Bill




__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com