pagestate

sans.perspectives.fitting.pagestate

class sans.perspectives.fitting.pagestate.PageState

Bases: object

Contains information to reconstruct a page of the fitpanel.

__class__

alias of type

__delattr__

x.__delattr__(‘name’) <==> del x.name

__dict__ = <dictproxy object at 0x0873E610>
__getattribute__

x.__getattribute__(‘name’) <==> x.name

__hash__

x.__hash__() <==> hash(x)

__init__()

Initialize the current state

Parameters:
  • model – a selected model within a page
  • data
__module__ = 'sans.perspectives.fitting.pagestate'
static __new__(S, ...) → a new object with type S, a subtype of T
__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__()

output string for printing

__setattr__

x.__setattr__(‘name’, value) <==> x.name = value

__str__

x.__str__() <==> str(x)

__weakref__

list of weak references to the object (if defined)

_check_html_format()

Check string ‘%’ for html format

_fromXML_helper()

Helper function to write state to xml

_repr_helper()

Helper method to print a state

_toXML_helper()

Helper method to create xml file for saving state

clone()

Create a new copy of the current object

fromXML()

Load fitting state from a file

Parameters:
  • file – .fitv file
  • node – node of a XML document to read from
report()

Invoke report dialog panel

: param figs: list of pylab figures [list]

set_plot_state()

Build image state that wx.html understand by plotting, putting it into wx.FileSystem image object

set_report_string()

Get the values (strings) from __str__ for report

toXML()

Writes the state of the InversionControl panel to file, as XML.

Compatible with standalone writing, or appending to an already existing XML document. In that case, the XML document is required. An optional entry node in the XML document may also be given.

Parameters:
  • file – file to write to
  • doc – XML document object [optional]
  • entry_node – XML node within the XML document at which we will append the data [optional]
class sans.perspectives.fitting.pagestate.Reader

Bases: sans.dataloader.readers.cansas_reader.Reader

Class to load a .fitv fitting file

__init__()
__module__ = 'sans.perspectives.fitting.pagestate'
_data2d_to_xml_doc()

Create an XML document to contain the content of a Data2D

Parameters:datainfo – Data2D object
_parse_entry()

Parse a SASentry

Parameters:node – SASentry node
Returns:Data1D/Data2D object
_parse_state()

Read a fit result from an XML node

Parameters:entry – XML node to read from
Returns:PageState object
_read_cansas()

Load data and P(r) information from a CanSAS XML 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
_store_content()

Get the content of a xpath location and store the result. The value is treated as a string.

The xpath location might or might not exist. If it does not exist, nothing is done

Parameters:
  • location – xpath location to fetch
  • node – node to read the data from
  • variable – name of the data member to store it in [string]
  • storage – data object that has the ‘variable’ data member
Returns:

return a list of errors

_store_float()

Get the content of a xpath location and store the result. Check that the units are compatible with the destination. The value is expected to be a float.

The xpath location might or might not exist. If it does not exist, nothing is done

Parameters:
  • location – xpath location to fetch
  • node – node to read the data from
  • variable – name of the data member to store it in [string]
  • storage – data object that has the ‘variable’ data member
  • optional – if True, no exception will be raised if unit conversion can’t be done
Raises ValueError:
 

raised when the units are not recognized

_to_xml_doc()

Create an XML document to contain the content of a Data1D

Parameters:datainfo – Data1D object
ext = ['.fitv', '.FITV', '.svs', 'SVS']
get_state()
read()

Load a new P(r) inversion state from file

Parameters:path – file path
type = ['Fitting files (*.fitv)|*.fitvSANSView file (*.svs)|*.svs']
type_name = 'Fitting'
version = '1.0'
write()

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()

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

: return: xml doc

sans.perspectives.fitting.pagestate.parse_entry_helper()

Create a numpy list from value extrated from the node

Parameters:
  • node – node from each the value is stored
  • item – list name of three strings.the two first are name of data attribute and the third one is the type of the value of that attribute. type can be string, float, bool, etc.

: return: numpy array

Table Of Contents

Previous topic

model_thread

Next topic

report_dialog

This Page