sas.qtgui.Perspectives.Inversion package

Subpackages

Submodules

sas.qtgui.Perspectives.Inversion.DMaxExplorerWidget 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.qtgui.Perspectives.Inversion.DMaxExplorerWidget.DmaxWindow(pr_state, nfunc, parent=None)[source]

Bases: PyQt5.QtWidgets.QDialog, sas.qtgui.Perspectives.Inversion.UI.DMaxExplorer.Ui_DmaxExplorer

__annotations__ = {}
__doc__ = None
__init__(pr_state, nfunc, parent=None)[source]
__module__ = 'sas.qtgui.Perspectives.Inversion.DMaxExplorerWidget'
closeEvent(event)[source]

Override close event

modelChanged(item)[source]
name = 'Dmax Explorer'
setupMapper()[source]
setupModel()[source]
setupSlots()[source]
setupValidators()[source]

Add validators on relevant line edits

sas.qtgui.Perspectives.Inversion.InversionLogic module

class sas.qtgui.Perspectives.Inversion.InversionLogic.InversionLogic(data=None)[source]

Bases: object

All the data-related logic. This class deals exclusively with Data1D/2D No QStandardModelIndex here.

__dict__ = mappingproxy({'__module__': 'sas.qtgui.Perspectives.Inversion.InversionLogic', '__doc__': '\n    All the data-related logic. This class deals exclusively with Data1D/2D\n    No QStandardModelIndex here.\n    ', '__init__': <function InversionLogic.__init__>, 'data': <property object>, 'isLoadedData': <function InversionLogic.isLoadedData>, 'new1DPlot': <function InversionLogic.new1DPlot>, 'newPRPlot': <function InversionLogic.newPRPlot>, 'add_errors': <function InversionLogic.add_errors>, 'computeDataRange': <function InversionLogic.computeDataRange>, 'computeRangeFromData': <function InversionLogic.computeRangeFromData>, '__dict__': <attribute '__dict__' of 'InversionLogic' objects>, '__weakref__': <attribute '__weakref__' of 'InversionLogic' objects>, '__annotations__': {}})
__doc__ = '\n    All the data-related logic. This class deals exclusively with Data1D/2D\n    No QStandardModelIndex here.\n    '
__init__(data=None)[source]
__module__ = 'sas.qtgui.Perspectives.Inversion.InversionLogic'
__weakref__

list of weak references to the object (if defined)

add_errors(sigma=0.05)[source]

Adds errors to data set is they are not available. Uses \(\Delta y = \sigma | y |\).

computeDataRange()[source]

Wrapper for calculating the data range based on local dataset

computeRangeFromData(data)[source]

Compute the minimum and the maximum range of the data return the npts contains in data

property data
isLoadedData()[source]

accessor

new1DPlot(out, pr, q=None)[source]

Create a new 1D data instance based on fitting results

newPRPlot(out, pr, cov=None)[source]

sas.qtgui.Perspectives.Inversion.InversionPerspective module

class sas.qtgui.Perspectives.Inversion.InversionPerspective.InversionWindow(parent=None, data=None)[source]

Bases: PyQt5.QtWidgets.QDialog, sas.qtgui.Perspectives.Inversion.UI.TabbedInversionUI.Ui_PrInversion

The main window for the P(r) Inversion perspective.

__annotations__ = {}
__doc__ = '\n    The main window for the P(r) Inversion perspective.\n    '
__init__(parent=None, data=None)[source]
__module__ = 'sas.qtgui.Perspectives.Inversion.InversionPerspective'
_calculateCompleted(out, cov, pr, elapsed)[source]

Send a signal to the main thread for model update

_calculateUpdate(output_tuple)[source]

Method called with the results when the inversion is done

Parameters
  • out – output coefficient for the base functions

  • cov – covariance matrix

  • pr – Invertor instance

  • elapsed – time spent computing

_estimateCompleted(alpha, message, elapsed)[source]

Send a signal to the main thread for model update

_estimateDynamicCompleted(alpha, message, elapsed)[source]

Send a signal to the main thread for model update

_estimateDynamicNTCompleted(nterms, alpha, message, elapsed)[source]

Send a signal to the main thread for model update

_estimateDynamicNTUpdate(output_tuple)[source]

Parameter estimation completed, display the results to the user

Parameters
  • alpha – estimated best alpha

  • nterms – estimated number of terms

  • elapsed – computation time

_estimateDynamicUpdate(output_tuple)[source]

Parameter estimation completed, display the results to the user

Parameters
  • alpha – estimated best alpha

  • elapsed – computation time

_estimateNTCompleted(nterms, alpha, message, elapsed)[source]

Send a signal to the main thread for model update

_estimateNTUpdate(output_tuple)[source]

Parameter estimation completed, display the results to the user

Parameters
  • alpha – estimated best alpha

  • nterms – estimated number of terms

  • elapsed – computation time

_estimateUpdate(output_tuple)[source]

Parameter estimation completed, display the results to the user

Parameters
  • alpha – estimated best alpha

  • elapsed – computation time

_threadError(error)[source]

Call-back method for calculation errors

acceptAlpha()[source]

Send estimated alpha to input

acceptNoTerms()[source]

Send estimated no of terms to input

allowBatch()[source]
allowSwap()[source]

Tell the caller we don’t accept swapping data

calculateSignal

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

check_q_high(q_value=None)[source]

Validate the value of high q sent by the slider

check_q_low(q_value=None)[source]

Validate the low q value

closeBatchResults()[source]
closeDMax()[source]
closeEvent(event)[source]

Overwrite QDialog close method to allow for custom widget close

communicator()[source]
currentTabDataId()[source]

Returns the data ID of the current tab

displayChange(data_index=0)[source]

Switch to another item in the data list

enableButtons()[source]

Enable buttons when data is present, else disable them

estimateDynamicNTSignal

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

estimateDynamicSignal

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

estimateNTSignal

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

estimateSignal

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

ext = 'pr'
getNFunc()[source]

Get the n_func value from the GUI object

getPage()[source]

serializes full state of this fit page

getState()[source]

Collects all active params into a dictionary of {name: value} :return: {name: value}

help()[source]

Open the P(r) Inversion help browser

isClosable()[source]

Allow outsiders close this widget

isSerializable()[source]

Tell the caller that this perspective writes its state

model_changed()[source]

Update the values when user makes changes

name = 'Inversion'
openExplorerWindow()[source]

Open the Explorer window to see correlations between params and results

performEstimate()[source]

Perform parameter estimation

performEstimateDynamic()[source]

Perform parameter estimation

performEstimateDynamicNT()[source]

Perform parameter estimation

performEstimateNT()[source]

Perform parameter estimation

populateDataComboBox(name, data_ref)[source]

Append a new name to the data combobox :param name: data name :param data_ref: QStandardItem reference for data set to be added

removeData(data_list=None)[source]

Remove the existing data reference from the P(r) Persepective

serializeAll()[source]

Serialize the inversion state so data can be saved Inversion is not batch-ready so this will only effect a single page :return: {data-id: {self.name: {inversion-state}}}

serializeCurrentPage()[source]
setClosable(value=True)[source]

Allow outsiders close this widget

setCurrentData(data_ref)[source]

Get the data by reference and display as necessary

setData(data_item=None, is_batch=False)[source]

Assign new data set(s) to the P(r) perspective Obtain a QStandardItem object and parse it to get Data1D/2D Pass it over to the calculator

set_background(value)[source]

Connect the use controls to their appropriate methods

setupMapper()[source]
setupModel()[source]

Update boxes with initial values

setupValidators()[source]

Apply validators to editable line edits

setupWindow()[source]

Initialize base window state on init

showBatchOutput()[source]

Display the batch output in tabular form :param output_data: Dictionary mapping name -> P(r) instance

startNextBatchItem()[source]
startThread()[source]

Start a calculation thread

startThreadAll()[source]
stopCalcThread()[source]

Stops a thread if it exists and is running

stopCalculation()[source]

Stop all threads, return to the base state and update GUI

stopEstimateNTThread()[source]
stopEstimationThread()[source]

Stop the estimation thread if it exists and is running

toggleBgd()[source]

Toggle the background between manual and estimated

updateCalculator()[source]

Update all p(r) params

updateDataList(dataRef)[source]

Save the current data state of the window into self._data_list

updateDynamicGuiValues()[source]
updateFromParameters(params)[source]
updateGuiValues()[source]
sas.qtgui.Perspectives.Inversion.InversionPerspective.is_float(value)[source]

Converts text input values to floats. Empty strings throw ValueError

sas.qtgui.Perspectives.Inversion.InversionUtils module

sas.qtgui.Perspectives.Inversion.Thread module

class sas.qtgui.Perspectives.Inversion.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)

__annotations__ = {}
__doc__ = '\n    Compute P(r)\n    '
__init__(pr, nfunc=5, error_func=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]
__module__ = 'sas.qtgui.Perspectives.Inversion.Thread'
compute()[source]

Perform P(r) inversion

class sas.qtgui.Perspectives.Inversion.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

__annotations__ = {}
__doc__ = '\n    '
__init__(pr, nfunc=5, error_func=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]

Prepare the calculator

__module__ = 'sas.qtgui.Perspectives.Inversion.Thread'
compute()[source]

Calculates the estimate

isquit()[source]
class sas.qtgui.Perspectives.Inversion.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)

__annotations__ = {}
__doc__ = '\n    Estimate P(r)\n    '
__init__(pr, nfunc=5, error_func=None, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01)[source]

Prepare the calculator

__module__ = 'sas.qtgui.Perspectives.Inversion.Thread'
compute()[source]

Calculates the estimate

Module contents