Table of Contents

Module: filetable py4cs/filetable.py

Read tabular data from file into NumPy arrays and vice versa.

This module provides functions for

  • reading row-column table data from file into NumPy arrays * writing two-dimensional NumPy arrays to file in a table fashion.

read: Load a table with numbers into a two-dim. NumPy array. file file object commentchar files starting with commentchar are skipped (blank lines are also skipped) output: two-dimensional (row-column) NumPy array.

write: Write a two-dim. NumPy array a in tabular form. file file object a two-dim. NumPy array

readfile: As read, but input is filename rather than a file object. The columns are returned as separate arrays instead of a two-dimensional array.

Imported modules   
from Numeric import *
import os
import re
import string
import sys
Functions   
_generate
_test
read
readfile
write
  _generate 
_generate (
        m,
        n,
        filename,
        title=None,
        )

  _test 
_test ( n )

  read 
read ( file,  commentchar='#' )

Load a table with numbers into a two-dim. NumPy array.

  readfile 
readfile ( filename,  commentchar='#' )

As read. Return columns as separate arrays.

  write 
write ( file,  a )

Write a two-dim. NumPy array a in tabular form.

Exceptions   
TypeError, "a 2D array is required, shape now is " + str( a.shape )

Table of Contents

This document was automatically generated on Sun Mar 14 15:31:01 2004 by HappyDoc version 2.1