cansas_reader

DataLoader.readers.cansas_reader

class DataLoader.readers.cansas_reader.Reader

Class to load cansas 1D XML files

Dependencies :The CanSas reader requires PyXML 0.8.4 or later.
read(path)

Load data file

Parameters:

path – file path

Returns:

Data1D object if a single SASentry was found, or a list of Data1D objects if multiple entries were found, or None of nothing was found

Raises:
  • RuntimeError – when the file can’t be opened
  • ValueError – when the length of the data vectors are inconsistent
write(filename, datainfo)

Write the content of a Data1D as a CanSAS XML file

Parameters:
  • filename – name of the file to write
  • datainfo – Data1D object
DataLoader.readers.cansas_reader.get_content(location, node)

Get the first instance of the content of a xpath location.

Parameters:
  • location – xpath location
  • node – node to start at
Returns:

Element, or None

DataLoader.readers.cansas_reader.get_float(location, node)

Get the content of a node as a float

Parameters:
  • location – xpath location
  • node – node to start at
DataLoader.readers.cansas_reader.write_node(doc, parent, name, value, attr={})
Parameters:
  • doc – document DOM
  • parent – parent node
  • name – tag of the element
  • value – value of the child text node
  • attr – attribute dictionary
Returns:

True if something was appended, otherwise False

Table Of Contents

Previous topic

associations

Next topic

danse_reader

This Page