State Machines in Python

Stef Mientki stef.mientki at gmail.com
Sat Sep 4 12:26:17 EDT 2010


 On 04-09-2010 15:36, Jack Keegan wrote:
> Hi girls & guys,
>
> Just joined the group. I'm new to Python but been picking it up pretty easy. I love it! I'm hoping
> to use it to make a controlling application for an experiment. Basically I want to use it to
> interface with some data acquisition (DAQ) hardware to accept incoming signals and respond sending
> signals to the outputs. I'm looking for an efficient State Machine algorithm as I need the timing
> to be as good as possible.
What is as good as possible, 1 usec, 1 msec ?
What operating system are you using ?
Are you planning feedback ?
For a comparison, I did a few years ago sampling in Python, with NI cards (they ensure time accuracy
which can never be achieved in software),
50 kHz (divided over 1 to 8 channels), 32 bit, storage and graphical display, and processor activity
was about 10%.

Maybe you should also look at what those radio guys from gnu radio achive.

cheers,
Stef

> As there is no switch statement in Python, I've been looking around for a good implementation.
> Most of the algorithms I've come across seem to be based on parsing applications. I'd like
> something more suited to my needs. I'd like to avoid excessive use of 'if-elif-else' statements as
> each would have to be checked to find the right conditions which would have an time overhead
> involved. I have seen an implementation of the switch using dictionaries but someone had commented
> that creating and throwing away dictionaries also comes at a cost.
> I was wondering if any of you could advise or point me in the right direction.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Jack




More information about the Python-list mailing list