Reading a binary file containing periodic samples
data = in_f.read(12)
    num_samples, sample_period, sample_size, param_kind = unpack('&gt;iihh', data)
    A = B = 0
    if compressed:
        A = array('f')
        A.fromfile(in_f, sample_size/2)
        B = array('f')
        B.fromfile(in_f, sample_size/2)
        #The first 4 samples were the matrices
        num_samples -= 4


And so on