sas.sasgui.perspectives.pr package

Submodules

sas.sasgui.perspectives.pr.explore_dialog module

Dialog panel to explore the P(r) inversion results for a range of D_max value. User picks a number of points and a range of distances, then can toggle between inversion outputs and see their distribution as a function of D_max.

class sas.sasgui.perspectives.pr.explore_dialog.ExploreDialog(pr_state, nfunc, *args, **kwds)[source]

Bases: wx._windows.Dialog

The explorer dialog box. This dialog is meant to be invoked by the InversionControl class.

class Event[source]

Bases: object

Class that holds the content of the form

dmax = 0
dmin = 0
npts = 0
ExploreDialog.send_focus_to_datapanel(name)[source]

The GUI manager sometimes calls this method TODO: refactor this

ExploreDialog.set_plot_unfocus()[source]

Not implemented

class sas.sasgui.perspectives.pr.explore_dialog.OutputPlot(d_min, d_max, parent, id=-1, color=None, dpi=None, style=0, **kwargs)[source]

Bases: sas.sasgui.plottools.PlotPanel.PlotPanel

Plot panel used to show the selected results as a function of D_max

onContextMenu(event)[source]

Default context menu for the plot panel

TODO:Would be nice to add printing and log/linear scales. The current verison of plottools no longer plays well with plots outside of guiframe. Guiframe team needs to fix this.
window_caption = 'D Explorer'
class sas.sasgui.perspectives.pr.explore_dialog.Results[source]

Bases: object

Class to hold the inversion output parameters as a function of D_max

sas.sasgui.perspectives.pr.inversion_panel module

class sas.sasgui.perspectives.pr.inversion_panel.InversionControl(parent, id=-1, plots=None, **kwargs)[source]

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

CENTER_PANE = True
clear_panel()[source]
get_data()[source]
get_state()[source]

Get the current state

: return: state object

on_help(event)[source]

Bring up the P(r) 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_reset(event=None)[source]

Resets inversion parameters

on_save(evt=None)[source]

Method used to create a memento of the current state

Returns:state object
oscillation_max = 1.5
save_project(doc=None)[source]
return an xml node containing state of the panel
that guiframe can write to file
set_manager(manager)[source]
set_state(state)[source]

Set the state of the panel and inversion problem to the state passed as a parameter. Execute the inversion immediately after filling the controls.

Parameters:state – InversionState object
window_caption = 'P(r) control panel'
window_name = 'pr_control'
class sas.sasgui.perspectives.pr.inversion_panel.PrDistDialog(parent, id)[source]

Bases: wx._windows.Dialog

Property dialog to let the user change the number of points on the P(r) plot.

get_content()[source]

Return the content of the dialog. At this point the values have already been checked.

set_content(npts)[source]

Initialize the content of the dialog.

sas.sasgui.perspectives.pr.inversion_state module

Handling of P(r) inversion states

class sas.sasgui.perspectives.pr.inversion_state.InversionState[source]

Bases: object

Class to hold the state information of the InversionControl panel.

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

Load a P(r) inversion state from a file

Parameters:
  • file – .prv file
  • node – node of a XML document to read from
toXML(file='pr_state.prv', 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.

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 sas.sasgui.perspectives.pr.inversion_state.Reader(call_back, cansas=True)[source]

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

Class to load a .prv P(r) inversion file

ext = ['.prv', '.PRV', '.svs', '.SVS']
read(path)[source]

Load a new P(r) inversion state from file

Parameters:path – file path
Returns:None
type = ['P(r) files (*.prv)|*.prv', 'SASView files (*.svs)|*.svs']
type_name = 'P(r)'
write(filename, datainfo=None, prstate=None)[source]

Write the content of a Data1D as a CanSAS XML file

Parameters:
  • filename – name of the file to write
  • datainfo – Data1D object
  • prstate – InversionState object
write_toXML(datainfo=None, state=None)[source]

Write toXML, a helper for write()

: return: xml doc

sas.sasgui.perspectives.pr.pr module

P(r) perspective for SasView

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

Bases: sas.sasgui.guiframe.plugin_base.PluginBase

P(r) inversion perspective

DEFAULT_ALPHA = 0.0001
DEFAULT_DMAX = 140.0
DEFAULT_NFUNC = 10
delete_data(data_id)[source]

delete the data association with prview

estimate_file_inversion(alpha, nfunc, d_max, data, path=None, q_min=None, q_max=None, bck=False, height=0, width=0)[source]

Estimate parameters for inversion

estimate_plot_inversion(alpha, nfunc, d_max, q_min=None, q_max=None, bck=False, height=0, width=0)[source]

Estimate parameters from plotted data

get_context_menu(plotpanel=None)[source]

Get the context menu items available for P(r)

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]

Returns the current data

get_npts()[source]

Returns the number of points in the I(q) data

get_panels(parent)[source]

Create and return a list of panel objects

help(evt)[source]

Show a general help dialog.

TODO:replace the text with a nice image
load(data)[source]

Load data. This will eventually be replaced by our standard DataLoader class.

load_abs(path)[source]

Load an IGOR .ABS reduced file

Parameters:path – file path
Returns:x, y, err vectors
load_columns(path='sphere_60_q0_2.txt')[source]

Load 2- or 3- column ascii

perform_estimate()[source]

Perform parameter estimation

perform_estimateNT()[source]

Perform parameter estimation

perform_inversion()[source]

Perform inversion

post_init()[source]

Post initialization call back to close the loose ends [Somehow openGL needs this call]

pr_theory(r, R)[source]

Return P(r) of a sphere for a given R For test purposes

save_data(filepath, prstate=None)[source]

Save data in provided state object.

TODO:

move the state code away from inversion_panel and move it here. Then remove the “prstate” input and make this method private.

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

receive a list of data to compute pr

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

Call-back method for the inversion state reader. This method is called when a .prv file is loaded.

Parameters:
  • state – InversionState object
  • datainfo – Data1D object [optional]
setup_file_inversion(alpha, nfunc, d_max, data, path=None, q_min=None, q_max=None, bck=False, height=0, width=0)[source]

Set up inversion

setup_plot_inversion(alpha, nfunc, d_max, q_min=None, q_max=None, bck=False, height=0, width=0)[source]

Set up inversion from plotted data

show_data(path=None, data=None, reset=False)[source]

Show data read from a file

Parameters:
  • path – file path
  • reset – if True all other plottables will be cleared
show_iq(out, pr, q=None)[source]

Display computed I(q)

show_pr(out, pr, cov=None)[source]
show_shpere(x, radius=70.0, x_range=70.0)[source]
start_thread()[source]

Start a calculation thread

sas.sasgui.perspectives.pr.pr_thread module

class sas.sasgui.perspectives.pr.pr_thread.CalcPr(pr, nfunc=5, error_func=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]

Bases: sas.sascalc.data_util.calcthread.CalcThread

Compute P(r)

compute()[source]

Perform P(r) inversion

class sas.sasgui.perspectives.pr.pr_thread.EstimateNT(pr, nfunc=5, error_func=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]

Bases: sas.sascalc.data_util.calcthread.CalcThread

compute()[source]

Calculates the estimate

isquit()[source]
class sas.sasgui.perspectives.pr.pr_thread.EstimatePr(pr, nfunc=5, error_func=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]

Bases: sas.sascalc.data_util.calcthread.CalcThread

Estimate P(r)

compute()[source]

Calculates the estimate

sas.sasgui.perspectives.pr.pr_widgets module

Text controls for input/output of the main PrView panel

class sas.sasgui.perspectives.pr.pr_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.pr.pr_widgets.DataFileTextCtrl(*args, **kwds)[source]

Bases: sas.sasgui.perspectives.pr.pr_widgets.OutputTextCtrl

Text control used to display only the file name given a full path.

TODO:now that we no longer choose the data file from the panel, it’s no longer necessary to pass around the file path. That code should be refactored away and simplified.
GetValue()[source]

Return the full path

SetValue(value)[source]

Sets the file name given a path

class sas.sasgui.perspectives.pr.pr_widgets.DialogPanel(*args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

class sas.sasgui.perspectives.pr.pr_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.

class sas.sasgui.perspectives.pr.pr_widgets.PrTextCtrl(*args, **kwds)[source]

Bases: wx._controls.TextCtrl

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

sas.sasgui.perspectives.pr.pr_widgets.load_error(error=None)[source]

Pop up an error message.

Parameters:error – details error message to be displayed

Module contents