sas.qtgui.Perspectives.SizeDistribution package¶
Subpackages¶
Submodules¶
sas.qtgui.Perspectives.SizeDistribution.SizeDistributionLogic module¶
- class sas.qtgui.Perspectives.SizeDistribution.SizeDistributionLogic.SizeDistributionLogic(data=None)¶
Bases:
objectAll the data-related logic. This class deals exclusively with Data1D/2D No QStandardModelIndex here.
- computeBackground(constant: float, scale: float, power: float)¶
- computeDataRange()¶
Compute the minimum and the maximum range of the data
- computeTrustRange(qmin: float, qmax: float)¶
Compute the trusted range (green area in Irena)
- property data¶
- fitBackground(power: float | None, qmin: float, qmax: float) list[float]¶
Estimate the background power law, scale * q^(power) :param power: if a float is given, the power is fixed; if None, the power is fitted :return: fit parameters; [scale] if power is fixed, or [scale, power] if power is fitted
- isLoadedData()¶
accessor
- newDataPlot()¶
Create a new 1D data instance
- newSizeDistrPlot(result: MaxEntResult, qmin: float, qmax: float)¶
Create a new 1D data instance based on fitting results
- setDataProperties()¶
Analyze data and set up some properties important for the Presentation layer
sas.qtgui.Perspectives.SizeDistribution.SizeDistributionPerspective module¶
- class sas.qtgui.Perspectives.SizeDistribution.SizeDistributionPerspective.SizeDistributionWindow(parent=None)¶
Bases:
QDialog,Ui_SizeDistribution,PerspectiveThe main window for the Size Distribution perspective.
- allowBatch()¶
Can this perspective handle batch processing, default no
- allowSwap()¶
Tell the caller we don’t accept swapping data
- clearStatistics()¶
Clear the output box
- closeEvent(event)¶
Overwrite QDialog close method to allow for custom widget close
- communicator()¶
- data_plot_signal¶
- enableButtons()¶
Enable buttons when data is present, else disable them
- eventFilter(widget: QObject, event: QEvent) bool¶
Catch enter key presses and update data plot
- ext = 'ps'¶
- fitComplete(result: MaxEntResult) None¶
Receive and display fitting results “result” is a tuple of actual result list and the fit time in seconds
- fittingCompleted(result: MaxEntResult | None) None¶
Send the finish message from calculate threads to main thread
- fittingError(etype, value, traceback)¶
Handle error in the calculation thread
- fittingFinishedSignal¶
- getBackgroundParams()¶
Collect background parameters from the GUI state
- getFlatBackgroundRange()¶
Collect background range from the GUI state
- getMaxEntParams()¶
Collect Max Ent parameters from the GUI state
- getPage()¶
serializes full state of this fit page
- getPowerLawBackgroundRange()¶
Collect power law range from the GUI state
- getState()¶
Collects all active params into a dictionary of {name: value} :return: {name: value}
- getWeightType()¶
Return the weight type based on the checked radio button
- help()¶
Open the Size Distribution help
- isClosable()¶
Allow outsiders close this widget
- isSerializable()¶
Tell the caller that this perspective writes its state
- name = 'SizeDistribution'¶
- onFitFlatBackground()¶
Fit flat background and update plot
- onFitPowerLaw()¶
Fit background power law and update plot
- onFullFit()¶
Perform a full fit of the size distribution
- onLowQStateChanged(state: int)¶
Slot for state change of the subtract power law checkbox
- onQuickFit()¶
Perform a quick fit of the size distribution
- onRangeReset()¶
Callback for resetting qmin/qmax
- plotData()¶
Plot data, background and background subtracted data
- removeData(data_list=None)¶
Remove the existing data reference from the Size Distribution Perspective
- resetWindow()¶
Reset the state of input widgets and data structures
- serializeAll()¶
Serialize the size distribution state so data can be saved Size distribution is not batch-ready so this will only effect a single page :return: {data-id: {self.name: {inversion-state}}}
- serializeCurrentPage()¶
Serialize and return a dictionary of {data_id: sizedistr-state} Return empty dictionary if no data :return: {data-id: {self.name: {invariant - state}}}
- setClosable(value=True)¶
Allow outsiders close this widget
- setData(data_item=None, is_batch=False)¶
Obtain a QStandardItem object and parse it to get Data1D/2D Pass it over to the calculator
- setupMapper()¶
- setupModel()¶
Update boxes with initial values
- setupSlots()¶
Connect the use controls to their appropriate methods
- setupValidators()¶
Apply validators to editable line edits
- setupWindow()¶
Initialize base window state on init
- staticMetaObject = PySide6.QtCore.QMetaObject("SizeDistributionWindow" inherits "QDialog": Methods: #41 type=Signal, signature=fittingFinishedSignal(PyObject), parameters=PyObject #42 type=Signal, signature=data_plot_signal() )¶
- property title: str¶
Window title
- updateBackground()¶
Update the background data
- updateFromParameters(params)¶
Called by Open Project, Open Analysis, and removeData :param params: {param_name: value} -> Default values used if not valid :return: None
- updateQRange(q_range_min, q_range_max)¶
Update the local model based on calculated values
- updateStatistics(result)¶
Update the output box with statistics
sas.qtgui.Perspectives.SizeDistribution.SizeDistributionThread module¶
- class sas.qtgui.Perspectives.SizeDistribution.SizeDistributionThread.SizeDistributionThread(data: Data1D, background: Data1D, params: MaxEntParameters, completefn=None, updatefn=None, yieldtime=0.01, worktime=0.01, exception_handler=None)¶
Bases:
CalcThreadThread performing the fit
- compute(*args, **kwargs)¶
Perform a work unit. The subclass will provide details of the arguments.
sas.qtgui.Perspectives.SizeDistribution.SizeDistributionUtils module¶
- class sas.qtgui.Perspectives.SizeDistribution.SizeDistributionUtils.MaxEntParameters(qmin: float = 0.0, qmax: float = 0.1, dmin: float = 10.0, dmax: float = 1000.0, num_bins: int = 100, log_binning: bool = True, model: str = 'ellipsoid', aspect_ratio: float = 1.0, contrast: float = 1.0, sky_background: float = 1e-06, max_iterations: int = 100, use_weights: bool = True, weight_type: sas.qtgui.Perspectives.SizeDistribution.SizeDistributionUtils.WeightType = <WeightType.DI: 'dI'>, weight_factor: float = 1.0, weight_percent: float = 1.0, full_fit: bool = True)¶
Bases:
object- aspect_ratio: float = 1.0¶
- contrast: float = 1.0¶
- dmax: float = 1000.0¶
- dmin: float = 10.0¶
- full_fit: bool = True¶
- log_binning: bool = True¶
- max_iterations: int = 100¶
- model: str = 'ellipsoid'¶
- num_bins: int = 100¶
- qmax: float = 0.1¶
- qmin: float = 0.0¶
- sky_background: float = 1e-06¶
- use_weights: bool = True¶
- weight_factor: float = 1.0¶
- weight_percent: float = 1.0¶
- weight_type: WeightType = 'dI'¶
- class sas.qtgui.Perspectives.SizeDistribution.SizeDistributionUtils.MaxEntResult(convergences: list[bool], num_iters: list[int], chisq: float, bins: list[float], bin_mag: list[float], bin_diff: list[float], bin_err: list[float], data_max_ent: sasdata.dataloader.data_info.Data1D, statistics: dict)¶
Bases:
object- bin_diff: list[float]¶
- bin_err: list[float]¶
- bin_mag: list[float]¶
- bins: list[float]¶
- chisq: float¶
- convergences: list[bool]¶
- num_iters: list[int]¶
- statistics: dict¶