sas.perspectives.invariant package

Submodules

sas.perspectives.invariant.help_panel module

class sas.perspectives.invariant.help_panel.HelpDialog(parent, id)[source]

Bases: wx._windows.Dialog

class sas.perspectives.invariant.help_panel.HelpWindow(parent, id, title='HelpWindow', pageToOpen=None)[source]

Bases: wx._windows.Frame

OnLinkClicked(event)[source]

Function to diplay html page related to the hyperlinktext selected

class sas.perspectives.invariant.help_panel.ViewApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

OnInit()[source]

sas.perspectives.invariant.invariant module

class sas.perspectives.invariant.invariant.Plugin(standalone=False)[source]

Bases: sas.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
help(evt)[source]

Show a general help dialog.

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.perspectives.invariant.invariant_details module

Invariant panel

class sas.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.perspectives.invariant.invariant_details.InvariantDetailsPanel(parent=None, id=-1, qstar_container=None, title='Invariant Details', size=(530, 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.perspectives.invariant.invariant_panel module

This module provide GUI for the neutron scattering length density calculator

class sas.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.perspectives.invariant.invariant_panel.InvariantPanel(parent, data=None, manager=None, *args, **kwds)[source]

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

Provides 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_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.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.perspectives.invariant.invariant_panel.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

Test App

OnInit()[source]

Init

sas.perspectives.invariant.invariant_state module

class sas.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 XML document at which we will append the data [optional]

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

Bases: sas.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.perspectives.invariant.invariant_widgets module

class sas.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.perspectives.invariant.invariant_widgets.DialogPanel(*args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

class sas.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.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.perspectives.invariant.report_dialog module

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

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

Bases: wx._windows.Dialog

The report dialog box.

HTML2PDF(data, filename)[source]

Create a PDF file from html source string.

: data: html string : filename: name of file to be saved

OnClose(event=None)[source]

Close the Dialog

: event: Close button event

onPreview(event=None)[source]

Preview

: event: Preview button event

onPrint(event=None)[source]

Print

: event: Print button event

onSave(event=None)[source]

Save

Module contents

sas.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.perspectives.invariant.get_data_path(media)[source]