sas.qtgui.Perspectives.ParticleEditor package¶
Subpackages¶
- sas.qtgui.Perspectives.ParticleEditor.ParameterFunctionality package
- Submodules
- sas.qtgui.Perspectives.ParticleEditor.ParameterFunctionality.ParameterEntries module
- sas.qtgui.Perspectives.ParticleEditor.ParameterFunctionality.ParameterTable module
- sas.qtgui.Perspectives.ParticleEditor.ParameterFunctionality.ParameterTableButtons module
- sas.qtgui.Perspectives.ParticleEditor.ParameterFunctionality.ParameterTableModel module
- Module contents
- sas.qtgui.Perspectives.ParticleEditor.datamodel package
- Submodules
- sas.qtgui.Perspectives.ParticleEditor.datamodel.calculation module
AngularDistributionMagnetismDefinitionParticleDefinitionQSampleQSpaceScatteringRealSpaceScatteringSLDDefinitionSamplingDistributionScatteringCalculationScatteringCalculation.angular_samplingScatteringCalculation.bin_countScatteringCalculation.bounding_surface_sld_checkScatteringCalculation.parameter_settingsScatteringCalculation.particle_definitionScatteringCalculation.polarisation_vectorScatteringCalculation.q_samplingScatteringCalculation.sample_chunk_size_hintScatteringCalculation.seedScatteringCalculation.spatial_sampling_method
ScatteringOutputSpatialDistribution
- sas.qtgui.Perspectives.ParticleEditor.datamodel.parameters module
- sas.qtgui.Perspectives.ParticleEditor.datamodel.types module
- Module contents
- sas.qtgui.Perspectives.ParticleEditor.sampling package
Submodules¶
sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector module¶
- class sas.qtgui.Perspectives.ParticleEditor.AngularSamplingMethodSelector.AngularSamplingMethodSelector(parent=None)¶
Bases:
QWidgetSelects the method for doing angular sampling, and provides access to the parameters
- 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:
QWidgetForm that displays the parameters associated with the class (also responsible for generating the sampler)
- 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¶
sas.qtgui.Perspectives.ParticleEditor.DesignWindow module¶
- class sas.qtgui.Perspectives.ParticleEditor.DesignWindow.DesignWindow(parent=None)¶
Bases:
QDialog,Ui_DesignWindowMain window for the particle editor
- 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
- 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- 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:
QSpinBoxSpinBox that only takes values that corresponds to the number of vertices on a geodesic sphere
- getNDivisions()¶
- onEditingFinished()¶
- staticMetaObject = PySide6.QtCore.QMetaObject("GeodesicSamplingSpinBox" inherits "QSpinBox": )¶
- stepBy(steps: int)¶
- 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:
QWidgetSlider with labels and value text
- 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:
QTextEditPython text editor window
- 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:
QTextEditPython text editor window
- build_trigger¶
- insertFromMimeData(source)¶
Keep own highlighting
- keyPressEvent(e)¶
Itercepted key press event
- staticMetaObject = PySide6.QtCore.QMetaObject("PythonViewer" inherits "QTextEdit": Methods: #73 type=Signal, signature=build_trigger() )¶
- sas.qtgui.Perspectives.ParticleEditor.PythonViewer.main()¶
Demo/testing window
sas.qtgui.Perspectives.ParticleEditor.RadiusSelection module¶
sas.qtgui.Perspectives.ParticleEditor.SLDMagnetismOption module¶
sas.qtgui.Perspectives.ParticleEditor.ViewerButtons module¶
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
- 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: ~collections.abc.Callable[[str], None] = <function default_callback>, warning_callback: ~collections.abc.Callable[[str], None] = <function default_callback>, error_callback: ~collections.abc.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:
QSyntaxHighlighterSyntax highlighter for the Python language.
- 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