sas.qtgui.Perspectives.Corfunc package¶
Subpackages¶
- sas.qtgui.Perspectives.Corfunc.UI package
- Submodules
- sas.qtgui.Perspectives.Corfunc.UI.CorfuncPanel module
Ui_CorfuncDialogUi_CorfuncDialog.__annotate_func__Ui_CorfuncDialog.__annotations_cache__Ui_CorfuncDialog.__dict__Ui_CorfuncDialog.__doc__Ui_CorfuncDialog.__firstlineno__Ui_CorfuncDialog.__module__Ui_CorfuncDialog.__static_attributes__Ui_CorfuncDialog.__weakref__Ui_CorfuncDialog.retranslateUi()Ui_CorfuncDialog.setupUi()
- sas.qtgui.Perspectives.Corfunc.UI.SaveExtrapolated module
Ui_SaveExtrapolatedPanelUi_SaveExtrapolatedPanel.__annotate_func__Ui_SaveExtrapolatedPanel.__annotations_cache__Ui_SaveExtrapolatedPanel.__dict__Ui_SaveExtrapolatedPanel.__doc__Ui_SaveExtrapolatedPanel.__firstlineno__Ui_SaveExtrapolatedPanel.__module__Ui_SaveExtrapolatedPanel.__static_attributes__Ui_SaveExtrapolatedPanel.__weakref__Ui_SaveExtrapolatedPanel.retranslateUi()Ui_SaveExtrapolatedPanel.setupUi()
- Module contents
Submodules¶
sas.qtgui.Perspectives.Corfunc.CorfuncCanvas module¶
- class sas.qtgui.Perspectives.Corfunc.CorfuncCanvas.CorfuncCanvas(corfunc_window: CorfuncWindow, width=5, height=4, dpi=100)¶
Bases:
FigureCanvasQTAggBase class for the canvases in corfunc
- __annotate_func__ = None¶
- __annotations_cache__ = {'_data': 'list[Data1D] | None'}¶
- __doc__ = 'Base class for the canvases in corfunc'¶
- __firstlineno__ = 23¶
- __init__(corfunc_window: CorfuncWindow, width=5, height=4, dpi=100)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.CorfuncCanvas'¶
- __static_attributes__ = ('_data', 'axes', 'corfunc_windows', 'fig')¶
- clear()¶
Remove data from plots
- abstractmethod draw_data()¶
- parent()¶
Parent function is needed by the toolbar, and needs to return the appropriate figure canvas object, which is self
- staticMetaObject = PySide6.QtCore.QMetaObject("CorfuncCanvas" inherits "FigureCanvasQTAgg": )¶
- class sas.qtgui.Perspectives.Corfunc.CorfuncCanvas.CorfuncCanvasMeta¶
Bases:
ObjectType,ABCMetaMetaclass for both ABC and matplotlib figure
This is needed to enable the mixin of CorfuncCanvas
- __annotate_func__ = None¶
- __annotations_cache__ = {}¶
- __doc__ = 'Metaclass for both ABC and matplotlib figure\n\nThis is needed to enable the mixin of CorfuncCanvas\n'¶
- __firstlineno__ = 16¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.CorfuncCanvas'¶
- __static_attributes__ = ()¶
sas.qtgui.Perspectives.Corfunc.CorfuncPerspective module¶
- class sas.qtgui.Perspectives.Corfunc.CorfuncPerspective.CorfuncWindow(parent=None)¶
Bases:
QDialog,Ui_CorfuncDialog,PerspectiveDisplays the correlation function analysis of sas data.
- __annotate_func__ = None¶
- __annotations_cache__ = {'_calculator': 'CorfuncCalculator | None', '_long_period_method': 'LongPeriodMethod | None', '_model_item': 'QStandardItem | None', '_tangent_method': 'TangentMethod | None', 'data': 'Data1D | None', 'extrap': 'Data1D | None'}¶
- __doc__ = 'Displays the correlation function analysis of sas data.'¶
- __firstlineno__ = 43¶
- __init__(parent=None)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.CorfuncPerspective'¶
- __static_attributes__ = ('_allow_close', '_calculator', '_extraction_plot', '_idf_plot', '_long_period_method', '_model_item', '_path', '_q_space_plot', '_real_space_plot', '_running', '_tangent_method', 'communicate', 'data', 'extrap', 'has_data', 'mapper', 'model', 'parent', 'slider')¶
- _run()¶
- allowBatch()¶
We cannot perform corfunc analysis in batch at this time.
- allowSwap()¶
We cannot swap data with corfunc analysis at this time.
- closeEvent(event)¶
Overwrite QDialog close method to allow for custom widget close
- ext = 'crf'¶
- property extraction_figure¶
- property extrapolation_paramameters: ExtrapolationParameters | None¶
- getPage()¶
Serializes full state of this corfunc page Called by Save Analysis :return: {corfunc-state}
- getReport() ReportData | None¶
A string containing the HTML to be shown in the report
- getState()¶
Collects all active params into a dictionary of {name: value} :return: {name: value}
- property idf_figure¶
- isSerializable()¶
Tell the caller that this perspective writes its state
- model_changed(_)¶
Actions to perform when the data is updated
- name = 'Corfunc'¶
- notify_extrapolation_text_box_validity(params)¶
Set the colour of the text boxes to red if they have bad parameter definitions
- on_extrapolation_slider_changed(state: ExtrapolationParameters)¶
Slider state changed
- on_extrapolation_slider_changing(state: ExtrapolationInteractionState)¶
Slider is being moved about
- on_extrapolation_text_changed_1(text)¶
Text in LowerQMax changed
- on_extrapolation_text_changed_2(text)¶
Text in UpperQMin changed
- on_extrapolation_text_changed_3(text)¶
Text in UpperQMax changed
- on_save_extrapolation()¶
- on_save_transformed()¶
Save corfunc state into a file
- property q_space_figure¶
- property real_space_figure¶
- removeData(data_list=None)¶
Remove the existing data reference from the Invariant Persepective
- serializeAll()¶
Serialize the corfunc state so data can be saved Corfunc is not batch-ready so this will only effect a single page :return: {data-id: {self.name: {corfunc-state}}}
- serializeCurrentPage()¶
Serialize and return a dictionary of {data_id: corfunc-state} Return empty dictionary if no data :return: {data-id: {self.name: {corfunc-state}}}
- setClosable(value=True)¶
Allow outsiders close this widget
- setData(data_item: list[QStandardItem], is_batch=False)¶
Obtain a QStandardItem object and dissect it to get Data1D/2D Pass it over to the calculator
- set_background_warning()¶
- set_long_period_method(value: LongPeriodMethod | None) Callable[[bool], None]¶
Function to set the long period method
- set_tangent_method(value: TangentMethod | None) Callable[[bool], None]¶
Function to set the tangent method
- set_text_enable(state: bool)¶
- setup_mapper()¶
Creating mapping between model and gui elements.
- setup_model()¶
Populate the model with default data.
- setup_slots()¶
Connect the buttons to their appropriate slots.
- showHelp()¶
Opens a webpage with help on the perspective
- staticMetaObject = PySide6.QtCore.QMetaObject("CorfuncWindow" inherits "QDialog": Methods: #41 type=Signal, signature=trigger(PyObject), parameters=PyObject )¶
- property supports_reports: bool¶
Does this perspective have a report functionality (currently used by menus and toolbar)
- property title¶
Window title
- trigger¶
- updateFromParameters(params)¶
Called by Open Project, Open Analysis, and removeData :param params: {param_name: value} -> Default values used if not valid :return: None
sas.qtgui.Perspectives.Corfunc.CorfuncSlider module¶
- class sas.qtgui.Perspectives.Corfunc.CorfuncSlider.CorfuncSlider(parameters: ExtrapolationParameters = (1, 2, 4, 8, 16), enabled: bool = False, *args, **kwargs)¶
Bases:
QWidgetSlider that allows the selection of the different Q-ranges involved in interpolation, and that provides some visual cues to how it works.
- __annotate_func__ = None¶
- __annotations_cache__ = {'_drag_id': 'int | None', '_hover_id': 'int | None', '_movement_line_position': 'int | None'}¶
- __doc__ = 'Slider that allows the selection of the different Q-ranges involved in interpolation,\nand that provides some visual cues to how it works.'¶
- __firstlineno__ = 11¶
- __init__(parameters: ExtrapolationParameters = (1, 2, 4, 8, 16), enabled: bool = False, *args, **kwargs)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.CorfuncSlider'¶
- __static_attributes__ = ('_drag_id', '_hover_id', '_hovering', '_max', '_min', '_movement_line_position', '_point_1', '_point_2', '_point_3', 'data_color', 'data_hover_color', 'disabled_line_color', 'disabled_non_data_color', 'disabled_text_color', 'guinier_color', 'guinier_hover_color', 'hover_colour', 'left_pad', 'line_drag_color', 'line_width', 'porod_color', 'porod_hover_color', 'right_pad', 'text_color', 'vertical_size')¶
- property _dragging: bool¶
Are we dragging?
- _mouse_inside(x, y)¶
Is the mouse inside the window
- _nearest_line(x: float) int¶
Get id of the nearest line
- _paint_label(position: float, text: str, centre_justify=True)¶
- _sanitise_new_position(line_id: int, new_position: int, delta=1) int¶
Returns a revised position for a line position that prevents the bounds being exceeded
- property data_label_centre: float¶
Centre of the interpolation region
- property data_width: float¶
Length of range spanned by the data
- enterEvent(a0: QEvent) None¶
- property extrapolation_parameters¶
- static find_parameter_problems(params: ExtrapolationParameters) str | None¶
Check an extratpolation prarameters object for consistency
- Parameters:
params – An extrapolation parameters object describing a desired state
- Returns:
A description of the problem if it exists, otherwise None
- property guinier_label_position: float¶
Position to put the text for the guinier region
- property input_width: float¶
Width of the part of the widget representing input data
- property interaction_state: ExtrapolationInteractionState¶
The current state of the slider, including temporary data about how it is being moved
- inverse_transform(px_value: float) float¶
Convert a value from draw coordinates to input value
- leaveEvent(a0: QEvent) None¶
- property line_paint_positions: tuple[float, float, float]¶
x coordinate of the painted lines
- mouseMoveEvent(event: QMouseEvent)¶
- mousePressEvent(event: QMouseEvent)¶
- mouseReleaseEvent(event: QMouseEvent)¶
- paintEvent(e)¶
- property porod_label_centre: float¶
Centre of the Porod region
- property scale: float¶
Scale factor from input to draw scale e.g. A^-1 -> px
- set_boundaries(q_point_1: float, q_point_2: float, q_point_3: float)¶
Set the boundaries between the sections
- set_boundary(index: int, q: float)¶
Set the value of the boundary points by (0-)index
- sizeHint()¶
- staticMetaObject = PySide6.QtCore.QMetaObject("CorfuncSlider" inherits "QWidget": Methods: #33 type=Signal, signature=valueEdited(PyObject), parameters=PyObject #34 type=Signal, signature=valueEditing(PyObject), parameters=PyObject )¶
- transform(q_value: float) float¶
Convert a value from input to draw coordinates
- property transition_label_centre: float¶
Centre of the data-porod transition
- valueEdited¶
- valueEditing¶
- sas.qtgui.Perspectives.Corfunc.CorfuncSlider.main()¶
Show a demo of the slider
- sas.qtgui.Perspectives.Corfunc.CorfuncSlider.mix_colours(a: QColor, b: QColor, k: float) QColor¶
sas.qtgui.Perspectives.Corfunc.ExtractionCanvas module¶
- class sas.qtgui.Perspectives.Corfunc.ExtractionCanvas.ExtractionCanvas(parent, width=5, height=4, dpi=100)¶
Bases:
CorfuncCanvasCanvas for displaying real space representation
- __annotate_func__ = None¶
- __annotations_cache__ = {'_data': 'list[Data1D] | None', '_supplementary': 'SupplementaryParameters | None'}¶
- __doc__ = 'Canvas for displaying real space representation'¶
- __firstlineno__ = 6¶
- __init__(parent, width=5, height=4, dpi=100)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.ExtractionCanvas'¶
- __static_attributes__ = ('_supplementary', 'axes')¶
- draw_data()¶
This function draws the real space data onto the plot
The 1d correlation function in self.data, the 3d correlation function in self.data3, and the interface distribution function in self.data_idf are all draw in on the plot in linear cooredinates.
- staticMetaObject = PySide6.QtCore.QMetaObject("ExtractionCanvas" inherits "CorfuncCanvas": )¶
- property supplementary¶
sas.qtgui.Perspectives.Corfunc.IDFCanvas module¶
- class sas.qtgui.Perspectives.Corfunc.IDFCanvas.IDFCanvas(corfunc_window: CorfuncWindow, width=5, height=4, dpi=100)¶
Bases:
CorfuncCanvasCanvas for displaying real space representation
- __annotate_func__ = None¶
- __annotations_cache__ = {'_data': 'list[Data1D] | None'}¶
- __doc__ = 'Canvas for displaying real space representation'¶
- __firstlineno__ = 5¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.IDFCanvas'¶
- __static_attributes__ = ('axes',)¶
- draw_data()¶
This function draws the real space data onto the plot
The 1d correlation function in self.data, the 3d correlation function in self.data3, and the interface distribution function in self.data_idf are all draw in on the plot in linear cooredinates.
- staticMetaObject = PySide6.QtCore.QMetaObject("IDFCanvas" inherits "CorfuncCanvas": )¶
sas.qtgui.Perspectives.Corfunc.QSpaceCanvas module¶
- class sas.qtgui.Perspectives.Corfunc.QSpaceCanvas.QSpaceCanvas(corfunc_window: CorfuncWindow, width=5, height=4, dpi=100)¶
Bases:
CorfuncCanvasCanvas for displaying input data and extrapolation parameters
- __annotate_func__ = None¶
- __annotations_cache__ = {'_data': 'list[Data1D] | None', 'extrap': 'Data1D | None', 'ghost_line': 'Line2D | None', 'line1': 'Line2D | None', 'line2': 'Line2D | None', 'line3': 'Line2D | None'}¶
- __doc__ = 'Canvas for displaying input data and extrapolation parameters'¶
- __firstlineno__ = 16¶
- __init__(corfunc_window: CorfuncWindow, width=5, height=4, dpi=100)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.QSpaceCanvas'¶
- __static_attributes__ = ('axes', 'draggable', 'extrap', 'ghost_line', 'legend', 'line1', 'line2', 'line3')¶
- draw_data()¶
Draw the Q space data in the plot window
This draws the q space data in self.data, as well as the bounds set by self.qmin, self.qmax1, and self.qmax2. It will also plot the extrpolation in self.extrap, if it exists.
- property interactive_lines¶
- staticMetaObject = PySide6.QtCore.QMetaObject("QSpaceCanvas" inherits "CorfuncCanvas": )¶
- update_lines(parameters: ExtrapolationInteractionState)¶
Update the plots vertical lines based on the position of the slider and/or text box values
sas.qtgui.Perspectives.Corfunc.RealSpaceCanvas module¶
- class sas.qtgui.Perspectives.Corfunc.RealSpaceCanvas.RealSpaceCanvas(parent, width=5, height=4, dpi=100)¶
Bases:
CorfuncCanvasCanvas for displaying real space representation
- __annotate_func__ = None¶
- __annotations_cache__ = {'_data': 'list[Data1D] | None', '_supplementary': 'SupplementaryParameters | None'}¶
- __doc__ = 'Canvas for displaying real space representation'¶
- __firstlineno__ = 6¶
- __init__(parent, width=5, height=4, dpi=100)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.RealSpaceCanvas'¶
- __static_attributes__ = ('_supplementary', 'axes', 'legend')¶
- draw_data()¶
This function draws the real space data onto the plot
The 1d correlation function in self.data, the 3d correlation function in self.data3, and the interface distribution function in self.data_idf are all draw in on the plot in linear cooredinates.
- staticMetaObject = PySide6.QtCore.QMetaObject("RealSpaceCanvas" inherits "CorfuncCanvas": )¶
sas.qtgui.Perspectives.Corfunc.SaveExtrapolatedPopup module¶
- class sas.qtgui.Perspectives.Corfunc.SaveExtrapolatedPopup.SaveExtrapolatedPopup(input_qs: ndarray, interpolation_function: Callable[[ndarray], ndarray], parent=None)¶
Bases:
QDialog,Ui_SaveExtrapolatedPanelDialogue window for saving extrapolated data
- __annotate_func__ = None¶
- __annotations_cache__ = {}¶
- __doc__ = 'Dialogue window for saving extrapolated data'¶
- __firstlineno__ = 15¶
- __init__(input_qs: ndarray, interpolation_function: Callable[[ndarray], ndarray], parent=None)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.SaveExtrapolatedPopup'¶
- __static_attributes__ = ('input_qs', 'interpolation_function', 'parent')¶
- _do_save(q: ndarray, intensity: ndarray)¶
Save data to a file
- _input_validation()¶
Check input is valid, notify user if not
- _notify_user_error(message: str)¶
Message box for showing error
- on_cancel()¶
Cancel button pressed
- on_ok()¶
OK button pressed
- staticMetaObject = PySide6.QtCore.QMetaObject("SaveExtrapolatedPopup" inherits "QDialog": )¶
- exception sas.qtgui.Perspectives.Corfunc.SaveExtrapolatedPopup.UserInputInvalid(message, *args)¶
Bases:
Exception- __annotate_func__ = None¶
- __annotations_cache__ = {}¶
- __doc__ = None¶
- __firstlineno__ = 9¶
- __init__(message, *args)¶
- __module__ = 'sas.qtgui.Perspectives.Corfunc.SaveExtrapolatedPopup'¶
- __static_attributes__ = ('message',)¶
- __weakref__¶
list of weak references to the object
sas.qtgui.Perspectives.Corfunc.util module¶
- sas.qtgui.Perspectives.Corfunc.util.safe_float(x: str)¶
String to float method that returns zero if parsing failed