sas.qtgui.Perspectives.ParticleEditor package

Subpackages

Submodules

sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector module

class sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector.AngularSamplingMethodSelector(parent=None)

Bases: QWidget

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector'
generate_sampler() AngularDistribution

Create the angular distribution sampler spectified by the current settings

on_update()
staticMetaObject = PySide6.QtCore.QMetaObject("AngularSamplingMethodSelector" inherits "QWidget": )
class sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector.ParametersForm(sampling_class: type, parent=None)

Bases: QWidget

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector'
generate_sampler() AngularDistribution

Generate a sampler based on the selected parameters

staticMetaObject = PySide6.QtCore.QMetaObject("ParametersForm" inherits "QWidget": )
sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector.main()

Show a demo

sas.qtgui.Perspectives.ParticleEditor.CodeToolBar module

class sas.qtgui.Perspectives.ParticleEditor.CodeToolBar.CodeToolBar(parent=None)

Bases: QWidget, Ui_CodeToolBar

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.CodeToolBar'
staticMetaObject = PySide6.QtCore.QMetaObject("CodeToolBar" inherits "QWidget": )

sas.qtgui.Perspectives.ParticleEditor.DesignWindow module

class sas.qtgui.Perspectives.ParticleEditor.DesignWindow.DesignWindow(parent=None)

Bases: QDialog, Ui_DesignWindow

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.DesignWindow'
angularDistribution() AngularDistribution

Get the AngularDistribution object that represents the GUI selected orientational distribution

codeError(text)

Show an error concerning input code

codeText(text)

Show info about input code / code stdout

codeWarning(text)

Show a warning about input code

currentSeed()
display_calculation_result(scattering_result: ScatteringOutput)

Update graphs and select tab

doBuild()

Build functionality requested

doScatter()

Scatter functionality requested

magnetismDefinition() MagnetismDefinition | None
onFit()

Fit functionality requested

onLoad()
onRadiusChanged()
onSave()
onTimeEstimateParametersChanged()

Called when the number of samples changes

parametersForCalculation() CalculationParameters
particleDefinition() ParticleDefinition

Get the ParticleDefinition object that contains the SLD and magnetism functions

polarisationVector() ndarray

Get a numpy vector representing the GUI specified polarisation vector

qSampling() QSample

Calculate the q sampling object based on current gui settings

scatteringCalculation() ScatteringCalculation

Get the ScatteringCalculation object that represents the calculation that is to be passed to the solver

sldDefinition() SLDDefinition
spatialSampling() SpatialDistribution

Calculate the spatial sampling object based on current gui settings

staticMetaObject = PySide6.QtCore.QMetaObject("DesignWindow" inherits "QDialog": )
sas.qtgui.Perspectives.ParticleEditor.DesignWindow.main()

Demo/testing window

sas.qtgui.Perspectives.ParticleEditor.DesignWindow.safe_float(text: str)

sas.qtgui.Perspectives.ParticleEditor.FunctionViewer module

class sas.qtgui.Perspectives.ParticleEditor.FunctionViewer.FunctionViewer(parent=None)

Bases: QWidget

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.FunctionViewer'
drawAxes(im)

Draw a small xyz axis on an image

drawScale(im)

Draw a scalebar

eventFilter(source, event)

Event filter intercept, grabs mouse drags on the images

onDepthChanged()

Callback for cross section depth slider

onDisplayTypeSelected()

Switch between SLD and magnetism view

onMagPhiChanged()

Magnetic field phi angle changed

onMagThetaChanged()

Magnetic field theta angle changed

onRadiusChanged()

Draw radius changed

setAngles(alpha_deg, beta_deg)

Set the viewer angles

setSLDFunction(fun, coordinate_mapping)

Set the function to be plotted

staticMetaObject = PySide6.QtCore.QMetaObject("FunctionViewer" inherits "QWidget": )
updateImage(mag_only=True)

Update the images in the viewer

sas.qtgui.Perspectives.ParticleEditor.FunctionViewer.cross_section_coordinates(radius: float, alpha: float, beta: float, plane_distance: float, n_points: int)
sas.qtgui.Perspectives.ParticleEditor.FunctionViewer.draw_line_in_place(im, x0, y0, dx, dy, channel)

Simple line drawing (otherwise need to import something heavyweight)

sas.qtgui.Perspectives.ParticleEditor.FunctionViewer.main()

Show a demo of the function viewer

sas.qtgui.Perspectives.ParticleEditor.FunctionViewer.rotation_matrix(alpha: float, beta: float)

sas.qtgui.Perspectives.ParticleEditor.GeodesicSampleSelector module

class sas.qtgui.Perspectives.ParticleEditor.GeodesicSampleSelector.GeodesicSamplingSpinBox(parent: QWidget | None = None)

Bases: QSpinBox

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.GeodesicSampleSelector'
getNDivisions()
onEditingFinished()
staticMetaObject = PySide6.QtCore.QMetaObject("GeodesicSamplingSpinBox" inherits "QSpinBox": )
stepBy(self, steps: int) None
updateDisplayValue()
sas.qtgui.Perspectives.ParticleEditor.GeodesicSampleSelector.main()

Show a demo of the spinner

sas.qtgui.Perspectives.ParticleEditor.LabelledSlider module

class sas.qtgui.Perspectives.ParticleEditor.LabelledSlider.LabelledSlider(name: str, min_value: int, max_value: int, value: int, tick_interval: int = 10, name_width=10, value_width=30, value_units='°')

Bases: QWidget

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.LabelledSlider'
_on_value_changed()
staticMetaObject = PySide6.QtCore.QMetaObject("LabelledSlider" inherits "QWidget": )
value() int
property valueChanged

sas.qtgui.Perspectives.ParticleEditor.OutputViewer module

class sas.qtgui.Perspectives.ParticleEditor.OutputViewer.OutputViewer(parent=None)

Bases: QTextEdit

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None) None
__init__(self, text: str, parent: PySide6.QtWidgets.QWidget | None = None) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.OutputViewer'
_htmlise(text)
addError(text)
addText(text)
addWarning(text)
appendAndMove(text)
keyPressEvent(e)

Itercepted key press event

reset()
staticMetaObject = PySide6.QtCore.QMetaObject("OutputViewer" inherits "QTextEdit": )
sas.qtgui.Perspectives.ParticleEditor.OutputViewer.main()

sas.qtgui.Perspectives.ParticleEditor.PythonViewer module

class sas.qtgui.Perspectives.ParticleEditor.PythonViewer.PythonViewer(parent=None)

Bases: QTextEdit

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None) None
__init__(self, text: str, parent: PySide6.QtWidgets.QWidget | None = None) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.PythonViewer'
build_trigger
insertFromMimeData(source)

Keep own highlighting

keyPressEvent(e)

Itercepted key press event

staticMetaObject = PySide6.QtCore.QMetaObject("PythonViewer" inherits "QTextEdit": Methods:   #80 type=Signal, signature=build_trigger() )
sas.qtgui.Perspectives.ParticleEditor.PythonViewer.main()

Demo/testing window

sas.qtgui.Perspectives.ParticleEditor.RadiusSelection module

class sas.qtgui.Perspectives.ParticleEditor.RadiusSelection.RadiusSelection(text: str | None = None, parent=None)

Bases: QWidget, Ui_RadiusSelection

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.RadiusSelection'
radius()
staticMetaObject = PySide6.QtCore.QMetaObject("RadiusSelection" inherits "QWidget": )

sas.qtgui.Perspectives.ParticleEditor.SLDMagnetismOption module

class sas.qtgui.Perspectives.ParticleEditor.SLDMagnetismOption.SLDMagnetismOption(parent=None)

Bases: QWidget, Ui_SLDMagnetismOption

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.SLDMagnetismOption'
staticMetaObject = PySide6.QtCore.QMetaObject("SLDMagnetismOption" inherits "QWidget": )

sas.qtgui.Perspectives.ParticleEditor.ViewerButtons module

class sas.qtgui.Perspectives.ParticleEditor.ViewerButtons.AxisButtons(set_angles_function: Callable[[float, float], None])

Bases: QWidget, Ui_AxisSelection

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.ViewerButtons'
staticMetaObject = PySide6.QtCore.QMetaObject("AxisButtons" inherits "QWidget": )
class sas.qtgui.Perspectives.ParticleEditor.ViewerButtons.PlaneButtons(set_angles_function: Callable[[float, float], None])

Bases: QWidget, Ui_PlaneSelection

__doc__ = None
__init__(self, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags)) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.ViewerButtons'
staticMetaObject = PySide6.QtCore.QMetaObject("PlaneButtons" inherits "QWidget": )

sas.qtgui.Perspectives.ParticleEditor.defaults module

sas.qtgui.Perspectives.ParticleEditor.defaults.default_text = '""" \n\nHere\'s a new perspective. It calculates the scattering based on real-space description of a particle.\n\nBasically, define your SLD as a function of either cartesian or polar coordinates and click scatter\n\n  def sld(x,y,z)\n  def sld(r,theta,phi)\n\nThe display on the right shows your particle, both as a total projected density (top) and as a slice (bottom).\n\nThis is a minimal working system. Currently magnetism doesn\'t work, neither do extra parameters for your functions,\nnor structure factors, nor fitting, nor 2D plots. \n\nHere\'s a simple example: """\n\ndef sld_cube(x,y,z):\n    """ A cube with 100Ang side length"""\n\n    return rect(0.02*x)*rect(0.02*y)*rect(0.02*z)\n\n\ndef sld_sphere(r, theta, phi):\n    """ Sphere r=50Ang"""\n\n    return rect(0.02*r)\n\nsld = sld_sphere\n\n'

Press shift-return to build and update views Click scatter to show the scattering profile

sas.qtgui.Perspectives.ParticleEditor.defaults.sld(r, theta, phi)

sas.qtgui.Perspectives.ParticleEditor.function_processor module

exception sas.qtgui.Perspectives.ParticleEditor.function_processor.FunctionDefinitionFailed(*args)

Bases: Exception

__doc__ = None
__init__(*args)
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.function_processor'
__weakref__

list of weak references to the object

sas.qtgui.Perspectives.ParticleEditor.function_processor.cartesian_converter(x, y, z)

Converter from calculation coordinates to function definition

For functions specified in cartesian coordinates

sas.qtgui.Perspectives.ParticleEditor.function_processor.default_callback(string: str)

Just for default

sas.qtgui.Perspectives.ParticleEditor.function_processor.main()
sas.qtgui.Perspectives.ParticleEditor.function_processor.process_code(input_text: str, solvent_sld: float = 0.0, text_callback: ~typing.Callable[[str], None] = <function default_callback>, warning_callback: ~typing.Callable[[str], None] = <function default_callback>, error_callback: ~typing.Callable[[str], None] = <function default_callback>)

Process the code for generating functions that specify sld/magnetism

sas.qtgui.Perspectives.ParticleEditor.function_processor.spherical_converter(x, y, z)

Converter from calculation coordinates to function definition

For functions specified in spherical coordinates

sas.qtgui.Perspectives.ParticleEditor.helper_functions module

Functions that get automatically included in the build window

sas.qtgui.Perspectives.ParticleEditor.helper_functions.rect(x: ndarray)

Rectangle function, zero if mod(input) > 1, 1 otherwise

sas.qtgui.Perspectives.ParticleEditor.helper_functions.step(x: ndarray)

Step function, 0 if input < 0, 1 if input >= 0

sas.qtgui.Perspectives.ParticleEditor.syntax_highlight module

Modified from: art1415926535/PyQt5-syntax-highlighting on github

It’s not great, should all really be implemented as a finite state machine with a stack

class sas.qtgui.Perspectives.ParticleEditor.syntax_highlight.PythonHighlighter(document)

Bases: QSyntaxHighlighter

__doc__ = None
__init__(self, parent: PySide6.QtCore.QObject) None
__init__(self, parent: PySide6.QtGui.QTextDocument) None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'sas.qtgui.Perspectives.ParticleEditor.syntax_highlight'
braces = ['\\{', '\\}', '\\(', '\\)', '\\[', '\\]']
highlightBlock(text)

Apply syntax highlighting to the given block of text.

keywords = ['and', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'yield', 'None', 'True', 'False']
operators = ['=', '==', '!=', '<', '<=', '>', '>=', '\\+', '-', '\\*', '/', '//', '\\%', '\\*\\*', '\\+=', '-=', '\\*=', '/=', '\\%=', '\\^', '\\|', '\\&', '\\~', '>>', '<<']
special = ['sld', 'solvent_sld', 'magnetism']
staticMetaObject = PySide6.QtCore.QMetaObject("PythonHighlighter" inherits "QSyntaxHighlighter": )
sas.qtgui.Perspectives.ParticleEditor.syntax_highlight.format(color, style='')

Return a QTextCharFormat with the given attributes.

sas.qtgui.Perspectives.ParticleEditor.util module

sas.qtgui.Perspectives.ParticleEditor.util.format_time_estimate(est_time_seconds)

Get easily understandable string for a computational time estimate

sas.qtgui.Perspectives.ParticleEditor.vectorise module

sas.qtgui.Perspectives.ParticleEditor.vectorise.clean_traceback(trace: str)

Tracebacks from vectorise contain potentially confusing information from the vectorisation infrastructure. Clean it up and replace empty filename with something else

sas.qtgui.Perspectives.ParticleEditor.vectorise.main()
sas.qtgui.Perspectives.ParticleEditor.vectorise.vectorise_magnetism(fun: Callable, warning_callback: Callable[[str], None], *args, **kwargs)

Check whether a magnetism function can handle numpy arrays properly, if not, create a wrapper that that can

sas.qtgui.Perspectives.ParticleEditor.vectorise.vectorise_sld(fun: Callable, warning_callback: Callable[[str], None], error_callback: Callable[[str], None], *args, **kwargs)

Check whether an SLD function can handle numpy arrays properly, if not, create a wrapper that that can

Module contents