sas.qtgui.Perspectives.Invariant package

Subpackages

Submodules

sas.qtgui.Perspectives.Invariant.InvariantDetails module

class sas.qtgui.Perspectives.Invariant.InvariantDetails.DetailsDialog(parent)

Bases: QDialog, Ui_Dialog

This class stores some values resulting from invariant calculations. Given the value of total invariant, this class can also determine the percentage of invariants resulting from extrapolation.

checkValues()

Create a warning message to be displayed in panel if problems with values

closeEvent(event)

Re-enables the status button when closed

setModel(model)
showDialog()

Fill the dialog with values of calculated Q, progress bars

staticMetaObject = PySide6.QtCore.QMetaObject("DetailsDialog" inherits "QDialog": )

sas.qtgui.Perspectives.Invariant.InvariantPerspective module

class sas.qtgui.Perspectives.Invariant.InvariantPerspective.InvariantWindow(parent=None)

Bases: QDialog, Ui_tabbedInvariantUI, Perspective

The controller responsible for managing signal slots connections for the gui and providing an interface to the data model.

allowBatch() → bool

Tell the caller that we don’t accept multiple data instances.

allowSwap() → bool

Tell the caller that we can’t swap data.

apply_parameters_from_ui()

Sets extrapolation parameters from the text boxes into the model and slider.

calculate_invariant() → None

Use twisted to thread the calculations away

calculate_thread(extrapolation: str | None) → None

Perform Invariant calculations.

This function runs in a worker thread (deferToThread). It must not update widgets directly — use reactor.callFromThread to schedule GUI updates.

checkVolFrac() → None

Check if volfrac1 is strictly between 0 and 1.

check_extrapolation_values() → None

Check validity of extrapolation text boxes such that: data_q_min < point_1 < point_2 < point_3 < Q_MAXIMUM and point_2 < data_q_max. If invalid, set background color of text box to red.

check_status() → None

Check the status of the input fields and enable the calculate button if: - Data is present, - The selected radio button corresponds to a field with a valid value.

closeEvent(event) → None

Overwrite QDialog close method to allow for custom widget close.

compute_high() → tuple[float | Literal['ERROR'], float | Literal['ERROR'], bool]

Compute high-q extrapolation and return (qstar, qstar_err, success).

compute_low() → tuple[float | Literal['ERROR'], float | Literal['ERROR'], bool]

Compute low-q extrapolation and return (qstar, qstar_err, success).

contrast_volfrac_toggle() → None

Enable editing of the correct fields based on whether Contrast or VolFrac is selected.

correct_extrapolation_values() → None

Correct invalid extrapolation text box values to nearest valid value.

deferredPlot(model: QStandardItemModel, extrapolation: str | None = None) → None

Run the GUI/model update in the main thread

enableStatus() → None

Enable the status button.

enable_calculation(enabled: bool = True, display: str = 'Calculate') → None

Enable or disable the calculation button and display appropriate reason.

Parameters:
  • enabled – enable or disable the calculation button, default is True

  • display – display text for the calculation button, default is “Calculate”

enable_extrapolation_text(state: bool) → None

Enable or disable the text fields in the extrapolation tab

Parameters:

state – enable or disable the text fields

enable_low_q_power_options(state: bool) → None

Show and enable the Fit and Fix options if Power is selected.

ext = 'inv'
property extrapolation_parameters: ExtrapolationParameters | None
format_sig_fig(value: float) → str

Format a float to 7 significant figures as a string.

get_high_q_extrapolation_lower_limit() → float

Get the high Q extrapolation lower limit

Returns:

high Q extrapolation lower limit

get_low_q_extrapolation_upper_limit() → float

Get the low Q extrapolation upper limit

Returns:

low Q extrapolation upper limit

highFitAndFixToggle_ex() → None

Enable editing of power exponent if Fix for high Q is checked.

initialize_variables() → None

Initialize class variables.

isSerializable() → bool

Tell the caller that this perspective writes its state.

lowFitAndFixToggle_ex() → None

Enable editing of power exponent if Fix for low Q is checked.

lowGuinierAndPowerToggle_ex() → None

If Power is selected, Fit and Fix radio buttons are visible.

name = 'Invariant'
onHelp()

Display help when clicking on Help button.

onStatus()

Display Invariant Details panel when clicking on Status button.

on_calculation_failed(reason: Failure) → None

Handle calculation failure.

on_extrapolation_highq_check_changed() → None

Handle the state change of the high Q extrapolation checkbox.

on_extrapolation_lowq_check_changed() → None

Handle the state change of the low Q extrapolation checkbox.

on_extrapolation_slider_changed(state: ExtrapolationParameters) → None

Handle when user changes any of the extrapolation slider values.

on_extrapolation_text_edited() → None

Handle when user finishes editing any of the extrapolation text boxes.

on_extrapolation_text_editing() → None

Handle when user edits any of the extrapolation text boxes.

plot_result(model: QStandardItemModel) → None

Plot result of calculation

removeData(data_list: list | None = None) → None

Remove the existing data reference from the Invariant Perspective.

reset()

Reset the fitting perspective to an empty state.

serializeAll() → dict

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

serializeCurrentPage() → dict

Serialize and return a dictionary of {data_id: invariant-state}. Return empty dictionary if no data. :return: {data-id: {self.name: {invariant-state}}}

serializePage() → dict

Serializes full state of this invariant page. Called by Save Analysis. :return: {invariant-state}

serializeState() → dict

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

setClosable(value: bool = True) → None

Allow outsiders to close this widget.

setData(data_item: QStandardItem = None, is_batch: bool = False) → None

Obtain a QStandardItem object and dissect it to get Data1D/2D. Pass it over to the calculator.

set_high_q_extrapolation_lower_limit(value: float) → None

Set the high Q extrapolation lower limit

Parameters:

value – high Q extrapolation lower limit

set_low_q_extrapolation_upper_limit(value: float) → None

Set the low Q extrapolation upper limit

Parameters:

value – low Q extrapolation upper limit

setupMapper() → None

Set up the mapper.

setupModel() → None

Setup the model for the invariant panel.

setupSlots()

Setup slots for the buttons and checkboxes.

setup_default_enablement() → None

Setup the default enablement of the widgets.

setup_slider() → None

Setup the extrapolation slider.

setup_tooltips() → None

Setup tooltips for the widgets

setup_validators() → None

Set validators for line edits.

staticMetaObject = PySide6.QtCore.QMetaObject("InvariantWindow" inherits "QDialog": )
property title: str

Provides the perspective name.

updateFromGui() → None

Update model when new user inputs.

updateFromParameters(params: dict) → None

Called by Open Project and Open Analysis. :param params: {param_name: value} :return: None

updateGuiFromFile(data: Data1D = None) → None

Update display in GUI and plot.

update_details_widget() → None

On demand update of the details widget.

update_from_model() → None

Update the globals based on the data in the model.

update_model_from_thread(widget_id: int, value: float) → None

Update the model in the main thread.

update_progress_bars() → None

Update progress bars based on Q* values from the model.

sas.qtgui.Perspectives.Invariant.InvariantUtils module

sas.qtgui.Perspectives.Invariant.InvariantUtils.safe_float(x: str)

String to float method that returns zero if parsing failed

Module contents