sas.sasgui.perspectives.invariant package

Submodules

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.

clear_panel()[source]
compute_helper(data)[source]
delete_data(data_id)[source]
get_context_menu(plotpanel=None)[source]

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
get_data()[source]
get_panels(parent)[source]

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
on_set_state_helper(event=None)[source]

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.

Parameters:
  • 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.

Parameters:
  • filepath – path of file to write to
  • state – invariant state
set_data(data_list=None)[source]

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_values()[source]

check the validity if invariant

compute_percentage()[source]

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.

on_close(event)[source]

Close the current window

on_paint(event)[source]

Draw the chart

set_color_bar()[source]

Change the color for low and high bar when necessary

set_values()[source]

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.

CENTER_PANE = True
clear_panel()[source]

Clear panel to defaults, used by set_state of manager

compute_invariant(event=None)[source]

compute invariant

display_details(event)[source]

open another panel for more details on invariant calculation

get_background()[source]

return the background textcrtl value as a float

get_bookmark_by_num(num=None)[source]

Get the bookmark state given by number

: param num: the given bookmark number

get_contrast()[source]

return the contrast textcrtl value as a float

get_data()[source]
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

get_porod_const()[source]

return the porod constant textcrtl value as a float

get_qstar(inv)[source]

get qstar

get_scale()[source]

return the scale textcrtl value as a float

get_state()[source]
get_state_by_num(state_num=None)[source]

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

on_bookmark(event)[source]

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

on_help(event)[source]

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
on_preview(event=None)[source]

Invoke report dialog panel

: param event: report button event

on_redo(event=None)[source]

Go forward to the previous state

: param event: redo button event

on_save(evt=None)[source]

Save invariant state into a file

on_undo(event=None)[source]

Go back to the previous state

: param event: undo button event

reset_panel()[source]

set the panel at its initial state.

save_project(doc=None)[source]
return an xml node containing state of the panel
that guiframe can write to file
set_data(data)[source]

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_manager(manager)[source]

set value for the manager

set_message()[source]

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

OnInit()[source]

Init

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.

clone_state()[source]

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

set_report_string()[source]

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']
get_state()[source]
read(path)[source]

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

get_data()[source]

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.

onSave(event=None)[source]

Save

Module contents

sas.sasgui.perspectives.invariant.data_files()[source]

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 setup.py.

sas.sasgui.perspectives.invariant.get_data_path(media)[source]