Package xdp :: Package io
[show private | hide private]
[frames | no frames]

Package xdp.io

Read and write experiment data and metadata.

The file formats supported by xfp:
Submodules
  • sff: Read and write files using Mx's Simple File Format.
  • text: Read and write plain-text files of data.
  • xafs: Read and write files using the MR-CAT XAFS file format, version 0.3.

Function Summary
2-tuple of the form (header, data) readFile(fileName)
Read experiment data and metadata from a file.
  writeFile(fileName, header, data)
Write experiment data and metadata to a file.
readXXXFile fuction or None _guessFormat(path)
Attempt to determine the file format.

Variable Summary
dict _FORMATS = {<function readTextFile at 0xb7dc833c>: ['tex...

Function Details

readFile(fileName)

Read experiment data and metadata from a file.

The format of the file is guessed from the file's extension and the contents.
Parameters:
fileName - file to open
           (type=string)
Returns:
header and data
           (type=2-tuple of the form (header, data))
Raises:
IOError - could not guess the file format, or open, read, or parse the file

To Do: verify that the file access mode does not need to be binary

writeFile(fileName, header, data)

Write experiment data and metadata to a file.

The format of the file is determined by the class of the header argument.
Parameters:
fileName - file to write
           (type=string)
header - metadata
           (type=SFF or Xafs or Text)
data - dataset
           (type=Data)
Raises:
IOError - either header or data contain invalid information, or the file could not be opened for writing

To Do: verify that the file access mode does not need to be binary

_guessFormat(path)

Attempt to determine the file format. None is returned if the format is unknown.
Parameters:
path - file
           (type=string)
Returns:
input function
           (type=readXXXFile fuction or None)

Variable Details

_FORMATS

Type:
dict
Value:
{<function readSffFile at 0xb7dc0ca4>: ['sff',
                                        <_sre.SRE_Pattern object at 0x\
b7e50c58>],
 <function readXafsFile at 0xb7dc81b4>: ['xafs',
                                         <_sre.SRE_Pattern object at 0\
xb7e38e60>],
 <function readTextFile at 0xb7dc833c>: ['text',
                                         <_sre.SRE_Pattern object at 0\
...                                                                    

Generated by Epydoc 2.1 on Wed Jul 20 11:51:05 2005 http://epydoc.sf.net