Length of read in in python-gpib

Madhusudan Singh spammers-go-here at spam.invalid
Sat Oct 15 21:02:03 EDT 2005


python-gpib provides Gpib.py (see end of post) for Linux.

I am trying to use the method called read. I usually use it without
arguments (the default length being 512). However, I am trying to read in a
string with some 16,000 comma separated floating point numbers.

So, I have to pass a length parameter much much larger than 512. As is
stands, the default read takes in only about 35-40 numbers, so I need about
512/35*16000 ~= 230,000. Not being sure if I could make python read in
something that big, I started small - with 1024. This produces an list of
numbers that has a malformed first number (I get 88309e-9 instead of
something like 6.788309e-9.).

Could this be a bug ?

Second, does the length need to be a power of two for some reason ?

python-gpib is an excellent library, but it suffers from an utter lack of
documentation.

------------------------ Gpib.py -----------------------------
import gpib

RQS = (1<<11)
SRQ = (1<<12)
TIMO = (1<<14)


class Gpib:
        def __init__(self,name='gpib0'):
                self.id = gpib.find(name)


        def write(self,str):
                gpib.write(self.id, str)

        def writebin(self,str,len):
                gpib.writebin(self.id,str,len)


        def read(self,len=512):
                self.res = gpib.read(self.id,len)
                return self.res

        def readbin(self,len=512):
                self.res = gpib.readbin(self.id,len)
                return self.res

        def clear(self):
                gpib.clear(self.id)
                
        def wait(self,mask):
                gpib.wait(self.id,mask)
        
        def rsp(self):
                self.spb = gpib.rsp(self.id)
                return self.spb

        def trigger(self):
                gpib.trg(self.id)

        def ren(self,val):
                gpib.ren(self.id,val)

        def ibsta(self):
                self.res = gpib.ibsta()
                return self.res

        def ibcnt(self):
                self.res = gpib.ibcnt()
                return self.res

        def tmo(self,value):
                return gpib.tmo(self.id,value)



More information about the Python-list mailing list