sas.perspectives.pr package

Submodules

sas.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.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]

Class that holds the content of the form

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

Not implemented

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

Bases: sas.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.
class sas.perspectives.pr.explore_dialog.Results[source]

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

sas.perspectives.pr.inversion_panel module

class sas.perspectives.pr.inversion_panel.HelpDialog(parent, id)[source]

Bases: wx._windows.Dialog

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

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

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

Get the current state

: return: state object

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.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.perspectives.pr.inversion_state module

Handling of P(r) inversion states

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

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

class sas.perspectives.pr.pr.Plugin(standalone=True)[source]

Bases: sas.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_plot_inversion(alpha, nfunc, d_max, q_min=None, q_max=None, bck=False, height=0, width=0)[source]
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_estimateNT()[source]
perform_inversion()[source]
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]
setup_plot_inversion(alpha, nfunc, d_max, q_min=None, q_max=None, bck=False, height=0, width=0)[source]
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]
show_pr(out, pr, cov=None)[source]
show_shpere(x, radius=70.0, x_range=70.0)[source]
start_thread()[source]

sas.perspectives.pr.pr_thread module

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

Bases: sas.data_util.calcthread.CalcThread

Compute P(r)

compute()[source]

Perform P(r) inversion

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

Bases: sas.data_util.calcthread.CalcThread

compute()[source]

Calculates the estimate

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

Bases: sas.data_util.calcthread.CalcThread

Estimate P(r)

compute()[source]

Calculates the estimate

sas.perspectives.pr.pr_widgets module

Text controls for input/output of the main PrView panel

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

Bases: sas.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.perspectives.pr.pr_widgets.DialogPanel(*args, **kwds)[source]

Bases: wx.lib.scrolledpanel.ScrolledPanel

class sas.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.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.perspectives.pr.pr_widgets.load_error(error=None)[source]

Pop up an error message.

Parameters:error – details error message to be displayed

Module contents