[SciPy-user] Scientific data - Reading files

Travis Oliphant oliphant.travis at ieee.org
Mon Aug 12 11:56:05 CDT 2002

On Mon, 2002-08-12 at 02:00, Nils Wagner wrote:
> Hi,
> I have collected acceleration data by a multi-channel data acquisition
> system. Each file  (E1431A*.DAT) contains
> one column with real numbers. The contents of the i-th file should be
> stored in the i-th row of a data matrix A.
> How can I manage this task efficiently ? Are there suitable python
> modules for this purpose ? 
> A small example would be appreciated.

I don't know of any specific modules for this but I've done something
similar with the following:

import string
import commands
from scipy import *

def read_all(basestr='E1431A*.DAT'):
    # this line may need to be different if you are not on UNIX.
    files = string.split(commands.getoutput('ls %s' % basestr))
    data = []
    for file in files:
        d = io.read_array(file)

    return Numeric.array(d)

More information about the SciPy-user mailing list