2's complement conversion. Is this right?

Bob Greschke bob at passcal.nmt.edu
Sat Apr 19 17:50:05 EDT 2008


On 2008-04-18 21:33:34 -0600, Grant Edwards <grante at visi.com> said:

> On 2008-04-18, Bob Greschke <bob at passcal.nmt.edu> wrote:
> 
>> I'm on a Solaris 8 with Python 2.3.4 and when crunching
>> through, literally, millions and millions of samples of
>> seismic data fingers point out the difference nicely. :) I'll
>> look into this more on some of our bigger better faster
>> machines (there is no -m option for timeit on the Sun :).  The
>> Sun is just what I develop on.  If stuff runs fast enough to
>> keep me awake on there over an ssh'ed X11 connection it should run even 
>> better on the real field equipment (Macs,
>> Linuxes, WinXPs).
> 
> If time is an issue, I might write a C program to convert the
> files from 24-bit numbers to 32-bit numbers.  Then you can use
> numpy to load huge arrays of them in a single whack.

Yes you could. :)  But this is all in real time (as in 'gotta have it 
right now' real time).  Plus we're dealing with 100's of files 
(instruments) at a time.  It'll be 1000's of instruments this summer up 
in Canada.

Here's the program having happily crunched away at nearly twice the 
speed it was the day before yesterday.

www.greschke.com/unlinked/files/pocus.png

The white dots come from the 3-byte integers and make up the green line 
which makes up one 'logical' chunk (in this case they recorded for 
60mins at a time) of a whole data file with one file per instrument.  
Generally we just take a quick look at the green lines to make sure the 
instruments were working, and pull out the bad ones so they don't get 
used again until they've been looked at.  Zooming in to the level where 
you can see the individual samples is used to (more) accurately 
determine the time when an [intentional] explosion was set off.  You 
use instruments placed near the shot holes for that.  Simple. :)

Bob






More information about the Python-list mailing list