sas.sasgui.perspectives.invariant package


sas.sasgui.perspectives.invariant.invariant module

class sas.sasgui.perspectives.invariant.invariant.Plugin[source]

Bases: sas.sasgui.guiframe.plugin_base.PluginBase

This class defines the interface for invariant Plugin class that can be used by the gui_manager.


This method is optional.

When the context menu of a plot is rendered, the get_context_menu method will be called to give you a chance to add a menu item to the context menu.

A ref to a Graph object is passed so that you can investigate the plot content and decide whether you need to add items to the context menu.

This method returns a list of menu items. Each item is itself a list defining the text to appear in the menu, a tool-tip help text, and a call-back method.

Parameters:graph – the Graph object to which we attach the context menu
Returns:a list of menu items with call-back function

Create and return the list of wx.Panels for your plug-in. Define the plug-in perspective.

Panels should inherit from DefaultPanel defined below, or should present the same interface. They must define “window_caption” and “window_name”.

Parameters:parent – parent window
Returns:list of panels

Set the state when called by EVT_STATE_UPDATE event from guiframe after a .inv/.svs file is loaded

plot_data(scale, background)[source]

replot the current data if the user enters a new scale or background

plot_theory(data=None, name=None)[source]

Receive a data set and post a NewPlotEvent to parent.

  • data – extrapolated data to be plotted
  • name – Data’s name to use for the legend
save_file(filepath, state=None)[source]

Save data in provided state object.

  • filepath – path of file to write to
  • state – invariant state

receive a list of data and compute invariant

set_state(state=None, datainfo=None)[source]

Call-back method for the state reader. This method is called when a .inv/.svs file is loaded.

Parameters:state – State object

sas.sasgui.perspectives.invariant.invariant_details module

Invariant panel

class sas.sasgui.perspectives.invariant.invariant_details.InvariantContainer[source]

Bases: wx._core.Object

This class stores some values resulting resulting from invariant calculations. Given the value of total invariant, this class can also determine the percentage of invariants resulting from extrapolation.


check the validity if invariant


Compute percentage of each invariant

class sas.sasgui.perspectives.invariant.invariant_details.InvariantDetailsPanel(parent=None, id=-1, qstar_container=None, title='Invariant Details', size=(500, 430))[source]

Bases: wx._windows.Dialog

This panel describes proportion of invariants

get_scale(percentage, scale_name='scale')[source]

Check scale receive in this panel.


Close the current window


Draw the chart


Change the color for low and high bar when necessary


Set value of txtcrtl

sas.sasgui.perspectives.invariant.invariant_panel module

This module provides the GUI for the invariant perspective panel

class sas.sasgui.perspectives.invariant.invariant_panel.InvariantDialog(parent=None, id=1, graph=None, data=None, title='Invariant', base=None)[source]

Bases: wx._windows.Dialog

Invariant Dialog

class sas.sasgui.perspectives.invariant.invariant_panel.InvariantPanel(parent, data=None, manager=None, *args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel, sas.sasgui.guiframe.panel_base.PanelBase

Main class defining the sizers (wx “panels”) used to draw the Invariant GUI.


Clear panel to defaults, used by set_state of manager


compute invariant


open another panel for more details on invariant calculation


return the background textcrtl value as a float


Get the bookmark state given by number

: param num: the given bookmark number


return the contrast textcrtl value as a float

get_extrapolation_type(low_q, high_q)[source]

get extrapolation type

get_high_qstar(inv, high_q=False)[source]

get high qstar

get_low_qstar(inv, npts_low, low_q=False)[source]

get low qstar


return the porod constant textcrtl value as a float


get qstar


return the scale textcrtl value as a float


Get the state given by number

: param state_num: the given state number

get_surface(inv, contrast, porod_const, extrapolation)[source]

get surface value

get_total_qstar(inv, extrapolation)[source]

get total qstar

get_volume(inv, contrast, extrapolation)[source]

get volume fraction


Save the panel state in memory and add the list on the popup menu on bookmark context menu event


Bring up the Invariant Documentation whenever the HELP button is clicked.

Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....”. Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, the help comes up at the top level of the file as webbrowser does not pass anything past the # to the browser when it is running “file:///....”

Parameters:evt – Triggers on clicking the help button

Invoke report dialog panel

: param event: report button event


Go forward to the previous state

: param event: redo button event


Save invariant state into a file


Go back to the previous state

: param event: undo button event


set the panel at its initial state.

return an xml node containing state of the panel
that guiframe can write to file

Set the data

set_extrapolation_high(inv, high_q=False)[source]

return float value necessary to compute invariant a high q

set_extrapolation_low(inv, low_q=False)[source]

return float value necessary to compute invariant a low q


set value for the manager


Display warning message if available

set_state(state=None, data=None)[source]

set state when loading it from a .inv/.svs file

window_caption = 'Invariant'
window_name = 'Invariant'
class sas.sasgui.perspectives.invariant.invariant_panel.InvariantWindow(parent=None, id=1, graph=None, data=None, title='Invariant', base=None)[source]

Bases: wx._windows.Frame

Invariant Window

class sas.sasgui.perspectives.invariant.invariant_panel.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

Test App



sas.sasgui.perspectives.invariant.invariant_state module

State class for the invariant UI

class sas.sasgui.perspectives.invariant.invariant_state.InvariantState[source]

Bases: object

Class to hold the state information of the InversionControl panel.


deepcopy the state

fromXML(file=None, node=None)[source]

Load invariant states from a file

: param file: .inv file : param node: node of a XML document to read from

set_plot_state(extra_high=False, extra_low=False)[source]

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

: extrap_high,extra_low: low/high extrapolations are possible extra-plots


Get the values (strings) from __str__ for report

set_saved_state(name, value)[source]

Set the state list

: param name: name of the state component : param value: value of the state component

toXML(file='inv_state.inv', doc=None, entry_node=None)[source]

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.

: param file: file to write to : param doc: XML document object [optional] : param entry_node: XML node within the document at which we will append the data [optional]

class sas.sasgui.perspectives.invariant.invariant_state.Reader(call_back, cansas=True)[source]

Bases: sas.sascalc.dataloader.readers.cansas_reader.Reader

Class to load a .inv invariant file

ext = ['.inv', '.INV', '.svs', 'SVS']

Load a new invariant state from file

: param path: file path : return: None

type = ['Invariant file (*.inv)|*.inv', 'SASView file (*.svs)|*.svs']
type_name = 'Invariant'
write(filename, datainfo=None, invstate=None)[source]

Write the content of a Data1D as a CanSAS XML file

: param filename: name of the file to write : param datainfo: Data1D object : param invstate: InvariantState object

write_toXML(datainfo=None, state=None)[source]

Write toXML, a helper for write()

: return: xml doc

sas.sasgui.perspectives.invariant.invariant_widgets module

class sas.sasgui.perspectives.invariant.invariant_widgets.DataDialog(data_list, parent=None, text='', *args, **kwds)[source]

Bases: wx._windows.Dialog

Allow file selection at loading time


return the selected data

class sas.sasgui.perspectives.invariant.invariant_widgets.DialogPanel(*args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

class sas.sasgui.perspectives.invariant.invariant_widgets.InvTextCtrl(*args, **kwds)[source]

Bases: wx._controls.TextCtrl

Text control for model and fit parameters. Binds the appropriate events for user interactions.

class sas.sasgui.perspectives.invariant.invariant_widgets.OutputTextCtrl(*args, **kwds)[source]

Bases: wx._controls.TextCtrl

Text control used to display outputs. No editing allowed. The background is grayed out. User can’t select text.

sas.sasgui.perspectives.invariant.report_dialog module

Dialog report panel to show and summarize the results of the invariant calculation.

class sas.sasgui.perspectives.invariant.report_dialog.ReportDialog(report_list, *args, **kwds)[source]

Bases: sas.sasgui.guiframe.report_dialog.BaseReportDialog

The report dialog box.



Module contents


Return the data files associated with media invariant.

The format is a list of (directory, [files...]) pairs which can be used directly in setup(...,data_files=...) for