# sas.qtgui.Perspectives.Corfunc package

## Subpackages

- sas.qtgui.Perspectives.Corfunc.UI package
  - Submodules
  - sas.qtgui.Perspectives.Corfunc.UI.CorfuncPanel module
    - `Ui_CorfuncDialog`
      - `Ui_CorfuncDialog.retranslateUi()`
      - `Ui_CorfuncDialog.setupUi()`
  - sas.qtgui.Perspectives.Corfunc.UI.SaveExtrapolated module
    - `Ui_SaveExtrapolatedPanel`
      - `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: `FigureCanvasQTAgg`

  Base class for the canvases in corfunc

  clear()

    Remove data from plots

  property data: list[Data1D] | None

    The data currently shown by the 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`, `ABCMeta`

  Metaclass for both ABC and matplotlib figure

  This is needed to enable the mixin of CorfuncCanvas

## sas.qtgui.Perspectives.Corfunc.CorfuncPerspective module

class sas.qtgui.Perspectives.Corfunc.CorfuncPerspective.CorfuncWindow(parent=None)

  Bases: `QDialog`, `Ui_CorfuncDialog`, `Perspective`

  Displays the correlation function analysis of sas data.

  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: `QWidget`

  Slider that allows the selection of the different Q-ranges involved in interpolation, and that provides some visual cues to how it works.

  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: `CorfuncCanvas`

  Canvas for displaying real space representation

  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: `CorfuncCanvas`

  Canvas for displaying real space representation

  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: `CorfuncCanvas`

  Canvas for displaying input data and extrapolation parameters

  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: `CorfuncCanvas`

  Canvas for displaying real space representation

  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_SaveExtrapolatedPanel`

  Dialogue window for saving extrapolated data

  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`

## 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

## Module contents