state_reader

sans.guiframe.state_reader

class sans.guiframe.state_reader.Reader1D

read state of a plugin and available data

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
class sans.guiframe.state_reader.Reader2D

Class to load a basic guiframe state

read(path)

Load a new P(r) inversion state from file

Parameters:path – file path
write(filename, datainfo=None, fitstate=None)

Write the content of a Data1D as a CanSAS XML file only for standalone

Parameters:
  • filename – name of the file to write
  • datainfo – Data1D object
  • fitstate – PageState object
write_toXML(datainfo=None, state=None)

Write toXML, a helper for write() , could be used by guimanager._on_save()

: return: xml doc

sans.guiframe.state_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

sans.guiframe.state_reader.get_float(location, node)

Get the content of a node as a float

Parameters:
  • location – xpath location
  • node – node to start at
sans.guiframe.state_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

startup_configuration

Next topic

utils

This Page