Bitstream -- Binary Data for Humans

Sébastien Boisgérault sebastien.boisgerault at gmail.com
Tue Mar 6 04:23:05 EST 2018


Le mardi 6 mars 2018 09:26:50 UTC+1, Sébastien Boisgérault a écrit :
> Le mardi 6 mars 2018 00:29:25 UTC+1, Roel Schroeven a écrit :
> > Sébastien Boisgérault schreef op 5/03/2018 20:05:
> > > I have released bitstream, a Python library to manage binary data (at the byte or bit level),
> >  > hopefully without the pain that this kind of thing usually entails :)
> > > 
> > > If you have struggled with this topic in the past, please take a look at the documentation
> >  > (http://boisgera.github.io/bitstream/) and tell me what you think.
> > 
> > Hi Sébastien,
> > 
> > At work I have some Python code to decode AIS[1] messages, for which I 
> > created my own code for handling binary data. It works, but is pretty 
> > slow. Not surprising, since handling data at the bit level is not 
> > exactly Python's strength. If I find the time, I'll try to replace my 
> > code with your bitstream and see if it does what I need it to do, and if 
> > it's any faster.
> > 
> > If/when I actually get around to it, I'll keep you informed.
> > 
> > [1] https://en.wikipedia.org/wiki/Automatic_identification_system
> > 
> > 
> > Best regards,
> > Roel
> > 
> > -- 
> > The saddest aspect of life right now is that science gathers knowledge
> > faster than society gathers wisdom.
> >    -- Isaac Asimov
> > 
> > Roel Schroeven
> 
> Great, thanks !

Hi again Roel,

I had a look at the AIS message format from your link (https://en.wikipedia.org/wiki/Automatic_identification_system#Message_format) and this seems to be a nice use case; all the data components seem to be nicely aligned on the byte boundary ... until you see that the payload uses ASCII6(*), which I didn't know about. 

Thanks again for the info!

Cheers,

(*) ASCII6 code = ASCII code + 48; (http://catb.org/gpsd/AIVDM.html#_aivdm_aivdo_sentence_layer)
SB






More information about the Python-list mailing list