03.31.2006 16:11

elog

Val mentioned a program called elog, which is a very interesting little web application.

We started putting together a fink package, but it is quite a ways away from working. http://schwehr.org/software/fink/elog/

Posted by Kurt | Permalink

03.31.2006 08:14

svn server side move

Just tried my first server size move of a file through subversion:
$ svn mv https://cowfish.unh.edu/projects/seismic-py/trunk/segy.py \
       https://cowfish.unh.edu/projects/seismic-py/trunk/seismic/segy.py


Committed revision 337.

$ cd && svn update A seismic/segy.py D segy.py Updated to revision 337.

Posted by Kurt | Permalink

03.31.2006 07:34

Other sources for fink debs

I would like to do something like this for ccom a soon as I get a server for it.

http://sidbox.homelinux.org/

This is where I put my compiled debs for future use when I tinker with fink.
If you are using fink/10.4-transitional you could save some times using my repositories, just add:


deb http://sidbox.homelinux.org/fink stable main crypto deb http://sidbox.homelinux.org/fink unstable main crypto

at the end of your /sw/etc/apt/sources.list and:

UseBinaryDist: true

into your /sw/etc/fink.conf
There is also http://www.gtlib.gatech.edu/pub/fink/fink/

Posted by Kurt | Permalink

03.30.2006 16:43

Dynamically pulling out all of the database fields

Here is a quick example to go with the previous on. I am sure this is not the best way to do it, but it works. For each row in the database, I want to print out all the fields with their values.
results = usermapper.select_text('select * from msg1 where mmsi=353556000 order by messageId')


for r in results: for attribute in r._managed_attributes.keys(): print attribute,': ',r.__getattribute__(attribute)

Posted by Kurt | Permalink

03.30.2006 16:18

reading sqlalchemy data



Question: What exactly is the difference between the __repr__ and __str__ class methods?

I figured out how to do the object relational mapping so that database comes back as a list of objects. A couple points about this code. First, I had to change messageId to be the primary_key. Second. The online docs have a mistake. It should not be "results=mapper.select_text" What I have below works. Third, printing just r gives things like '<__main__.Msg1 object at 0x1009970>'. I probably need to add a __repr__ to make print nice.
#!/usr/bin/env python
import os,sys
from sqlalchemy import *
db = create_engine('sqlite://filename=ais.db' )
msg1table = Table('msg1', db,
		  #  unique index
		  Column('messageId', Integer,primary_key = True)
		  ,Column('mmsi',Integer, index=True)
		  ,Column('lon',Float)
		  ,Column('lat',Float)
		  ,Column('SOG',Float)
		  ,Column('ROT',Float)
		  ,Column('time',TIMESTAMP)
		  )
class Msg1(object):
    pass # Yikes
msg1mapper = mapper(Msg1,msg1table)
results = msg1mapper.select_text('select * from msg1 where mmsi=353556000 order by messageId')
for r in results:
    print r.lon, r.lat
Running this gives:
PYTHONPATH=.. ./ais-sql2geozui 
-70.7583333333 43.08
-70.7583166667 43.0799833333
-70.7583166667 43.08
-70.7583 43.08
-70.7583 43.0799833333
-70.7583 43.0799833333

Posted by Kurt | Permalink

03.30.2006 15:40

OpenEV on fink

I've hit a roadblock at the moment trying to build openEV in fink. I am using a cvs checkout from today of OpenEV for the build. /sw/include/glib-2.0/gobject/gtype.h is giving me trouble here.
#if	GLIB_SIZEOF_LONG == GLIB_SIZEOF_SIZE_T
typedef gulong                          GType;
#else	/* hm, shouldn't happen? */
typedef gsize                           GType;
#endif
Here is my current configure scripts:
CFLAGS="-I/sw/include/gtk-1.2 -I/sw/include/glib-1.2 -I/sw/lib/glib/include \
-I/usr/X11R6/include -I/sw/include/pygtk-2.0 -I/sw/include/gdal1 \
-I/sw/include" LDFLAGS="-L/sw/lib" \
./configure --prefix=/Users/schwehr/Desktop/openev 

Posted by Kurt | Permalink

03.30.2006 12:56

sioseis script

Here is a little sioseis script from Becca. This does not work for all datasets. For example, my Humboldt Slide dataset was not correctable in this way.

First her intro:
I have got the heave correction to work for wire in-out issues where
you can't see the multiple! I took the depth profile from fledermaus
and converted it to twtt and used it as a picked water bottom. To do
this I imported the xy data points that I used to make the vertical
curtain and draped them on the seafloor, made a note of the depth of
each one and then converted that depth into twt (using 1500 m/s), Then
I made a file with the shot number and the fleder seafloor depth and
used that in the script below. It only works if there is not
significent layback.


-Becca
And the script:
pre>
#!/usr/bin/env bash


# for shifting when you've picked the multiple/know the seafloor depth or time declare -r FNO="94000" declare -r LNO="111047" declare -r BASENAME=ice2003_B7

sioseis << eof procs diskin header mix wbt wbt2 header2 prout shift diskoa end

diskin set 0 .5 ipath $BASENAME.sgy end end

header fno $FNO lnO $LNO ftr 1 ltr 99 l6 = l3 end end

mix type 4 lhdr 59 weight 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 end end

wbt ! shot-time pairs for fleder picked seafloor gets asigned to r50 `cat B7.sf` end

wbt2 ! pick the water bottom from the original data, using the method that works best beneath index 60 ! put this pick in real word 60

! peak pos sepp .07 .09 track .01 lprint 2 end ! thres .1e-08 track .005 end ! peak pos sepp 0.01 0.25 track 0.005 lprint 2 end solrat 6 ses 0.0010 0.0020 sel 0.1 0.25 lprint 2 end ! solrat 4 ses .001 .005 sel .2 .3 lprint 2 end end

header2 fno $FNO lno $LNO ftr 1 ltr 99 ! substitute the picked water column depth for the theoretical r59 = r50 - r60 end end prout indices r50 r59 r60 fno $FNO lno $LNO noinc 100 end end shift indices r59 end end diskoa ofmt 1 opath $BASENAME-flt.sgy end end end eof

Posted by Kurt | Permalink

03.30.2006 11:59

sqlalchemy insert

So now on to inserting some data into the database with sqlalchemy. It does not look like a list of dictionaries is possible, but this is not so bad. This example is a little complicated because I am translating between the ais VDM module names and what I might want to call things in the database. Who wants to write out Longitude all the time when 'lon' is pretty well known?
aiskeys = [
    ['UserID','mmsi']
    ,['Longitude','lon']
    ,['Latitude','lat']
    ,['SOG','SOG']
    ,['ROT','ROT']
]
for key in aiskeys:
    insdict[key[1]] = fields[key[0]]
insdict['time'] = ais.nmeamessages.zdaDict2TIMESTAMP(timeDict)
msg1table.insert().execute(insdict)
The insertion dictionary looks like this:
insdict = 
  {
  'mmsi': 353556000, 
  'lon': -70.75833333333334, 
  'lat': 43.079999999999998, 
  'SOG': 0, 
  'ROT': 0,
  'time': '2006-03-26 13:39:21'
  }
Then I can pull data on the command line:
sqlite ais.db 'select * from msg1' | tr '|' '\t'
        353556000       -70.7583333333  43.08           0       0       2006-03-26 13:39:21
        353556000       -70.7583166667  43.0799833333   0       0       2006-03-26 13:39:31
        224632000       -70.7909966667  43.103435       1       128     2006-03-26 13:39:32
        353556000       -70.7583166667  43.08           0       0       2006-03-26 13:39:42
        353556000       -70.7583        43.08           0       0       2006-03-26 13:39:51
        224632000       -70.7909933333  43.10343        1       128     2006-03-26 13:40:03
        224632000       -70.7909933333  43.10343        1       128     2006-03-26 13:40:03
        224632000       -70.7909933333  43.10343        1       128     2006-03-26 13:40:03
        353556000       -70.7583        43.0799833333   0       0       2006-03-26 13:40:11
...
Wow, that was a little complicated for a first example, but it was so easy to write.

Posted by Kurt | Permalink

03.30.2006 11:21

First database creation with sqlalchemy

A quick look in the sqlite driver within sqlalchemy show that it is using the pysqlite2 driver (for sqlite3) and if not, it falls back on pysqlite which is will only generate sqlite2 databases. sqlite2 is pretty clunky, so I need to get the pysqlite2 drivers into fink soon! Here is how they do conditional driver loading. An interesting read:
try:
    from pysqlite2 import dbapi2 as sqlite
except:
    try:
        sqlite = __import__('sqlite') # skip ourselves
    except:
        sqlite = None
Now here is my first attempt at creating a database via sqlalchemy:
#!/usr/bin/env python
'''Use SQLAlchemy to create/add data to a database'''
from sqlalchemy import *
import os
if os.access('ais.db',os.W_OK):
    os.remove('ais.db')
#
db = create_engine('sqlite://filename=ais.db',echo=True)
#
msg1table = Table('msg1', db,
		  #  unique index
		  Column('messageId', Integer,unique=True)
		  ,Column('mmsi',Integer, index=True)
		  ,Column('lon',Float)
		  ,Column('lat',Float)
		  ,Column('SOG',Float)
		  ,Column('ROT',Float)
		  ,Column('time',TIMESTAMP)
		  ).create()
Running it looks like this. The key is the "echo=True".
./ais-sqlalchemy
[2006-03-30 11:18:44,781] [engine]: 
CREATE TABLE msg1(
	messageId INTEGER, 
	mmsi INTEGER, 
	lon NUMERIC(10, 2), 
	lat NUMERIC(10, 2), 
	SOG NUMERIC(10, 2), 
	ROT NUMERIC(10, 2), 
	time TIMESTAMP
)




[2006-03-30 11:18:44,803] [engine]: None [2006-03-30 11:18:44,838] [engine]: CREATE UNIQUE INDEX ux_messageId ON msg1 (messageId) [2006-03-30 11:18:44,838] [engine]: None [2006-03-30 11:18:44,842] [engine]: CREATE INDEX ix_mmsi ON msg1 (mmsi) [2006-03-30 11:18:44,842] [engine]: None
Since I don't have the newer driver, the above code generates and sqlite2 database.
less ais.db


** This file contains an SQLite 2.1 database **^@ ...

sqlite ais.db '.tables' msg1

sqlite ais.db '.schema msg1' CREATE TABLE msg1( messageId INTEGER, mmsi INTEGER, lon NUMERIC(10, 2), lat NUMERIC(10, 2), SOG NUMERIC(10, 2), ROT NUMERIC(10, 2), time TIMESTAMP ); CREATE INDEX ix_mmsi ON msg1 (mmsi); CREATE UNIQUE INDEX ux_messageId ON msg1 (messageId);

Posted by Kurt | Permalink

03.30.2006 10:47

SQLAlchemy - weird python code



I have just started to play with SQLAlchemy now that I have working fink packages for setuptools and SQLAlchemy. I promise will check them in when the sf.net CVS server comes back online. In the process, I am working on creating a db of AIS data. In ipython I wanted some more info on various time functionality and I got quite a surpise.
In [23]: sqlalchemy.Time?
Type:           type
Base Class:     <type 'type'>
String Form:    <class 'sqlalchemy.types.Time'>
Namespace:      Interactive
File:           /sw/lib/python2.4/site-packages/sqlalchemy/types.py
Docstring:
    <no docstring>


In [24]: help(sqlalchemy.Time)

Help on class Time in module sqlalchemy.types:

class Time(TypeEngine) | Method resolution order: | Time | TypeEngine | __builtin__.object | | Methods inherited from TypeEngine: | | __init__(self, *args, **kwargs) | | adapt_args(self) ...
No doc string? I figured I could go look at the source and see what is goind on. Maybe the doc string was getting nuked somehow? Nope! I found this in /sw/lib/python2.4/site-packages/sqlalchemy/types.py:
...
class DateTime(TypeEngine):
    pass


class Date(TypeEngine): pass

class Time(TypeEngine): pass

class Binary(TypeEngine): def __init__(self, length=None): self.length = length def convert_bind_param(self, value, engine): return engine.dbapi().Binary(value) def convert_result_value(self, value, engine): return value def get_constructor_args(self): return {'length':self.length} ...
Say what? First off, there is not inline documentation or comments. Secondly, a class with just pass? So this will inherit the parents functionality, but appear as a different object. Is that the point?

Posted by Kurt | Permalink

03.30.2006 08:10

OpenSoundings

Randomness of the web. I was looking for that sf.net status page since they appear to be having a cvs outage when I ran into OpenSounding:
  A tool for decoding and presenting Geotechnical Sounding data (such
  as CPTu). Formats supported are the SGF standard as defined by the
  Swedish Geotechnical Society (www.sgf.net), and used by a number of
  commercial products, aswell as Generic text

Posted by Kurt | Permalink

03.29.2006 19:17

setuptools gets closer

I think I found the trouble for setup tools install from fink.... /sw/lib/python2.4/site-packages/easy-install.pth was:
/sw/src/fink.build/root-setuptools-py24-0.6a10-1/sw/lib/python2.4/site-packages\
/setuptools-0.6a10-py2.4.egg
Which should not have all that stuff in the beginning:
/sw/lib/python2.4/site-packages/setuptools-0.6a10-py2.4.egg

Posted by Kurt | Permalink

03.29.2006 18:27

CruiseControl or BuildBot

Brian L mentioned Cruise Control which is a continuous build process system. Sounds interesting. I hadn't gotten into BuildBot yet. I need to evaluate the two.

Posted by Kurt | Permalink

03.29.2006 12:29

WW2d

WorldWind2D (WW2D). Check out the screen shot.

Posted by Kurt | Permalink

03.29.2006 10:06

Mac X11 unhappy

I am starting to have strange problems with X11. Often xterms popup and disappear. Then when they have been iconofied, the come back looking like this. It would be a lot easier to track down if these were consistant problems, but they only happen occasionally.


Posted by Kurt | Permalink

03.29.2006 09:57

openscience - how to make money from open source

From http://www.openscience.org/blog/. How to make money from Open Source scientific software
...
  However, their code is not open. And this, I think, is a real
  problem. Imagine a skeptical researcher who is sent a paper to
  review. Further imagine that this paper uses this company's
  software, and the skeptical researcher doesn't have the money for a
  license. He or she therefore can't "look under the hood" to verify
  what's going on if they have some questions about how the code is
  calculating something relevant to the paper. There are good reasons
  that this company doesn;t give away their code; they like to put
  food on the table, and they don't trust the rest of the community to
  shell out the money for their programs if the code were available
  for free.


So, I'm left with a dilemma. I want this company to do well, to hire more of my students in the future, and to continue to produce high quality code. I also want the codes that we use in my field to be available for skeptical review. So today, I'm starting a set of posts in which I'll try to hash out the following question: How can people make money from open source scientific software? ...

Posted by Kurt | Permalink

03.29.2006 09:45

web mapping services

http://www.perrygeo.net/wordpress/?p=35
  Web Mapping Services (WMS) are not always my prefered option for
  accessing data; relying on a remote server to generate a pretty
  picture of the data is hardly a substitute for having the raw data
  in hand. But for many cases, I just need a decent looking basemap
  image and don't want to download gigabytes of data, especially if
  that data is updated frequently.
...

Posted by Kurt | Permalink

03.29.2006 08:33

setuptools tests

To play with setuptools, I has to do a little extra work. I downloaded the zip from the cheeseshop and did this.
cd ~/Desktop
mkdir setuptools && cd setuptools
wget http://cheeseshop.python.org/packages/source/s/setuptools/setuptools-0.6a10.zip


mkdir -p /Users/schwehr/Desktop/setuptools/sw/lib/python2.4/site-packages

PYTHONPATH=/Users/schwehr/Desktop/setuptools/sw/lib/python2.4/site-packages/ \ python setup.py install --root=/Users/schwehr/Desktop/setuptools/
If I did not put the target site-packages location in PYTHONPATH it failed to install.

Posted by Kurt | Permalink

03.29.2006 08:13

py-setuptools Portfile

Here is the port file for py-setyptools: cat /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/python/py-setuptools/Portfile

# $Id: Portfile,v 1.1 2005/12/15 00:55:31 blb Exp $


PortSystem 1.0 PortGroup python24 1.0 name py-setuptools version 0.6a8 categories-append devel maintainers blb@opendarwin.org description distutils enhancement for build and distribution long_description \ setuptools is a collection of enhancements to the Python distutils that \ allow you to more easily build and distribute Python packages, \ especially ones that have dependencies on other packages.

platforms darwin

homepage http://peak.telecommunity.com/DevCenter/setuptools master_sites http://cheeseshop.python.org/packages/source/s/setuptools/ distname setuptools-${version} use_zip yes

checksums md5 3eecdf66c1a2cf8a6556bc00b69d572a

post-destroot { xinstall -m 755 -d ${destroot}/${prefix}/share/doc/${name} xinstall -m 644 -W ${worksrcpath} EasyInstall.txt api_tests.txt \ pkg_resources.txt setuptools.txt \ ${destroot}/${prefix}/share/doc/${name} }




Posted by Kurt | Permalink

03.29.2006 07:54

python setuptools

There are two very interesting looking database abstraction layers for python that both require setuptools. setuptools is not in fink, but it is in darwinports, so I am installing it that way to see how darwinports handles it. Hopefully after setuptools, I can go back and add wxoptparse to fink too! That would be great! I still haven't managed to get wxglade working yet. http://py-setuptools.darwinports.com/
  sudo port install py-setuptools
I should have added "-v -d" to the above.

Posted by Kurt | Permalink

03.29.2006 07:17

How to stop worrying and love the blob

A while back (Fall 2004), I made a presentation entitled "How to stop worrying and love the blob." Needless to say I missed the target with my audience completely, but now OpenBSD has a very similiar theme (but no Dr. Strangelove references).


Posted by Kurt | Permalink

03.29.2006 07:08

supporting OpenSSH (OpenBSD)

I bought an OpenBSD CD. What are you doing to support the puffer fish?

Linux supporters fiddle while OpenSSH burns

http://openbsd.org/orders.html

Posted by Kurt | Permalink

03.28.2006 13:52

Ship tracks from AIS

Yes, I am having fun. I am only using sqlite and gnuplot so far, but I will keep stepping it up. The numbers in the key are the ship UserID/MMSI.


Posted by Kurt | Permalink

03.28.2006 13:03

Greg Stein's talk

Thanks to Roland for this link.

"In 5-10 years, most of the software you use will be free"
  Greg Stein, chairman of the Apache Software Foundation, currently with
  Google, delivered this keynote on Wednesday morning at EclipseCon
  2006. It was titled "Comparing Apache and Eclipse".
A very interesting read! Could be very controversial to some. Quite the contrast to listening to the AVSP interviews with some folks at ESRI that I was listening to earlier today.

Posted by Kurt | Permalink

03.28.2006 11:20

python interpreter for fink?

How do I correctly set the python interpreter using setup.py for scripts that end up in /sw/bin and what about name clashes? Guess I only allow one version of python? That just does not seem right. Plus, what I am doing now is not safe:
#!/usr/bin/env python
Then what happens when the user changes their path to pull some other python before the one that I am counting on? distutils must have thought about this, no?

Posted by Kurt | Permalink

03.28.2006 11:02

signed integers using BitVector

This not the most clever implementation of twos complement signed integer decoding, but it seems to work. I am putting this here since Avi is holding off on additional functionality in BitVector until the end of his semester. He did fix the bitvec[-1]=0 reverse accessor bug today, so the code below could be even simpler.
#!/usr/bin/env python
from BitVector import BitVector


def setBitVectorSize(bv,size=8): """Pad a BitVector with 0's on the left until it is at least the size specified

@param bv: BitVector that needs to meet a minimim size @type bv: BitVector @param size: Minimum number of bits to make the new BitVector @type size: int @return: BitVector that is size bits or larger @rtype: BitVector

@todo: What to do if the vector is larger than size? "
"" pad=BitVector(bitlist=[0]) while len(bv)<size: bv = pad + bv return bv

def addone(bv): ''' Add one bit to a bit vector. Overflows are silently dropped. >>> print addone(BitVector(bitstring='1100')) 1101 >>> print addone(BitVector(bitstring='1111')) 0000

@param bv: Add one to these bits @type bv: BitVector @return: Bits with one added @rtype: BitVector '
'' new = bv r = range(1,len(bv)+1) for i in r: index = len(bv)-i if 0==bv[index]: new[index]=1 break new[index]=0 return new

def subone(bv): ''' Subtract one bit from a bit vector

>>> print subone(BitVector(bitstring='
1111')) 1110 >>> print subone(BitVector(bitstring='0010')) 0001 >>> print subone(BitVector(bitstring='0000')) 1111

@param bv: Bits to add one bit to the right side @type bv: BitVector @rtype: BitVector '
'' new = bv r = range(1,len(bv)+1) for i in r: index = len(bv)-i if 1==bv[index]: new[index]=0 break new[index]=1 return new

def bvFromSignedInt(intVal,bitSize=None): ''' Create a twos complement BitVector from a signed integer.

Positives must have a '
0' in the left hand position.

>>> print bvFromSignedInt(0,bitSize=4) 0000 >>> print bvFromSignedInt(1,bitSize=4) 0001 >>> print bvFromSignedInt(7,bitSize=4) 0111

Negative numbers must have a '
1' in the left hand position.

>>> print bvFromSignedInt(-1,bitSize=4) 1111 >>> print bvFromSignedInt(-2,bitSize=4) 1110 >>> print bvFromSignedInt(-7,bitSize=4) 1001

@param bv: Bits to subtract one bit from the right side @type bv: BitVector @rtype: BitVector '
'' bv = setBitVectorSize(BitVector(intVal=abs(intVal)),bitSize-1) assert(bitSize-1==len(bv)) # FIX: what to do about overflow beyond bitSize? if intVal>=0: bv = BitVector(intVal=0) + bv else: bv = subone(bv) bv = ~bv bv = BitVector(intVal=1) + bv return bv def signedIntFromBV(bv): ''' Interpret a bit vector as an signed integer. int(BitVector) defaults to treating the bits as an unsigned int. Assumes twos complement representation.

U{http://en.wikipedia.org/wiki/Twos_complement}

Positive values decode like so:

>>> signedIntFromBV(BitVector(bitstring='
0000')) 0 >>> signedIntFromBV(BitVector(bitstring='0101')) 5

Here are some negative integer examples:

>>> signedIntFromBV(BitVector(bitstring='
1111')) -1 >>> signedIntFromBV(BitVector(bitstring='1110')) -2 >>> signedIntFromBV(BitVector(bitstring='1010')) -6 >>> signedIntFromBV(BitVector(bitstring='1001')) -7

@param bv: Bits to treat as an signed int @type bv: BitVector @return: Signed integer @rtype: int

@note: Does not know the difference between byte orders. '
'' if 0==bv[0]: return int(bv) # Nope, so it is negative return -(int(addone(~(bv[1:]))))

Posted by Kurt | Permalink

03.28.2006 09:49

First AIS ship location decoding

This is not so exciting for those who have been using AIS for quite a while (e.g. Matt and Roland) but it is pretty exciting for me. First, this morning I created functions for the BitVector class that go to and from signed integers. That was pretty cool by itself, but that fix the last hurdle to fully decoding the longitude and latitudes from AIS messages 1-3. Those fields use signed integers of 10000 minute increments to store the location. Being in the western hemisphere, I was expecting negative longitudes (e.g. NOT 373 degrees).

To give ais-py a sanity test, I did a quick dump of the location and got these values for one message:
  MMSI/UserID Longitude Latitude SpeedOverGround
   353556000  -70.7583  43.07995        0
Google Maps/Local was kind enough to show me that this is indeed the salt hauler that was docked in Portsmouth over the weekend.


Posted by Kurt | Permalink

03.28.2006 09:37

Hydrologic sensor data

The CUAHSI () has a Hydrologic Information System that looks interesting. How do I access this data is a programmatic way (e.g. via python)?

Here is the USGS New Hampshire webpage. I am not too excited to do web scraping.

Of related interest: NASA/JPL's sensor webs project

Posted by Kurt | Permalink

03.27.2006 14:03

online python book - testing and packaging

Python 201 -- (Slightly) Advanced Python Topics by Dave Kuhlman looks pretty interesting. Some stuff is not how I do it in the testing section, but this is definitely worth a read.

Posted by Kurt | Permalink

03.27.2006 13:25

How OS X Executes Applications

How OS X Executes Applications by 0xFE. Looks like a good read and not too long.

Posted by Kurt | Permalink

03.25.2006 18:22

pyserial

pyserial is great! Here is how hard it was to create a very basic logging program.
#!/usr/bin/env python
import time
import serial


ser = serial.Serial('/dev/tty.KeySerial1',38400,timeout=2) log=open('ais.log','a') log.write('# START LOGGING AT GMTTIME: '+str(time.gmtime())+'\n')

i=0 while True: i += 1 line = ser.readline() print i,len(line),':',line if len(line)>0: log.write('# GMTTIME: '+str(time.gmtime())+'\n') log.write(line) log.flush()

Posted by Kurt | Permalink

03.25.2006 14:29

Mac OSX speedups

Making An Operating System Faster (10 Things Apple Did To Make Mac OS X Faster). An interesting read. Of note is how to make gcc precompiled headers for faster compiles.
% gcc -x c-header -c foo.h 
% ls foo.* 
foo.c foo.h foo.gch 

Posted by Kurt | Permalink

03.25.2006 14:02

Portsmouth port noise

This is not bothering us, but it seems to be bothering some of the neighbors. The ships are not there that often. I would tend to side with the local shipping businesses. Yes, I can hear them unloading the salt right now.
Port Asked To Cut Overnight Work


PORTSMOUTH, N.H. -- Neighbors and a legislator are asking the Port of New Hampshire in Portsmouth to stop overnight work so they can get some sleep. ...

Posted by Kurt | Permalink

03.25.2006 13:58

Vessel tracking in the news

High-tech trackers: A local initiative to track vessels in and out of the Port of Hampton Roads is now being used in San Diego.
PORTSMOUTH -- A Coast Guard and Navy vessel tracking initiative that
began in Hampton Roads in 2001 is going national.


The Joint Harbor Operations Center, which monitors ships on local waterways through a combination of radar systems, cameras and vessel tracking devices, is now being implemented in San Diego. ... "This center is about maintaining awareness," said Capt. Robert O'Brien, the Coast Guard's captain of the port in Hampton Roads. "And that awareness is key to the safety of our port." ... The JHOC, as it's called, has evolved greatly from its early days operating with only a handful of people out of the old watchtower on the Elizabeth River at Norfolk Naval Station. Since the summer of 2004, the center has been headquartered at the Coast Guard base in Portsmouth, with millions of dollars worth of computers, software and equipment. ... The idea for such a center is the brainchild of Capt. Joseph Bouchard, the former commanding officer at the Norfolk Naval Station. ...

Posted by Kurt | Permalink

03.25.2006 08:57

First light - SR162 AIS Receiver

I just received my first AIS message. Not doing anything fancy. Just watching through minicom (installed via fink) using a KeySpan USA-19HS. It is set to 38.4k 8N1 looking at /dev/tty.KeySerial1. I just installed the latest KeySpan driver, so /dev/*USA* is no more.
        SR162 AIS Receiver                                                   
                                                                             
        RECE FRQ        R1F1619750                                           
        RECE FRQ        R2F1620250                                           
        INT RATE        I38400          
!AIVDM,1,1,,A,13F>Lh0P00JstMJHbOQskOvJ087h,0*5A
!AIVDM,2,1,1,A,v>W`lPt40030Ph0FhhQP1<v00C1W@8<4FS0?h000@P81O0P605P0PPm6,0*09
!AIVDM,2,2,1,A,P004P`4,2*75                                               
!AIVDM,1,1,,B,13F>Lh0P01JstLjHbOUrp?v80D00,0*46
I have to decode the messages, but this may be the Qing Ping Hai registered in Panama with an IMO number of 8308915. It took a few minutes to get all those messages.

I can't wait to get the RM808 back from service so I can see what it puts out.

Note: Do not unplug the keyspan while the port it is still open. That set off a kernal trap saying I had to use the power button to restart my laptop.

Posted by Kurt | Permalink

03.24.2006 10:30


Posted by Kurt | Permalink

03.24.2006 10:28

Future of OpenGL


Posted by Kurt | Permalink

03.24.2006 07:50

line numbering for Marine Geology

This is the suggestion for how to do line numbering that I got from Marine Geology.
Please find below a sample on how you will prepare your LaTeX document with line number:


\documentclass{elsart} \usepackage{lineno} \begin{document} \linenumbers \title{A Framework for Language Identification} \author{John Smith, John Doe, John JohnJohn} \address{Speech and Audio Research Laboratory,\\ Technology Way,\\ A City, AUSTRALIA, 4001.\\ \{jsmith, jdoe, johnjohnjohn\}@unversity.edu} \begin{abstract} Whilst several examples of segment based approaches to Language Identification (LID) have been published, they are not as good as this one. \end{abstract}
Unfortunately that did not work for me. It mangled the title and abstract. I can not figure out how to no use \begin{frontmatter} which also stops the line numbering at the end of frontmatter. Also, the line number stops for the figure captions. Bummer. Here is the skeleton of what I did:
%\documentclass{elsart}
\documentclass[doublespacing]{elsart} % MARINE GEOLOGY DOUBLE SPACED
\usepackage{lineno}                   % LINE NUMBER PACKAGE
\usepackage{natbib}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{array}
\usepackage{lscape} % landscape
\usepackage[usenames]{color} 


\begin{document} \begin{frontmatter} \title{Origin of continental margin morphology: submarine-slide or downslope current-controlled bedforms, a rock magnetic approach} ... \end{frontmatter} \linenumbers % Tell latex lineno package to start using line numbers \section{Introduction} Rest of the paper...
I hope that helps someone. I was not able to find this on the Elsevier web site. Their latex help page seems to have lost most of its content.

Posted by Kurt | Permalink

03.23.2006 10:29

more public repositories

Nathan has setup 3 more public subversion projects for me. seismic-py represents a name change from segy-py to avoid a name clash (yes, I did have segy-py public first). No point in confusing people. I need to do freshmeat and cheeseshop (aka pypi) announcements this week.

xsonar is my protoized update to the USGS xsoanr sidescan. That means I converted K&R function prototypes to modern ANSI-C prototypes.

terrain is the same old terrain that tries to convert height field grids between a number of different formats (gmt grids, lightwave, Alias obj, OpenInventor, PDS, Vicar). Lightwave is a pretty crazy format, so my support for it has a lot of troubles.

Posted by Kurt | Permalink

03.23.2006 09:03


Posted by Kurt | Permalink

03.23.2006 06:21

fink build reports

This is good news. I don't mean that it is good that some things are not building, but it is good that there is a master list of things that are not building. There are a few of mine that are not building.

PPC: http://fink.opendarwin.org/build/2006-03-09/ppc/out/report.html

x86: http://fink.opendarwin.org/build/2006-03-09/i386/out/report.html

Posted by Kurt | Permalink

03.22.2006 22:10

Spotlight command line

This sounds like a good thing to be able to do: Using Spotlight from the OS X Commandline
$ mdfind gmt.info


/Users/schwehr/Desktop/gmt.info.kds /sw/fink/10.3/stable/main/finkinfo/sci/gmt.info /sw/fink/10.4/stable/main/finkinfo/sci/gmt.info /sw/fink/10.3/unstable/main/finkinfo/sci/gmt.info /sw/fink/10.4/unstable/main/finkinfo/sci/gmt.info /sw/fink/10.4-transitional/stable/main/finkinfo/sci/gmt.info /sw/fink/10.4-transitional/unstable/main/finkinfo/sci/gmt.info /Users/schwehr/Desktop/gmt.info /Users/schwehr/projects/xcore/doc/backup.txt ...

Posted by Kurt | Permalink

03.22.2006 12:50

3D view on the Navionics Platinum

Take a look at the screen shots on this web page of the Navionics Platinum here and here http://www.panbo.com/yae/archives/001119.html

http://www.navionics.com/PlatinumCharts.asp

Posted by Kurt | Permalink

03.22.2006 11:11

Maritime academy in Portsmouth

http://www.seacoastonline.com/news/03222006/business/93865.htm
...
 Parker has trained as a lawyer and a ship captain. He's worked for
 more than three decades as a maritime legal expert and a yacht and
 ship broker. But Parker, a native of the fishing-famous town of
 Gloucester, Mass., said for years he's thought of creating a
 flexible, cost-effective and well-credentialed academy for both the
 recreational boating and commercial shipping markets. 
...
 Classes will begin April 17 at the AMA offices on Brewery Lane just
 off Islington Street. Parker said he plans to start small by
 offering basic U.S. Coast Guard certification classes.  
...

Posted by Kurt | Permalink

03.22.2006 10:46

First public svn repository - density

This is exciting. Nathan just migrated the first of my projects to subversion. This one is under the GPL, so I am allowing full subversion read access. Check it out at:

https://cowfish.unh.edu/projects/density

I passed Nathan a dump file that I generated from cvs2svn like this:
cvs2svn --dump-only --dumpfile ../../density.svndump density
Inside the density subdir from within my cvs repository were these files:
AMScrunch.f,v          VolHeader.C,v                 s_bootstrap.C,v
AUTHOR,v               VolHeader.H,v                 s_bootstrap.help2man,v
Attic                  as1-crypt.s,v                 s_bootstrap_cmd.ggo.in,v
Bootstrap.C,v          as2-slump.s,v                 sample.wpt,v
Bootstrap.H,v          as2xyz.bash,v                 simpleview.C,v
Cdf.C,v                as3-undef.s,v                 simpleview.help2man.in,v
Cdf.H,v                axes.iv,v                     simpleview.in,v
ChangeLog,v            bootvol-thesis.bash,v         simpleview_cmd.ggo.in,v
Density.C,v            debug.H,v                     spin_gnuplot.C,v
Density.H,v            debug.bash,v                  spin_gnuplot_cmd.ggo.in,v
DensityFlagged.C,v     demos.bash,v                  splitdepth.py,v
DensityFlagged.H,v     density-sml.jpg,v             vol2vol.C,v
Doxyfile,v             density.info.in,v             vol2vol_cmd.ggo.in,v
Eigs.C,v               eigs2xyz.py,v                 vol_iv.C,v
Eigs.H,v               endian.C,v                    vol_iv_cmd.ggo.in,v
HEADER-files.html,v    getgroups-ol92.bash,v         volhdr_edit.C,v
HEADER.html,v          histogram.C,v                 volhdr_edit_cmd.ggo.in,v
INSTALL,v              histogram_cmd.ggo.in,v        volinfo.C,v
InventorUtilities.C,v  hsva.cpt,v                    volinfo_cmd.ggo.in,v
InventorUtilities.H,v  is_equal.c,v                  volmakecmap.C,v
LICENSE.GPL,v          kdsPmagL.H,v                  volmakecmap_cmd.ggo.in,v
Makefile,v             makeCDF.C,v                   xyz_iv.C,v
Makefile.endian,v      makemovie.bash,v              xyz_iv_cmd.ggo.in,v
README.txt,v           one.bash,v                    xyzdensity.C,v
SiteSigma.C,v          regression.bash,v             xyzdensity.help2man,v
SiteSigma.H,v          render.C,v                    xyzdensity_cmd.ggo.in,v
TODO,v                 render.in,v                   xyzvol_cmp.C,v
VERSION,v              render_cmd.ggo.in,v           xyzvol_cmp_cmd.ggo.in,v
VecAngle.C,v           rgba.cpt,v
VecAngle.H,v           rosenbaum-ams-stripped.dat,v
That should give you some sense of how the svn tree is built based off of the rcs formated ,v files.

Posted by Kurt | Permalink

03.22.2006 10:15

svn ignore

I am working on understanding how to use svn's ignore tag so that svg status skips things like python byte compiled files (*.pyc). This does not work the same way that .cvsignore works. Here is a quick example.
$ svn status
?      version.pyc
?      verbosity.pyc
?      BitVector-1.2
?      dist
?      html
?      MANIFEST
?      ais.pyc
M      ais.py


$ cd && svn propset svn:ignore "*.pyc" . property 'svn:ignore' set on '.'

$ svn status ? BitVector-1.2 ? dist ? html ? MANIFEST M . M ais.py
That is great, but I also want to ignore the html subdirectory.
$ cd && svn propset svn:ignore "html" .
property 'svn:ignore' set on '.'


$ svn status ? version.pyc ? verbosity.pyc ? BitVector-1.2 ? dist ? MANIFEST ? ais.pyc M . M ais.py
Whoops. *.pyc came back to life! Instead, I discovered that propedit will bring up my text editor to do the job and that new lines between each entry works.
  svn propedit svn:ignore .
I then put in this
html
*.pyc
MANIFEST
dist
BitVector*
And now my svn status is much nicer.
$ svn status
 M     .
M      ais.py

Posted by Kurt | Permalink

03.22.2006 08:01

Python Testing Tools

Python Testing Tools Taxonomy

Bitten looks especially interesting.
  Bitten is a Python-based framework for collecting various software
  metrics via continuous integration. It builds on Trac to provide an
  integrated web-based user interface.

Posted by Kurt | Permalink

03.21.2006 16:41

epydoc 3.0a fink package

I just put together a quick and dirty fink info package for epydoc 3.0alpha. I want to give it a try on a new python module I am working on and pydoc really is not up to what I would like to do.

epydoc-py.info

Doh... why doesn't fink validate know about the MIT license?

Posted by Kurt | Permalink

03.21.2006 13:20

cvs2svn

I am finally converting my CVS repository that I used throughout my time working on my thesis into a subversion (svn) repository. Here is what I had to do. The first step was to tar up the CVS repository on my server. Names are ever evolving, so I will just put them in for historical kicks.
ssh my.server.com
#
cd projects/xcore/
ls -l Master
total 0
drwxr-xr-x  38 schwehr  schwehr  1292  4 Nov  2002 CVSROOT
drwxr-xr-x   8 schwehr  schwehr   272 21 Mar 09:34 dotfiles
drwxr-xr-x   5 schwehr  schwehr   170 12 Feb 10:58 xcore
#
tar cf Master.tar Master
bzip2 -9 Master.tar
mv Master.tar.bz ~/
exit
#
cd ~/Desktop/
mkdir ForSVN
cd ForSVN
scp my.server.com:Master.tar.bz2 .
tar xf Master.tar
#
### Rearrange things to be happier inside of Master
#
ls -l Master Master/src Master/doc
drwxr-xr-x   38 schwehr  staff        1292 Nov  4  2002 CVSROOT
drwxr-xr-x    7 schwehr  staff         238 Mar 21 13:15 doc
drwxr-xr-x    8 schwehr  staff         272 Mar 21 08:42 dotfiles
drwxr-xr-x    8 schwehr  staff         272 Mar 21 13:13 src
drwxr-xr-x    5 schwehr  staff         170 Feb 12 13:58 thesis
#
Master/doc:
-r--r--r--    1 schwehr  staff      448433 Apr 12  2005 kurt-2004.txt,v
-r--r--r--    1 schwehr  staff      273650 Feb 20 12:50 kurt-2005.txt,v
-r--r--r--    1 schwehr  staff       53270 Mar 21 10:45 kurt-2006.txt,v
drwxr-xr-x    8 schwehr  staff         272 Mar 21 10:44 segy-py
-r--r--r--    1 schwehr  staff       10016 Mar 21 10:45 todo.txt,v
#
Master/src:
drwxr-xr-x   51 schwehr  staff        1734 Mar 21 11:26 Terrain
drwxr-xr-x   92 schwehr  staff        3128 Mar 21 11:26 density
drwxr-xr-x    6 schwehr  staff         204 Mar 21 11:26 mypy
drwxr-xr-x   27 schwehr  staff         918 Mar 21 11:26 pmag-kds-py
drwxr-xr-x   47 schwehr  staff        1598 Mar 21 11:26 segy-py
drwxr-xr-x    6 schwehr  staff         204 Mar 21 11:26 xsonar
# 
cd Master/src && mv segy-py seismic-py
cd Master && rm -rf CVSROOT # This is why I work on a copy
mv Master schwehr
mkdir svnrepo
Now do the conversion, but the first time I tried, it failed like this:
$ cvs2svn -s svnrepo/schwehr schwehr
yada yada
===== pass 2 =====
Checking for blocked exclusions...
Checking for forced tags with commits...
Checking for tag/branch mismatches...
ERROR: The following symbols are tags in some files and branches in others.
Use --force-tag, --force-branch and/or --exclude to resolve the symbols.
    'start' is a tag in 351 files, a branch in 4 files and has commits in 4 files.
So I then tried
cvs2svn --force-tag=start -s svnrepo/schwehr schwehr
...
===== pass 2 =====
Checking for blocked exclusions...
Checking for forced tags with commits...
ERROR: The following branches cannot be forced to be tags because they have commits:
    'start'
So I made them all branches. I hope this does not give me trouble.
cvs2svn --force-branch=start -s svnrepo/schwehr schwehr
tic tock...
cvs2svn Statistics:
===============---
Total CVS Files:              2365
Total CVS Revisions:          8885
Total Unique Tags:              13
Total Unique Branches:           9
CVS Repos Size in KB:       110389
Total SVN Commits:            5591
First Revision Date:    Sat Jul  6 13:05:09 2002
Last Revision Date:     Tue Mar 21 11:27:42 2006
===============---
Timings:
===============---
pass 1:    52 seconds
pass 2:     2 seconds
pass 3:     0 seconds
pass 4:     3 seconds
pass 5:    20 seconds
pass 6:     0 seconds
pass 7:     0 seconds
pass 8:   964 seconds
total:   1043 seconds
And finally, to import my stuff into the new svn tree... first to see what dump-only does. This file is pretty large. My 30MB CVS repository jumped to 180MB
cvs2svn --dump-only --force-branch=start --dumpfile schwehr.svndump svnrepo/schwehr
So maybe build the dump the way roland did:
svnadmin dump schwehr --deltas > schwehr.svndump.deltas
And testing out the repository, I am doing a local checkout.
cd
mkdir test
cd test
svn checkout file://localhost/home/schwehr/svnrepo/schwehr
ls -la schwehr/
  total 12
  drwxrwxr-x   7 schwehr schwehr 4096 Mar 21 14:55 .svn/
  drwxrwxr-x  13 schwehr schwehr 4096 Mar 21 14:54 branches/
  drwxrwxr-x  15 schwehr schwehr 4096 Mar 21 14:55 tags/
  drwxrwxr-x   8 schwehr schwehr 4096 Mar 21 14:54 trunk/
More later when this is spliced into the server.

Posted by Kurt | Permalink

03.21.2006 12:32

Mapping Human Activity in the Marine Environment

Mapping Human Activity in the Marine Environment [slashgeo]
  This report summarizes the results of the workshop (convened by the
  National Marine Protected Areas (MPA) Center Science Institute) that
  brought together 20 social scientists, geographers, and GIS
  specialists from government agencies, universities, and
  non-governmental organizations with expertise in characterizing
  human use patterns in the marine environment with the aid of GIS
  tools. The goal of the workshop was to develop general design
  criteria for a practical participatory method or a suite of methods
  to collect spatial data on human use patterns to inform local and
  regional MPA planning processes. 
Bummer... this is mostly abstracts. Maybe there is good stuff in the publications section of the US Marine Protected Areas web site.

Other news... SAIC Celebrates Opening of Advanced Radar Research and Development and Production Center in Florida [gisuser.com]

Posted by Kurt | Permalink

03.21.2006 09:07

mapbender

mapbender
  Mapbender is all about maps! Have a look at this map
  application. You can zoom in, out, pan, click and query, turn layers
  on and off or add more maps. You can also add new points to the map
  with the flag button, all Mapbender operators are invited to do
  so. There are many different possibilities to make use of maps, see
  some more examples in the Mapbender Gallery. Please observe that
  this software only shows and manages maps. The maps themselves come
  from many different Map Services all over the world. 


Mapbender is the software and portal site for geodata management of OGC OWS architectures. The software provides web technology for managing spatial data services implemented in PHP, JavaScript and XML. It provides a data model and interfaces for displaying, navigating and querying OGC compliant map services. The Mapbender framework furthermore provides authentication and authorization services, OWS proxy functionality, management interfaces for user, group and service administration in WebGIS projects.
Not in fink, but it looks interesting.

Posted by Kurt | Permalink

03.21.2006 08:38

GNU make .PHONY

I just went and read the GNU make info page on ".PHONY" targets. I have read this many times, but I guess I never really internalized what it means I should do. Phony rules are those that do not depend on files being created. The classic is the clean rule, but I think test will be more informative. Normally a test rule might look something like this:
test:
	cd test && make test
or this (depending on your style preference)
test:
	make -f test/Makefile test
If the test directory exists, make will see that directory and think that everything for test is already done. make will say:
make: `test' is up to date.
Clearly, that is not what needs to happen. Make should go run the test! By saying that test is a phony target, make will ignore the test directory and happily run the commands for that target. Here is a dummy test target.
.PHONY: test
test:
	cd test && pwd
Which when run will work just fine:
mkdir test
make test
  cd test && pwd
  SOME_LONG_PATH/test
And finally, the info page says this speeds up the make process because make is no longer looking for those targets. This is not a huge speedup, but in large projects this time will add up as the build system gets larger and if building happens frequently.

Posted by Kurt | Permalink

03.21.2006 07:48

virtual machines

Soon I will be trying to run multiple operating systems on top of Mac OSX. I bought a copy of Virtual PC. Virtual PC also gives me a legal copy of XP pro. I will also be trying Q [kju:] which is QEMU.

It does not look like VMWare works on the Mac.

It is nice to see that there are premade images for Virtual PC of things like Ubuntu (The Breezy Badger) - 5.1.0; Linux i386 disk image for Virtual PC

Others include:

Posted by Kurt | Permalink

03.20.2006 12:36

Government Open Source - What is the deal?

COSMIC is the old NASA code release program. You got to spend a lot of money on software. I doubt that this program took in more money than it spent. Plus I still don't see VEVI in their list of programs and I know VEVI went into COSMIC.

GCN just posted about http://opensource.arc.nasa.gov. Why is there yet another open source license? And why is not more NASA developed software in there? So much code that is written at NASA rots or dies as it sits around doing nothing. I would love to see any of the projects I worked on at Ames go open source... even in those that probably don't work. For example, we worked really hard on a bunch of VxWorks and Linux software for the Marsokhod rover. Much of it has been superseded as new development teams take over after my group mostly left. That's fine, but that old work is probably just gone. It would be great to allow people to view the source code as the read the old journal articles!

Posted by Kurt | Permalink

03.20.2006 12:20

Game processor for military use

Mercury Computer pitches game processor for military use [Government Computer News]
...
  The Chelmsford, Mass., company is confident that the Cell Broadband
  Engine, as it is properly known, cannot only replace existing
  signal-processing technologies, but also introduce real-time radar,
  sonar and signals intelligence processing into the battlefield
  itself. 


The gaming machine processor "is a glimpse of the future," enthused Craig Lund, Mercury chief technology officer. "It's a disruptive change." ...
I am not sure why this is a "disruptive change" as general CPU's are becoming more and more able to do these kinds of DSP tasks. We don't need the TI DSP chips as much anymore. Many of us have been thinking along these lines (e.g. Alex) since at least 1999, but not for specifically military applications. The Cell architecture is going to take a couple years to come into its stride as the compiler and other tools get better.

Posted by Kurt | Permalink

03.20.2006 07:31

python asserts

I'm trying to build a flexible parser for AIS. There are a number of issues with the AIS specification that make it hard to parse. AIS is definitely NOT something that a normal grammar parser can handle (e.g. LALR and friends). One example is the region section of the position messages which are 1, 2, and 3. One of the fields is a region specific 4 byte value. How is the parser to know what region it is in? And then there is the "bit stuffing" mode that I have not gotten to yet where the message must have extra bits "stuffed" in there. I have yet to figure out why this is, but I am suspecting that certain bit patterns will be misconstrued as the training dataset at the beginning of each AIS message.

I've decided to go the route of a large setup of lookup tables that embed parse functions that know what to do with a chunk of bits. This is going to get challenging when the fields have interdependencies, but I will just have to refactor at that point.

To make my life safer, I am applying asserts to many of the functions to validate all the input and make python a bit more type safe. I know, this is not very pythonic, but I like to catch errors early. This is currently my function to build one table entry.
fieldTypes=['int']
def makeEntry(offset, fieldname, numbits, description='N/A', type='int', parseFunction=parseInt, units='N/A'):
    """Create the lookup table entry


offset - index of the first bit fieldname - what is this field called. e.g. FIX numbits - number of bits for this field. FIX: what if variable?? Scary. type - dict, int, float??, string, ?? what else. Standard types that are handled. dict must have a parseFunction! parseFunction - function that handles the contents of these bits units - the units after being converted... e.g. degrees/minute "
"" assert(offset<1000) # FIX: what is the max offset? assert(offset>=0) assert(numbits>0) assert(numbits<1000) # FIX: what is the max message size? assert(fieldTypes.__contains__(type)) # Make sure this is allowed assert(parseFunction != None) import types assert(isinstance(parseInt,types.FunctionType)) # Build the entry now that the world is safe entry = {'fieldname':fieldname, 'startOffset': offset, 'endOffset': offset+numbits-1, 'numbits': numbits, 'description':description, 'type': type, 'parseFunction':parseFunction} return(entry,offset+numbits)
The first few asserts just check the range of the offset and numbits. These need to be constrained to the maximum sizes of AIS packets. For the 'type' value, this has to be something the code knows about. I want to be able to expose a list of known types to people using this library - the 'fieldTypes' variable.

The trickiest bit is making sure parseFunction is an executable function. I would rather fail when building the table than go a long time before some rare message hits a bad value for the parseFunction.

And units... I have got to track these. It is critical to know what units a value has. There are too many running around in the marine world. SI, CGS, and nautical. What if someone assumed a depth was in fathoms and it really is feet? That would be 'bad'.

To build up a message dictionary, I do something like this:
    msg={}
    offset=0
    name='MessageID'; entry,offset=makeEntry(offset,name,6); msg[name]=entry
    name='RepeatIndicator'; entry,offset=makeEntry(offset,name,2); msg[name]=entry
    name='UserID'; entry,offset=makeEntry(offset,name,30,'MMSI ship id'); msg[name]=entry
    name='NavStatus'; entry,offset=makeEntry(offset,name,4); msg[name]=entry

Posted by Kurt | Permalink

03.20.2006 06:34

C++ and python

I am now in a waiting pattern for a couple fink packages to make it into the CVS tree. I have been enjoying some python coding using the BitVector module.

C++ Command Pattern for Network Operations reminds me that I should pick up my Design Patterns book again and start reading.

From QuickDraw to Quartz 2D reminds me that I am not really a Mac programmer. I am a software engineer, but I try to avoid too much Mac specific stuff.

Types and Objects in Python - Looking at the BitVector class shows that it is not too hard to create new solid types.

Posted by Kurt | Permalink

03.19.2006 08:43

python list comprehensions

I still do not feel comfortable with this kind of thing:
ipython
In [1]: l = ['1', 'two', '3']
In [2]: l = ["prepend" + s for s in l] 
In [3]: print l
['prepend1', 'prependtwo', 'prepend3']
And this is even stranger.
In [4]: l = ['1', 'two', '3']
In [6]: map("prefix%s".__mod__,l)
Out[6]: ['prefix1', 'prefixtwo', 'prefix3']
Now I'm working on cppunit for fink because gnuradio-core requires a newer version than is in fink. Also ran into trouble with fftw3. The tar ball for fftw 3.0.1 disappeared from the ftp server. Doh! Instead, I just used the binary version with a "sudo apt-get install fftw3 fftw3-shlibs"

Posted by Kurt | Permalink

03.19.2006 07:25

disappearing x windows

I seem to have a case of disappearing xterm windows. Is it just after a sleep? I open a xterm from the Applications menu, it then flashes on the screen and is gone. If I open one a few seconds later, it opens like normal. What gives?

Working on packaging gnu radio for fink. This one may take a while. Shared libs and a whole bunch of separate packages.

Posted by Kurt | Permalink

03.18.2006 22:00

CocoaLab - Learning Mac Programing

http://www.cocoalab.com/developer.htm - How to Become An Xcoder Book - free 60 page pdf book.

I have never really gotten into the whole cocoa programming thing. Maybe I should read this.

Posted by Kurt | Permalink

03.17.2006 21:39

GMSK in GNU Radio

http://www.gnu.org/software/gnuradio/
December 9, 2005 - GNU Radio 2.6 release


GNU Radio 2.6 includes sending and receiving data at up to 1Mbit/sec using GMSK. There's also support for the new USRP Flex 400 transceiver daughterboards. Handling of all daughterboards has been unified, so most apps will work without modification on any of them. For those of you interested in wireless networking, see especially gnuradio-examples/python/gmsk2. We've got a framework in place to allow you to build and experiment with your own MACs. 2.6 includes the "null MAC". A carrier sense MAC is the next logical step. For additional details see http://comsec.com/wiki?GnuRadio2.X.
Will it work on the Mac? It appears so: http://staff.washington.edu/~jon/gr-osx/gr-osx.html

Posted by Kurt | Permalink

03.16.2006 19:28

CARIS additional military layer

http://www.gisuser.com/content/view/8430/
 Database-driven Additional Military Layer Product Editor from CARIS
Written by CARIS 


CARIS announces the release of the Additional Military Layer (AML) Product Editor, the latest addition to the CARIS Hydrographic Production Database (HPD) product suite.Fredericton, NB, Canada - March 16, 2006 - CARIS announces the release of the Additional Military Layer (AML) Product Editor, the latest addition to the CARIS Hydrographic Production Database (HPD) product suite.

The release of AML Product Editor expands upon the existing HPD product suite, which already includes the HPD Source Editor, S-57 ENC Product Editor and Paper Chart Editor.

Posted by Kurt | Permalink

03.16.2006 19:19

AIS Range Performance monitoring

AIS Range Performance Being Monitored by R&D


An experimental Automatic Identification System (AIS) reception network has been established to analyze range performance and improve the ability to monitor vessel movement. The network, consisting of 20 reception sites at locations from Massachusetts to Hawaii, is used to study potential AIS surveillance performance. The live vessel data obtained by the network are distributed to a number of experimental and operational government information systems, such as the USCG Common Operational Picture. The AIS signals are generally thought to have a short operational range - only a little greater than the visible horizon. Experimentation with receiver design improvements, gain antennas, and attention to radio noise reduction has shown that AIS surveillance systems can frequently receive signals at ranges 2 to 10 times the visible horizon. Site-by-site analysis of range performance for all the reception sites connected to the RDC network is now available on an experimental web page https://ra2.rdc.uscg.gov/NAISprototype/AISdata.htm. The analysis should be of interest to VHF communications system planners, such as those designing high performance AIS facilities and surveillance networks.

Project: Automatic Identification System Research and Development (2410.5)

Posted by Kurt | Permalink

03.16.2006 19:14

CG Vessel Tracking Project

Vessel Tracking Project (VTP) Moves Toward Transition


The USCG and the U.S. Navy have joined forces in a cooperative partnership, funded with more than $31M of Navy money, that will provide the capability for extracting information from multiple security sources and provide the capability to fuse multi-intelligence data sources. The Vessel Tracking Project (VTP) will be deployed as an operational prototype system to support Maritime Domain Awareness. The cornerstone of this project is the Common Distributed Virtual Database with Information Extraction (CDVD/IE). The CDVD/IE allows a fusion of data with high levels of automation to create highly detailed vessel tracks. The R&D Program, the primary CG liaison to the Naval Research Lab (NRL), has exerted significant influence over this project so that it will provide operational value and near-term return on investment for the CG. The project's first operational capability will be deployed at the Maritime Intelligence Fusion Center (MIFC) Atlantic in July 2006, and additional installations are planned for Maritime Intelligence Fusion Center (MIFC) Pacific and National Maritime Intelligence Center (NMIC). From a long-term transition perspective, initial planning meetings have resulted in the identification and chartering of a joint USCG-USN Transition Working Group.

Project: Department of the Navy USCG Vessel Tracking Project

Posted by Kurt | Permalink

03.16.2006 14:46

Piscataqua River dredging

http://www.seacoastonline.com/news/03162006/news/92812.htm
  NEWINGTON - Port officials and the U.S. Army Corps of Engineers are
  entering the next phase of planning the expansion of the 800-foot
  turning basin in the Piscataqua River. 


Director of Ports and Harbors Geno Marconi said a new study will determine what type of sediment will need to be removed, the best way to remove it and where it will be sent in order to widen the basin.

Expanding the basin, located in the federal navigation channel between the shores of Eliot, Maine, and Newington, has been discussed for several years. ...

Posted by Kurt | Permalink

03.16.2006 13:47

Notes to Apple

http://www.macresearch.org/survey_the_transition_to_intel_and_its_impact_on_scientific_computing

Here are some of my responses to that request.
Please merge your GNU Make tweaks back into the mainline make tree!!
It is really frustrating that the standard GNU Make does not work for
the Fink project.


Would be good if Apple would contribute more to the DarwinPorts and Fink projects. Continual support and improvement of X11 is critical.

The mac package management/receipt system still needs some help.

The firewire camera support is still too complicated. How about an option to work like the old Linux BTB848 drivers where programs can read images from /dev/camera.format (e.g. ppm or pgm).

As a scientist, I just don't have time to struggle through learning Cocoa or Carbon enough to get at some of these APIs.

Please get python to to 2.4.x!

The lake of case sensitivity is driving me nuts with the Mac. The macosx libJPEG is messing with libjpeg. That kind of stuff is really painful.

More, more, more 64 bit support.

I would rather stick with PowerPC than go to Intel.

More CPUs, PCIExpress slots, and RAM please. I want a 16-way PowerPC box with 128GB of RAM and 4 PCI-Express 16-lane graphics cards that all are stereo capable.

How about a Mac OS-X based data-logger/embedded machine. Okay, I know that is crazy and I would rather use Linux where I can control everything, but would be interesting.

Internal RAID arrays would be "huge."

Why not just put the server functionality in every copy of Mac OSX?
I would also like to see ports to the Mac (both x86 and PPC) of ESRI tools, Caris, and SGI Performer. Not for me, but for others so that there is a chance of going all Mac for operations (e.g. on-board ships and spacecraft mission control centers)

Posted by Kurt | Permalink

03.16.2006 12:40

Touch screens

The World of Smartboards, Sympodiums is about to change by Jefferson Y. Han

Thanks to Roi for pointing this out.

Posted by Kurt | Permalink

03.16.2006 07:07

BitVector improvement

Avi tweaked BitVector a little bit to allow the binary or operator to work on different sized BitVectors. This is great as it make my function to set grow size of a BitVector that much easier.
In [1]: from BitVector import BitVector
In [2]: print BitVector(intVal=1) ^ BitVector(intVal=2)
11
In [3]: print BitVector(intVal=1) ^ BitVector(bitlist=[0,0,0,0,0,0,0,0])
00000001
In [4]: print BitVector(intVal=1) ^ BitVector(bitlist=[0]*8)
00000001
So the new function is just two lines...
def bvSize(bv,size=8):
    return (bv ^ BitVector(bitlist=[0]*size))
Which works like this:
In [6]: print bvSize(BitVector(intVal=123),32)
00000000000000000000000001111011

Posted by Kurt | Permalink

03.16.2006 06:09

IEEE Vis 2006

Abstracts are due in 5 days...

Posted by Kurt | Permalink

03.16.2006 00:06


Posted by Kurt | Permalink

03.14.2006 13:40

BitVector python module

I just added BitVector 1.2 to fink 10.4-transitional/unstable. This is a nice package for bit twiddling written by Avi Kak at Purdue.

This package makes working with bit level data much easier than it ever was in C or C++. STL in C++ has trouble with bit vectors and the C bit operators are not the most fun. BitVector has the muscle to make the job much more understandable.
python
from BitVector import BitVector
bv = BitVector(bitlist = [ 0,0,1,0]); print bv
  0010
print bv[-2]
  1
b2=BitVector(intVal=2);print b2
  10

Posted by Kurt | Permalink

03.14.2006 08:19

4 pci express slots - 8 heads

Gigabyte GA-8N-SLI Quad Royal Motherboard has 4 PCI Express x16 slots. Too bad this is not the same motherboard that has 4 opteron sockets. Just think about 8 Opteron Cores with 128 GB of ram and 4 Graphics Cards. Now combine that with a math library that is able to push some operations to the graphics cards. That is some serious crunching power in a small form factor without going with crazy hardware. What kind of powersuppy and cooling system would be needed? Perhaps just hook it straight into the buildings AC system.

Posted by Kurt | Permalink

03.13.2006 13:52

pivy fink packages!

This is VERY exciting! After wanting a swig python API for OpenInventor for 9 years, I just ran one for the first time today. I now have fink info files that work for 10.4-transitional. AWESOME!!!
#!/usr/bin/env python
# Copyright (c) 2002, Tamer Fahmy <tamer@tammura.at>
import sys
from pivy.sogui import *
from pivy.coin import *
def main():
    myWindow = SoGui.init(sys.argv[0])
    if myWindow == None: sys.exit(1)
#
    root = SoSeparator()
    myCamera = SoPerspectiveCamera()
    myMaterial = SoMaterial()
    root.addChild(myCamera)
    root.addChild(SoDirectionalLight())
    myMaterial.diffuseColor = (1.0, 0.0, 0.0)   # Red
    root.addChild(myMaterial)
    root.addChild(SoCone())
#
    myRenderArea = SoGuiRenderArea(myWindow)
#
    myCamera.viewAll(root, myRenderArea.getViewportRegion())
#
    myRenderArea.setSceneGraph(root)
    myRenderArea.setTitle("Hello Cone")
    myRenderArea.show()
#
    SoGui.show(myWindow)  # Display main window
    SoGui.mainLoop()    # Main Inventor event loop
#
if __name__ == "__main__":
    main()

Posted by Kurt | Permalink

03.13.2006 09:43

worldKit

No, this is now World Tool Kit... this is worldKit - a flash based google maps like system that is released under the GPL license. Now quick as slick an interface as Google maps/local, but it looks like it works. I am curious about the RSS integration, but don't have time right now to dig further.

Note: I am still working on pivy and bitvector packages. For pivy, Tamer let me know that it will not work with swig 1.3.28, so I am packaging swig 1.3.25. Hopefully swig 1.3.29 will clear things up.

Posted by Kurt | Permalink

03.13.2006 06:49

Google Mars

I heard this was going to be released