sas.qtgui.Plotting package¶
Subpackages¶
- sas.qtgui.Plotting.Masks package
- Submodules
- sas.qtgui.Plotting.Masks.BoxMask module
- sas.qtgui.Plotting.Masks.CircularMask module
CircularMask
CircularMask.__doc__
CircularMask.__init__()
CircularMask.__module__
CircularMask._post_data()
CircularMask.clear()
CircularMask.draw()
CircularMask.getParams()
CircularMask.move()
CircularMask.moveend()
CircularMask.restore()
CircularMask.save()
CircularMask.setParams()
CircularMask.set_cursor()
CircularMask.set_layer()
CircularMask.update()
- sas.qtgui.Plotting.Masks.SectorMask module
- Module contents
- sas.qtgui.Plotting.Slicers package
- Submodules
- sas.qtgui.Plotting.Slicers.AnnulusSlicer module
AnnulusInteractor
AnnulusInteractor.__doc__
AnnulusInteractor.__init__()
AnnulusInteractor.__module__
AnnulusInteractor._post_data()
AnnulusInteractor.clear()
AnnulusInteractor.draw()
AnnulusInteractor.getParams()
AnnulusInteractor.move()
AnnulusInteractor.moveend()
AnnulusInteractor.restore()
AnnulusInteractor.save()
AnnulusInteractor.setParams()
AnnulusInteractor.set_cursor()
AnnulusInteractor.set_layer()
AnnulusInteractor.update()
AnnulusInteractor.validate()
RingInteractor
RingInteractor.__doc__
RingInteractor.__init__()
RingInteractor.__module__
RingInteractor.clear()
RingInteractor.getParams()
RingInteractor.get_radius()
RingInteractor.move()
RingInteractor.moveend()
RingInteractor.restore()
RingInteractor.save()
RingInteractor.setParams()
RingInteractor.set_cursor()
RingInteractor.set_layer()
RingInteractor.update()
- sas.qtgui.Plotting.Slicers.Arc module
ArcInteractor
ArcInteractor.__doc__
ArcInteractor.__init__()
ArcInteractor.__module__
ArcInteractor.clear()
ArcInteractor.get_params()
ArcInteractor.get_radius()
ArcInteractor.move()
ArcInteractor.moveend()
ArcInteractor.restore()
ArcInteractor.save()
ArcInteractor.set_cursor()
ArcInteractor.set_layer()
ArcInteractor.set_params()
ArcInteractor.update()
- sas.qtgui.Plotting.Slicers.AzimutSlicer module
SectorInteractor
SectorInteractor.__doc__
SectorInteractor.__init__()
SectorInteractor.__module__
SectorInteractor._post_data()
SectorInteractor.clear()
SectorInteractor.draw()
SectorInteractor.freeze_axes()
SectorInteractor.get_params()
SectorInteractor.move()
SectorInteractor.moveend()
SectorInteractor.post_data()
SectorInteractor.restore()
SectorInteractor.save()
SectorInteractor.set_cursor()
SectorInteractor.set_layer()
SectorInteractor.set_params()
SectorInteractor.thaw_axes()
SectorInteractor.update()
SectorInteractor.validate()
SectorInteractorPhi
SectorInteractorQ
- sas.qtgui.Plotting.Slicers.BaseInteractor module
BaseInteractor
BaseInteractor.__dict__
BaseInteractor.__doc__
BaseInteractor.__init__()
BaseInteractor.__module__
BaseInteractor.__weakref__
BaseInteractor.clear_markers()
BaseInteractor.connect_markers()
BaseInteractor.dpixel()
BaseInteractor.move()
BaseInteractor.moveend()
BaseInteractor.onClick()
BaseInteractor.onDrag()
BaseInteractor.onHilite()
BaseInteractor.onKey()
BaseInteractor.onLeave()
BaseInteractor.onRelease()
BaseInteractor.restore()
BaseInteractor.save()
- sas.qtgui.Plotting.Slicers.BoxSlicer module
BoxInteractor
BoxInteractor.__doc__
BoxInteractor.__init__()
BoxInteractor.__module__
BoxInteractor._post_data()
BoxInteractor.clear()
BoxInteractor.draw()
BoxInteractor.getParams()
BoxInteractor.move()
BoxInteractor.moveend()
BoxInteractor.post_data()
BoxInteractor.restore()
BoxInteractor.save()
BoxInteractor.setParams()
BoxInteractor.set_cursor()
BoxInteractor.set_layer()
BoxInteractor.update()
BoxInteractor.update_and_post()
BoxInteractorX
BoxInteractorY
HorizontalLines
VerticalLines
- sas.qtgui.Plotting.Slicers.BoxSum module
BoxSumCalculator
BoxSumCalculator.__doc__
BoxSumCalculator.__init__()
BoxSumCalculator.__module__
BoxSumCalculator.clear()
BoxSumCalculator.draw()
BoxSumCalculator.getParams()
BoxSumCalculator.getResult()
BoxSumCalculator.model()
BoxSumCalculator.moveend()
BoxSumCalculator.postData()
BoxSumCalculator.restore()
BoxSumCalculator.save()
BoxSumCalculator.setLayer()
BoxSumCalculator.setModelFromParams()
BoxSumCalculator.setPanelName()
BoxSumCalculator.setParams()
BoxSumCalculator.setParamsFromModel()
BoxSumCalculator.setReadOnlyParametersFromModel()
BoxSumCalculator.update()
BoxSumCalculator.validate()
HorizontalDoubleLine
HorizontalDoubleLine.__doc__
HorizontalDoubleLine.__init__()
HorizontalDoubleLine.__module__
HorizontalDoubleLine.clear()
HorizontalDoubleLine.move()
HorizontalDoubleLine.moveend()
HorizontalDoubleLine.restore()
HorizontalDoubleLine.save()
HorizontalDoubleLine.setCursor()
HorizontalDoubleLine.setLayer()
HorizontalDoubleLine.update()
PointInteractor
VerticalDoubleLine
VerticalDoubleLine.__doc__
VerticalDoubleLine.__init__()
VerticalDoubleLine.__module__
VerticalDoubleLine.clear()
VerticalDoubleLine.move()
VerticalDoubleLine.moveend()
VerticalDoubleLine.restore()
VerticalDoubleLine.save()
VerticalDoubleLine.setCursor()
VerticalDoubleLine.setLayer()
VerticalDoubleLine.update()
- sas.qtgui.Plotting.Slicers.RadiusInteractor module
RadiusInteractor
RadiusInteractor.__doc__
RadiusInteractor.__init__()
RadiusInteractor.__module__
RadiusInteractor.clear()
RadiusInteractor.get_angle()
RadiusInteractor.get_params()
RadiusInteractor.move()
RadiusInteractor.moveend()
RadiusInteractor.restore()
RadiusInteractor.save()
RadiusInteractor.set_cursor()
RadiusInteractor.set_layer()
RadiusInteractor.set_params()
RadiusInteractor.update()
- sas.qtgui.Plotting.Slicers.SectorSlicer module
LineInteractor
LineInteractor.__doc__
LineInteractor.__init__()
LineInteractor.__module__
LineInteractor.clear()
LineInteractor.getParams()
LineInteractor.move()
LineInteractor.moveend()
LineInteractor.restore()
LineInteractor.save()
LineInteractor.setParams()
LineInteractor.set_cursor()
LineInteractor.set_layer()
LineInteractor.update()
SectorInteractor
SectorInteractor.__doc__
SectorInteractor.__init__()
SectorInteractor.__module__
SectorInteractor._post_data()
SectorInteractor.clear()
SectorInteractor.draw()
SectorInteractor.getParams()
SectorInteractor.move()
SectorInteractor.moveend()
SectorInteractor.restore()
SectorInteractor.save()
SectorInteractor.setParams()
SectorInteractor.set_cursor()
SectorInteractor.set_layer()
SectorInteractor.update()
SectorInteractor.validate()
SideInteractor
SideInteractor.__doc__
SideInteractor.__init__()
SideInteractor.__module__
SideInteractor.clear()
SideInteractor.getParams()
SideInteractor.move()
SideInteractor.moveend()
SideInteractor.restore()
SideInteractor.save()
SideInteractor.setParams()
SideInteractor.set_cursor()
SideInteractor.set_layer()
SideInteractor.update()
- Module contents
- sas.qtgui.Plotting.UI package
- Submodules
- sas.qtgui.Plotting.UI.AddTextUI module
- sas.qtgui.Plotting.UI.BoxSumUI module
- sas.qtgui.Plotting.UI.ColorMapUI module
- sas.qtgui.Plotting.UI.LinearFitUI module
- sas.qtgui.Plotting.UI.MaskEditorUI module
- sas.qtgui.Plotting.UI.PlotPropertiesUI module
- sas.qtgui.Plotting.UI.ScalePropertiesUI module
- sas.qtgui.Plotting.UI.SetGraphRangeUI module
- sas.qtgui.Plotting.UI.SlicerParametersUI module
- sas.qtgui.Plotting.UI.WindowTitleUI module
- Module contents
Submodules¶
sas.qtgui.Plotting.AddText module¶
- class sas.qtgui.Plotting.AddText.AddText(parent=None)[source]¶
Bases:
QDialog
,Ui_AddText
Simple GUI for a single line text query
- __doc__ = ' Simple GUI for a single line text query '¶
- __module__ = 'sas.qtgui.Plotting.AddText'¶
sas.qtgui.Plotting.Arrow3D module¶
Module that draws multiple arrows in 3D coordinates
- class sas.qtgui.Plotting.Arrow3D.Arrow3D(base, xs, ys, zs, colors, *args, **kwargs)[source]¶
Bases:
FancyArrowPatch
Draw 3D arrow
- __doc__ = '\n Draw 3D arrow\n '¶
- __init__(base, xs, ys, zs, colors, *args, **kwargs)[source]¶
Init
- Params xs:
[[x0, x0+dx0], [x1, x1+dx1], …]
- Params ys:
[[y0, y0+dy0], [y1, y1+dy1], …]
- Params zs:
[[z0, z0+dz0], [z1, z1+dz1], …]
- Params colors:
[[R0, G0, B0], [R1, G1, B1], …]
where R, G, B ranges (0,1)
- __module__ = 'sas.qtgui.Plotting.Arrow3D'¶
sas.qtgui.Plotting.Binder module¶
Extension to MPL to support the binding of artists to key/mouse events.
- class sas.qtgui.Plotting.Binder.BindArtist(figure)[source]¶
Bases:
object
- __call__(trigger, artist, action)[source]¶
Register a callback for an artist to a particular trigger event.
- usage:
self.connect(eventname,artist,action)
- where:
eventname is a string artist is the particular graph object to respond to the event action(event,**kw) is called when the event is triggered
The action callback is associated with particular artists. Different artists will have different kwargs. See documentation on the contains() method for each artist. One common properties are ind for the index of the item under the cursor, which is returned by Line2D and by collections.
- The following events are supported:
enter: mouse cursor moves into the artist or to a new index leave: mouse cursor leaves the artist click: mouse button pressed on the artist drag: mouse button pressed on the artist and cursor moves release: mouse button released for the artist key: key pressed when mouse is on the artist keyrelease: key released for the artist
- The event received by action has a number of attributes:
name is the event name which was triggered artist is the object which triggered the event x,y are the screen coordinates of the mouse xdata,ydata are the graph coordinates of the mouse button is the mouse button being pressed/released key is the key being pressed/released shift,control,alt,meta are flags which are true if the
corresponding key is pressed at the time of the event.
- details is a dictionary of artist specific details, such as the
id(s) of the point that were clicked.
When receiving an event, first check the modifier state to be sure it applies. E.g., the callback for ‘press’ might be:
if event.button == 1 and event.shift: process Shift-click
TODO: Only receive events with the correct modifiers (e.g., S-click, TODO: or -click for any modifiers). TODO: Only receive button events for the correct button (e.g., click1 TODO: release3, or dclick for any button) TODO: Support virtual artist, so that and artist can be flagged as TODO: having a tag list and receive the correct events TODO: Support virtual events for binding to button-3 vs shift button-1 TODO: without changing callback code TODO: Attach multiple callbacks to the same event? TODO: Clean up interaction with toolbar modes TODO: push/pushclear/pop context so that binding changes for
the duration
TODO: e.g., to support ? context sensitive help
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Binder', '__doc__': '\n ', 'control': False, 'shift': False, 'alt': False, 'meta': False, 'dclick_threshhold': 0.25, '_last_button': None, '_last_time': 0, 'events': ['enter', 'leave', 'motion', 'click', 'dclick', 'drag', 'release', 'scroll', 'key', 'keyup'], '__init__': <function BindArtist.__init__>, 'clear': <function BindArtist.clear>, 'clearall': <function BindArtist.clearall>, 'disconnect': <function BindArtist.disconnect>, '__del__': <function BindArtist.__del__>, '__call__': <function BindArtist.__call__>, 'trigger': <function BindArtist.trigger>, '_find_current': <function BindArtist._find_current>, '_onMotion': <function BindArtist._onMotion>, '_onClick': <function BindArtist._onClick>, '_onDClick': <function BindArtist._onDClick>, '_onRelease': <function BindArtist._onRelease>, '_onKey': <function BindArtist._onKey>, '_onKeyRelease': <function BindArtist._onKeyRelease>, '_onScroll': <function BindArtist._onScroll>, '__dict__': <attribute '__dict__' of 'BindArtist' objects>, '__weakref__': <attribute '__weakref__' of 'BindArtist' objects>, '__annotations__': {}})¶
- __doc__ = '\n '¶
- __module__ = 'sas.qtgui.Plotting.Binder'¶
- __weakref__¶
list of weak references to the object (if defined)
- _find_current(event)[source]¶
Find the artist who will receive the event. Only search registered artists. All others are invisible to the mouse.
- _last_button = None¶
- _last_time = 0¶
- _onMotion(event)[source]¶
Track enter/leave/motion through registered artists; all other artists are invisible.
- alt = False¶
- clear(h1, h2, ...)[source]¶
Remove connections for artists h1, h2, …
Use clearall() to reset all connections.
- control = False¶
- dclick_threshhold = 0.25¶
- events = ['enter', 'leave', 'motion', 'click', 'dclick', 'drag', 'release', 'scroll', 'key', 'keyup']¶
- meta = False¶
- shift = False¶
- class sas.qtgui.Plotting.Binder.Selection(artist=None, prop={})[source]¶
Bases:
object
Store and compare selections.
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Binder', '__doc__': '\n Store and compare selections.\n ', 'artist': None, 'prop': {}, '__init__': <function Selection.__init__>, '__eq__': <function Selection.__eq__>, '__ne__': <function Selection.__ne__>, '__bool__': <function Selection.__bool__>, '__dict__': <attribute '__dict__' of 'Selection' objects>, '__weakref__': <attribute '__weakref__' of 'Selection' objects>, '__hash__': None, '__annotations__': {}})¶
- __doc__ = '\n Store and compare selections.\n '¶
- __hash__ = None¶
- __module__ = 'sas.qtgui.Plotting.Binder'¶
- __weakref__¶
list of weak references to the object (if defined)
- artist = None¶
- prop = {}¶
sas.qtgui.Plotting.BoxSum module¶
Allows users to modify the box slicer parameters.
sas.qtgui.Plotting.ColorMap module¶
Allows users to change the range of the current graph
- class sas.qtgui.Plotting.ColorMap.ColorMap(parent=None, cmap=None, vmin=0.0, vmax=100.0, data=None)[source]¶
Bases:
QDialog
,Ui_ColorMapUI
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.ColorMap'¶
- apply_signal¶
sas.qtgui.Plotting.ConvertUnits module¶
Convert units to strings that can be displayed This is a cleaned up version of unitConverter.py
sas.qtgui.Plotting.DataTransform module¶
- sas.qtgui.Plotting.DataTransform.errFromX2(x, y=None, dx=None, dy=None)[source]¶
calculate error of sqrt(x)
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errFromX4(x, y=None, dx=None, dy=None)[source]¶
calculate error of x^1/4
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errOneOverSqrtX(x, y=None, dx=None, dy=None)[source]¶
Calculate error on 1/sqrt(x)
- sas.qtgui.Plotting.DataTransform.errOneOverX(x, y=None, dx=None, dy=None)[source]¶
calculate error on 1/x
- sas.qtgui.Plotting.DataTransform.errToLog10X(x, y=None, dx=None, dy=None)[source]¶
calculate error of Log(x)
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errToLogX(x, y=None, dx=None, dy=None)[source]¶
calculate error of Log(x)
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errToLogXY(x, y, dx=None, dy=None)[source]¶
calculate error of Log(xy)
- sas.qtgui.Plotting.DataTransform.errToLogYX2(y, x, dy=None, dx=None)[source]¶
calculate error of Log(yx**2)
- sas.qtgui.Plotting.DataTransform.errToLogYX4(y, x, dy=None, dx=None)[source]¶
error for ln(y*x^(4))
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.errToX(x, y=None, dx=None, dy=None)[source]¶
calculate error of x**2
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errToX2(x, y=None, dx=None, dy=None)[source]¶
calculate error of x**2
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errToX4(x, y=None, dx=None, dy=None)[source]¶
calculate error of x**4
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errToX_pos(x, y=None, dx=None, dy=None)[source]¶
calculate error of x**2
- Parameters:
x – float value
dx – float value
- sas.qtgui.Plotting.DataTransform.errToYX4(y, x, dy=None, dx=None)[source]¶
error for (y*x^(4))
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.fromX2(x, y=None)[source]¶
This function is used to load value on Plottable.View Calculate square root of x
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.fromX4(x, y=None)[source]¶
This function is used to load value on Plottable.View Calculate square root of x
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.toLogX(x, y=None)[source]¶
This function is used to load value on Plottable.View calculate log x
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.toLogXY(y, x)[source]¶
This function is used to load value on Plottable.View calculate log x
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.toX(x, y=None)[source]¶
This function is used to load value on Plottable.View
- Parameters:
x – Float value
- Returns:
x
- sas.qtgui.Plotting.DataTransform.toX2(x, y=None)[source]¶
This function is used to load value on Plottable.View
Calculate x^(2)
- Parameters:
x – float value
- sas.qtgui.Plotting.DataTransform.toX4(x, y=None)[source]¶
This function is used to load value on Plottable.View
Calculate x^(4)
- Parameters:
x – float value
sas.qtgui.Plotting.Fittings module¶
This module is used to fit a set of x,y data to a model passed to it. It is used to calculate the slope and intercepts for the linearized fits. Two things should be noted:
First, this fitting module uses the NLLSQ module of SciPy rather than a linear fit. This along with a few other modules could probably be removed if we move to a linear regression approach.
Second, this infrastructure does not allow for resolution smearing of the the models. Hence the results are not that accurate even for pinhole collimation of SANS but may be good for SAXS. It is completely wrong for slit smeared data.
- class sas.qtgui.Plotting.Fittings.Parameter(model, name, value=None)[source]¶
Bases:
object
Class to handle model parameters - sets the parameters and their initial value from the model based to it.
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Fittings', '__doc__': '\n Class to handle model parameters - sets the parameters and their\n initial value from the model based to it.\n ', '__init__': <function Parameter.__init__>, 'set': <function Parameter.set>, '__call__': <function Parameter.__call__>, '__dict__': <attribute '__dict__' of 'Parameter' objects>, '__weakref__': <attribute '__weakref__' of 'Parameter' objects>, '__annotations__': {}})¶
- __doc__ = '\n Class to handle model parameters - sets the parameters and their\n initial value from the model based to it.\n '¶
- __module__ = 'sas.qtgui.Plotting.Fittings'¶
- __weakref__¶
list of weak references to the object (if defined)
sas.qtgui.Plotting.LineModel module¶
Provide Line function (y= Ax + B). Until July 10, 2016 this function provided (y= A + Bx). This however was contrary to all the other code using it which assumed (y= mx+b) or in this nomenclature (y=Ax + B). This lead to some contortions in the code and worse incorrect calculations until now for at least some of the functions. This seemed the easiest to fix particularly since this function should disappear in a future iteration (see notes in fitDialog)
- -PDB
July 10, 2016
- class sas.qtgui.Plotting.LineModel.LineModel[source]¶
Bases:
object
Class that evaluates a linear model.
\(f(x) = Ax + B\)
List of default parameters: A = 1.0 B = 1.0
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.LineModel', '__doc__': '\n Class that evaluates a linear model.\n\n $f(x) = Ax + B$\n\n List of default parameters:\n A = 1.0\n B = 1.0\n ', '__init__': <function LineModel.__init__>, 'getParam': <function LineModel.getParam>, 'setParam': <function LineModel.setParam>, '_line': <function LineModel._line>, 'run': <function LineModel.run>, 'runXY': <function LineModel.runXY>, '__dict__': <attribute '__dict__' of 'LineModel' objects>, '__weakref__': <attribute '__weakref__' of 'LineModel' objects>, '__annotations__': {}})¶
- __doc__ = '\n Class that evaluates a linear model.\n\n $f(x) = Ax + B$\n\n List of default parameters:\n A = 1.0\n B = 1.0\n '¶
- __module__ = 'sas.qtgui.Plotting.LineModel'¶
- __weakref__¶
list of weak references to the object (if defined)
- run(x=0.0)[source]¶
Evaluate the model
- Parameters:
x – simple value
- Returns:
(Line value)
Note
This is the function called by fitDialog to calculate the the y(xmin) and y(xmax), but the only difference between this and runXY is when the if statement is true. I however cannot see what that function is for. It needs to be documented here or removed. -PDB 7/10/16
- runXY(x=0.0)[source]¶
Evaluate the model.
- Parameters:
x – simple value
- Returns:
Line value
- ..note::
This is to be what is called by fitDialog for the actual fit but the only difference between this and run is when the if statement is true. I however cannot see what that function is for. It needs to be documented here or removed. -PDB 7/10/16
sas.qtgui.Plotting.LinearFit module¶
Adds a linear fit plot to the chart
- class sas.qtgui.Plotting.LinearFit.LinearFit(parent=None, data=None, max_range=(0.0, 0.0), fit_range=(0.0, 0.0), xlabel='', ylabel='')[source]¶
Bases:
QDialog
,Ui_LinearFitUI
- __doc__ = None¶
- __init__(parent=None, data=None, max_range=(0.0, 0.0), fit_range=(0.0, 0.0), xlabel='', ylabel='')[source]¶
- __module__ = 'sas.qtgui.Plotting.LinearFit'¶
- fit(event)[source]¶
Performs the fit. Receive an event when clicking on the button Fit.Computes chisqr , A and B parameters of the best linear fit y=Ax +B Push a plottable to the caller
- floatInvTransform(x)[source]¶
transform a float.It is used to determine the x.View min and x.View max for values not in x. Also used to properly calculate RgQmin, RgQmax and to update qmin and qmax in the linear range boxes on the panel.
- updatePlot¶
sas.qtgui.Plotting.MaskEditor module¶
- class sas.qtgui.Plotting.MaskEditor.MaskEditor(parent=None, data=None)[source]¶
Bases:
QDialog
,Ui_MaskEditorUI
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.MaskEditor'¶
- emptyRadioButtons()[source]¶
Uncheck all buttons without them firing signals causing unnecessary slicer updates
sas.qtgui.Plotting.PlotHelper module¶
Singleton plot helper module All its variables are bound to the module, which can not be instantiated repeatedly so IDs are session-specific.
- sas.qtgui.Plotting.PlotHelper.addPlot(plot)[source]¶
Adds a new plot to the current dictionary of plots
- sas.qtgui.Plotting.PlotHelper.currentPlots()[source]¶
Returns a list of IDs for all currently active plots
sas.qtgui.Plotting.PlotProperties module¶
- class sas.qtgui.Plotting.PlotProperties.PlotProperties(parent=None, color=0, marker=0, marker_size=5, legend='')[source]¶
Bases:
QDialog
,Ui_PlotPropertiesUI
Dialog for modification of single plot properties
- __doc__ = ' Dialog for modification of single plot properties '¶
- __module__ = 'sas.qtgui.Plotting.PlotProperties'¶
sas.qtgui.Plotting.PlotUtilities module¶
- sas.qtgui.Plotting.PlotUtilities.build_matrix(data, qx_data, qy_data)[source]¶
Build a matrix for 2d plot from a vector Returns a matrix (image) with ~ square binning Requirement: need 1d array formats of data, qx_data, and qy_data where each one corresponds to z, x, or y axis values
- sas.qtgui.Plotting.PlotUtilities.fillupPixels(image=None, weights=None)[source]¶
Fill z values of the empty cells of 2d image matrix with the average over up-to next nearest neighbor points
- Parameters:
image – (2d matrix with some zi = None)
- Returns:
image (2d array )
- TODO:
Find better way to do for-loop below
- sas.qtgui.Plotting.PlotUtilities.get_bins(qx_data, qy_data)[source]¶
get bins return x_bins and y_bins: 1d arrays of the index with ~ square binning Requirement: need 1d array formats of qx_data, and qy_data where each one corresponds to x, or y axis values
- sas.qtgui.Plotting.PlotUtilities.rescale(lo, hi, step, pt=None, bal=None, scale='linear')[source]¶
Rescale (lo,hi) by step, returning the new (lo,hi) The scaling is centered on pt, with positive values of step driving lo/hi away from pt and negative values pulling them in. If bal is given instead of point, it is already in [0,1] coordinates.
This is a helper function for step-based zooming.
sas.qtgui.Plotting.Plottables module¶
Prototype plottable object support.
The main point of this prototype is to provide a clean separation between the style (plotter details: color, grids, widgets, etc.) and substance (application details: which information to plot). Programmers should not be dictating line colours and plotting symbols.
Unlike the problem of style in CSS or Word, where most paragraphs look the same, each line on a graph has to be distinguishable from its neighbours. Our solution is to provide parametric styles, in which a number of different classes of object (e.g., reflectometry data, reflectometry theory) representing multiple graph primitives cycle through a colour palette provided by the underlying plotter.
A full treatment would provide perceptual dimensions of prominence and distinctiveness rather than a simple colour number.
- class sas.qtgui.Plotting.Plottables.Chisq(chisq=None)[source]¶
Bases:
Plottable
Chisq plottable plots the chisq
- __doc__ = '\n Chisq plottable plots the chisq\n '¶
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- class sas.qtgui.Plotting.Plottables.Graph(**kw)[source]¶
Bases:
object
Generic plottables graph structure.
Plot styles are based on color/symbol lists. The user gets to select the list of colors/symbols/sizes to choose from, not the application developer. The programmer only gets to add/remove lines from the plot and move to the next symbol/color.
Another dimension is prominence, which refers to line sizes/point sizes.
Axis transformations allow the user to select the coordinate view which provides clarity to the data. There is no way we can provide every possible transformation for every application generically, so the plottable objects themselves will need to provide the transformations. Here are some examples from reflectometry:
independent: x -> f(x) monitor scaling: y -> M*y log: y -> log(y if y > min else min) cos: y -> cos(y*pi/180) dependent: x -> f(x,y) Q4: y -> y*x^4 fresnel: y -> y*fresnel(x) coordinated: x,y = f(x,y) Q: x -> 2*pi/L (cos(x*pi/180) - cos(y*pi/180)) y -> 2*pi/L (sin(x*pi/180) + sin(y*pi/180)) reducing: x,y = f(x1,x2,y1,y2) spin asymmetry: x -> x1, y -> (y1 - y2)/(y1 + y2) vector net: x -> x1, y -> y1*cos(y2*pi/180)
Multiple transformations are possible, such as Q4 spin asymmetry
Axes have further complications in that the units of what are being plotted should correspond to the units on the axes. Plotting multiple types on the same graph should be handled gracefully, e.g., by creating a separate tab for each available axis type, breaking into subplots, showing multiple axes on the same plot, or generating inset plots. Ultimately the decision should be left to the user.
Graph properties such as grids/crosshairs should be under user control, as should the sizes of items such as axis fonts, etc. No direct access will be provided to the application.
Axis limits are mostly under user control. If the user has zoomed or panned then those limits are preserved even if new data is plotted. The exception is when, e.g., scanning through a set of related lines in which the user may want to fix the limits so that user can compare the values directly. Another exception is when creating multiple graphs sharing the same limits, though this case may be important enough that it is handled by the graph widget itself. Axis limits will of course have to understand the effects of axis transformations.
High level plottable objects may be composed of low level primitives. Operations such as legend/hide/show copy/paste, etc. need to operate on these primitives as a group. E.g., allowing the user to have a working canvas where they can drag lines they want to save and annotate them.
Graphs need to be printable. A page layout program for entire plots would be nice.
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Plottables', '__doc__': '\n Generic plottables graph structure.\n\n Plot styles are based on color/symbol lists. The user gets to select\n the list of colors/symbols/sizes to choose from, not the application\n developer. The programmer only gets to add/remove lines from the\n plot and move to the next symbol/color.\n\n Another dimension is prominence, which refers to line sizes/point sizes.\n\n Axis transformations allow the user to select the coordinate view\n which provides clarity to the data. There is no way we can provide\n every possible transformation for every application generically, so\n the plottable objects themselves will need to provide the transformations.\n Here are some examples from reflectometry: ::\n\n independent: x -> f(x)\n monitor scaling: y -> M*y\n log: y -> log(y if y > min else min)\n cos: y -> cos(y*pi/180)\n dependent: x -> f(x,y)\n Q4: y -> y*x^4\n fresnel: y -> y*fresnel(x)\n coordinated: x,y = f(x,y)\n Q: x -> 2*pi/L (cos(x*pi/180) - cos(y*pi/180))\n y -> 2*pi/L (sin(x*pi/180) + sin(y*pi/180))\n reducing: x,y = f(x1,x2,y1,y2)\n spin asymmetry: x -> x1, y -> (y1 - y2)/(y1 + y2)\n vector net: x -> x1, y -> y1*cos(y2*pi/180)\n\n Multiple transformations are possible, such as Q4 spin asymmetry\n\n Axes have further complications in that the units of what are being\n plotted should correspond to the units on the axes. Plotting multiple\n types on the same graph should be handled gracefully, e.g., by creating\n a separate tab for each available axis type, breaking into subplots,\n showing multiple axes on the same plot, or generating inset plots.\n Ultimately the decision should be left to the user.\n\n Graph properties such as grids/crosshairs should be under user control,\n as should the sizes of items such as axis fonts, etc. No direct\n access will be provided to the application.\n\n Axis limits are mostly under user control. If the user has zoomed or\n panned then those limits are preserved even if new data is plotted.\n The exception is when, e.g., scanning through a set of related lines\n in which the user may want to fix the limits so that user can compare\n the values directly. Another exception is when creating multiple\n graphs sharing the same limits, though this case may be important\n enough that it is handled by the graph widget itself. Axis limits\n will of course have to understand the effects of axis transformations.\n\n High level plottable objects may be composed of low level primitives.\n Operations such as legend/hide/show copy/paste, etc. need to operate\n on these primitives as a group. E.g., allowing the user to have a\n working canvas where they can drag lines they want to save and annotate\n them.\n\n Graphs need to be printable. A page layout program for entire plots\n would be nice.\n\n ', '_xaxis_transformed': <function Graph._xaxis_transformed>, '_yaxis_transformed': <function Graph._yaxis_transformed>, 'xaxis': <function Graph.xaxis>, 'yaxis': <function Graph.yaxis>, 'title': <function Graph.title>, 'get': <function Graph.get>, 'set': <function Graph.set>, 'isPlotted': <function Graph.isPlotted>, 'add': <function Graph.add>, 'changed': <function Graph.changed>, 'get_range': <function Graph.get_range>, 'replace': <function Graph.replace>, 'delete': <function Graph.delete>, 'reset_scale': <function Graph.reset_scale>, 'reset': <function Graph.reset>, '_make_labels': <function Graph._make_labels>, 'get_plottable': <function Graph.get_plottable>, 'returnPlottable': <function Graph.returnPlottable>, 'render': <function Graph.render>, '__init__': <function Graph.__init__>, '__dict__': <attribute '__dict__' of 'Graph' objects>, '__weakref__': <attribute '__weakref__' of 'Graph' objects>, '__annotations__': {}})¶
- __doc__ = '\n Generic plottables graph structure.\n\n Plot styles are based on color/symbol lists. The user gets to select\n the list of colors/symbols/sizes to choose from, not the application\n developer. The programmer only gets to add/remove lines from the\n plot and move to the next symbol/color.\n\n Another dimension is prominence, which refers to line sizes/point sizes.\n\n Axis transformations allow the user to select the coordinate view\n which provides clarity to the data. There is no way we can provide\n every possible transformation for every application generically, so\n the plottable objects themselves will need to provide the transformations.\n Here are some examples from reflectometry: ::\n\n independent: x -> f(x)\n monitor scaling: y -> M*y\n log: y -> log(y if y > min else min)\n cos: y -> cos(y*pi/180)\n dependent: x -> f(x,y)\n Q4: y -> y*x^4\n fresnel: y -> y*fresnel(x)\n coordinated: x,y = f(x,y)\n Q: x -> 2*pi/L (cos(x*pi/180) - cos(y*pi/180))\n y -> 2*pi/L (sin(x*pi/180) + sin(y*pi/180))\n reducing: x,y = f(x1,x2,y1,y2)\n spin asymmetry: x -> x1, y -> (y1 - y2)/(y1 + y2)\n vector net: x -> x1, y -> y1*cos(y2*pi/180)\n\n Multiple transformations are possible, such as Q4 spin asymmetry\n\n Axes have further complications in that the units of what are being\n plotted should correspond to the units on the axes. Plotting multiple\n types on the same graph should be handled gracefully, e.g., by creating\n a separate tab for each available axis type, breaking into subplots,\n showing multiple axes on the same plot, or generating inset plots.\n Ultimately the decision should be left to the user.\n\n Graph properties such as grids/crosshairs should be under user control,\n as should the sizes of items such as axis fonts, etc. No direct\n access will be provided to the application.\n\n Axis limits are mostly under user control. If the user has zoomed or\n panned then those limits are preserved even if new data is plotted.\n The exception is when, e.g., scanning through a set of related lines\n in which the user may want to fix the limits so that user can compare\n the values directly. Another exception is when creating multiple\n graphs sharing the same limits, though this case may be important\n enough that it is handled by the graph widget itself. Axis limits\n will of course have to understand the effects of axis transformations.\n\n High level plottable objects may be composed of low level primitives.\n Operations such as legend/hide/show copy/paste, etc. need to operate\n on these primitives as a group. E.g., allowing the user to have a\n working canvas where they can drag lines they want to save and annotate\n them.\n\n Graphs need to be printable. A page layout program for entire plots\n would be nice.\n\n '¶
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- __weakref__¶
list of weak references to the object (if defined)
- _xaxis_transformed(name, units)[source]¶
Change the property of the x axis according to an axis transformation (as opposed to changing the basic properties)
- _yaxis_transformed(name, units)[source]¶
Change the property of the y axis according to an axis transformation (as opposed to changing the basic properties)
- get_plottable(name)[source]¶
Return the plottable with the given name if it exists. Otherwise return None
- class sas.qtgui.Plotting.Plottables.Plottable[source]¶
Bases:
object
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Plottables', '__doc__': '\n ', 'short_name': None, 'name': None, 'x': None, 'y': None, 'dx': None, 'dy': None, 'hidden': False, 'interactive': True, 'custom_color': None, 'markersize': 3, 'show_yzero': False, '__init__': <function Plottable.__init__>, '__setattr__': <function Plottable.__setattr__>, 'set_data': <function Plottable.set_data>, 'xaxis': <function Plottable.xaxis>, 'yaxis': <function Plottable.yaxis>, 'get_xaxis': <function Plottable.get_xaxis>, 'get_yaxis': <function Plottable.get_yaxis>, 'labels': <classmethod object>, 'setLabel': <function Plottable.setLabel>, 'set_View': <function Plottable.set_View>, 'reset_view': <function Plottable.reset_view>, 'render': <function Plottable.render>, 'is_empty': <function Plottable.is_empty>, 'colors': <function Plottable.colors>, 'transformView': <function Plottable.transformView>, 'returnValuesOfView': <function Plottable.returnValuesOfView>, 'check_data_PlottableX': <function Plottable.check_data_PlottableX>, 'check_data_PlottableY': <function Plottable.check_data_PlottableY>, 'transformX': <function Plottable.transformX>, 'transformY': <function Plottable.transformY>, 'onReset': <function Plottable.onReset>, 'onFitRange': <function Plottable.onFitRange>, '__dict__': <attribute '__dict__' of 'Plottable' objects>, '__weakref__': <attribute '__weakref__' of 'Plottable' objects>, '__annotations__': {}})¶
- __doc__ = '\n '¶
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- __setattr__(name, value)[source]¶
Take care of changes in View when data is changed. This method is provided for backward compatibility.
- __weakref__¶
list of weak references to the object (if defined)
- check_data_PlottableX()[source]¶
Since no transformation is made for log10(x), check that no negative values is plot in log scale
- check_data_PlottableY()[source]¶
Since no transformation is made for log10(y), check that no negative values is plot in log scale
- custom_color = None¶
- dx = None¶
- dy = None¶
- interactive = True¶
- classmethod labels(collection)[source]¶
Construct a set of unique labels for a collection of plottables of the same type.
Returns a map from plottable to name.
- markersize = 3¶
- name = None¶
- onFitRange(xmin=None, xmax=None)[source]¶
It limits View data range to plot from min to max
- Parameters:
xmin – the minimum value of x to plot.
xmax – the maximum value of x to plot
- render(plot)[source]¶
The base class makes sure the correct units are being used for subsequent plottable.
For now it is assumed that the graphs are commensurate, and if you put a Qx object on a Temperature graph then you had better hope that it makes sense.
- setLabel(labelx, labely)[source]¶
It takes a label of the x and y transformation and set View parameters
- Parameters:
transx – The label of x transformation is sent by Properties Dialog
transy – The label of y transformation is sent Properties Dialog
- short_name = None¶
- show_yzero = False¶
- transformX(transx, transdx)[source]¶
Receive pointers to function that transform x and dx and set corresponding View pointers
- Parameters:
transx – pointer to function that transforms x
transdx – pointer to function that transforms dx
- transformY(transy, transdy)[source]¶
Receive pointers to function that transform y and dy and set corresponding View pointers
- Parameters:
transy – pointer to function that transforms y
transdy – pointer to function that transforms dy
- x = None¶
- xaxis(name, units)[source]¶
Set the name and unit of x_axis
- Parameters:
name – the name of x-axis
units – the units of x_axis
- y = None¶
- class sas.qtgui.Plotting.Plottables.PlottableData1D(x, y, dx=None, dy=None)[source]¶
Bases:
Plottable
Data plottable: scatter plot of x,y with errors in x and y.
- __doc__ = '\n Data plottable: scatter plot of x,y with errors in x and y.\n '¶
- __init__(x, y, dx=None, dy=None)[source]¶
Draw points specified by x[i],y[i] in the current color/symbol. Uncertainty in x is given by dx[i], or by (xlo[i],xhi[i]) if the uncertainty is asymmetric. Similarly for y uncertainty.
The title appears on the legend. The label, if it is different, appears on the status bar.
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- class sas.qtgui.Plotting.Plottables.PlottableData2D(image=None, qx_data=None, qy_data=None, err_image=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)[source]¶
Bases:
Plottable
2D data class for image plotting
- __doc__ = '\n 2D data class for image plotting\n '¶
- __init__(image=None, qx_data=None, qy_data=None, err_image=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)[source]¶
Draw image
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- class sas.qtgui.Plotting.Plottables.PlottableFit1D(data=None, theory=None)[source]¶
Bases:
Plottable
Fit plottable: composed of a data line plus a theory line. This is treated like a single object from the perspective of the graph, except that it will have two legend entries, one for the data and one for the theory.
The color of the data and theory will be shared.
- __doc__ = '\n Fit plottable: composed of a data line plus a theory line. This\n is treated like a single object from the perspective of the graph,\n except that it will have two legend entries, one for the data and\n one for the theory.\n\n The color of the data and theory will be shared.\n\n '¶
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- class sas.qtgui.Plotting.Plottables.PlottableTheory1D(x, y, dy=None)[source]¶
Bases:
Plottable
Theory plottable: line plot of x,y with confidence interval y.
- __doc__ = '\n Theory plottable: line plot of x,y with confidence interval y.\n '¶
- __init__(x, y, dy=None)[source]¶
Draw lines specified in x[i],y[i] in the current color/symbol. Confidence intervals in x are given by dx[i] or by (xlo[i],xhi[i]) if the limits are asymmetric.
The title is the name that will show up on the legend.
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- class sas.qtgui.Plotting.Plottables.Text(text=None, xpos=0.5, ypos=0.9, name='text')[source]¶
Bases:
Plottable
- __doc__ = '\n '¶
- __init__(text=None, xpos=0.5, ypos=0.9, name='text')[source]¶
Draw the user-defined text in plotter We can specify the position of text
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- class sas.qtgui.Plotting.Plottables.Transform[source]¶
Bases:
object
Define a transform plugin to the plottable architecture.
Transforms operate on axes. The plottable defines the set of transforms available for it, and the axes on which they operate. These transforms can operate on the x axis only, the y axis only or on the x and y axes together.
This infrastructure is not able to support transformations such as log and polar plots as these require full control over the drawing of axes and grids.
A transform has a number of attributes.
- name
user visible name for the transform. This will appear in the context menu for the axis and the transform menu for the graph.
- type
operational axis. This determines whether the transform should appear on x,y or z axis context menus, or if it should appear in the context menu for the graph.
- inventory
(not implemented) a dictionary of user settable parameter names and their associated types. These should appear as keyword arguments to the transform call. For example, Fresnel reflectivity requires the substrate density:
{ 'rho': type.Value(10e-6/units.angstrom**2) }
Supply reasonable defaults in the callback so that limited plotting clients work even though they cannot set the inventory.
- __call__(plottable, **kwargs)[source]¶
Transform the data. Whenever a plottable is added to the axes, the infrastructure will apply all required transforms. When the user selects a different representation for the axes (via menu, script, or context menu), all plottables on the axes will be transformed. The plottable should store the underlying data but set the standard x,dx,y,dy,z,dz attributes appropriately.
If the call raises a NotImplemented error the dataline will not be plotted. The associated string will usually be ‘Not a valid transform’, though other strings are possible. The application may or may not display the message to the user, along with an indication of which plottable was at fault.
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Plottables', '__doc__': "\n Define a transform plugin to the plottable architecture.\n\n Transforms operate on axes. The plottable defines the\n set of transforms available for it, and the axes on which\n they operate. These transforms can operate on the x axis\n only, the y axis only or on the x and y axes together.\n\n This infrastructure is not able to support transformations\n such as log and polar plots as these require full control\n over the drawing of axes and grids.\n\n A transform has a number of attributes.\n\n name\n user visible name for the transform. This will\n appear in the context menu for the axis and the transform\n menu for the graph.\n\n type\n operational axis. This determines whether the\n transform should appear on x,y or z axis context\n menus, or if it should appear in the context menu for\n the graph.\n\n inventory\n (not implemented)\n a dictionary of user settable parameter names and\n their associated types. These should appear as keyword\n arguments to the transform call. For example, Fresnel\n reflectivity requires the substrate density:\n ``{ 'rho': type.Value(10e-6/units.angstrom**2) }``\n Supply reasonable defaults in the callback so that\n limited plotting clients work even though they cannot\n set the inventory.\n\n ", '__call__': <function Transform.__call__>, '__dict__': <attribute '__dict__' of 'Transform' objects>, '__weakref__': <attribute '__weakref__' of 'Transform' objects>, '__annotations__': {}})¶
- __doc__ = "\n Define a transform plugin to the plottable architecture.\n\n Transforms operate on axes. The plottable defines the\n set of transforms available for it, and the axes on which\n they operate. These transforms can operate on the x axis\n only, the y axis only or on the x and y axes together.\n\n This infrastructure is not able to support transformations\n such as log and polar plots as these require full control\n over the drawing of axes and grids.\n\n A transform has a number of attributes.\n\n name\n user visible name for the transform. This will\n appear in the context menu for the axis and the transform\n menu for the graph.\n\n type\n operational axis. This determines whether the\n transform should appear on x,y or z axis context\n menus, or if it should appear in the context menu for\n the graph.\n\n inventory\n (not implemented)\n a dictionary of user settable parameter names and\n their associated types. These should appear as keyword\n arguments to the transform call. For example, Fresnel\n reflectivity requires the substrate density:\n ``{ 'rho': type.Value(10e-6/units.angstrom**2) }``\n Supply reasonable defaults in the callback so that\n limited plotting clients work even though they cannot\n set the inventory.\n\n "¶
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- __weakref__¶
list of weak references to the object (if defined)
- class sas.qtgui.Plotting.Plottables.View(x=None, y=None, dx=None, dy=None)[source]¶
Bases:
object
Representation of the data that might include a transformation
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Plottables', '__doc__': '\n Representation of the data that might include a transformation\n ', 'x': None, 'y': None, 'dx': None, 'dy': None, '__init__': <function View.__init__>, 'transform': <function View.transform>, 'onResetView': <function View.onResetView>, 'setTransformX': <function View.setTransformX>, 'setTransformY': <function View.setTransformY>, 'returnXview': <function View.returnXview>, 'check_data_logX': <function View.check_data_logX>, 'check_data_logY': <function View.check_data_logY>, 'onFitRangeView': <function View.onFitRangeView>, '__dict__': <attribute '__dict__' of 'View' objects>, '__weakref__': <attribute '__weakref__' of 'View' objects>, '__annotations__': {}})¶
- __doc__ = '\n Representation of the data that might include a transformation\n '¶
- __module__ = 'sas.qtgui.Plotting.Plottables'¶
- __weakref__¶
list of weak references to the object (if defined)
- check_data_logX()[source]¶
Remove negative value in x vector to avoid plotting negative value of Log10
- check_data_logY()[source]¶
Remove negative value in y vector to avoid plotting negative value of Log10
- dx = None¶
- dy = None¶
- onFitRangeView(xmin=None, xmax=None)[source]¶
It limits View data range to plot from min to max
- Parameters:
xmin – the minimum value of x to plot.
xmax – the maximum value of x to plot
- onResetView()[source]¶
Reset x,y,dx and y in their full range and in the initial scale in case their previous range has changed
- setTransformX(funcx, funcdx)[source]¶
Receive pointers to function that transform x and dx and set corresponding View pointers
- Parameters:
transx – pointer to function that transforms x
transdx – pointer to function that transforms dx
- setTransformY(funcy, funcdy)[source]¶
Receive pointers to function that transform y and dy and set corresponding View pointers
- Parameters:
transx – pointer to function that transforms y
transdx – pointer to function that transforms dy
- transform(x=None, y=None, dx=None, dy=None)[source]¶
- Transforms the x,y,dx and dy vectors and stores
the output in View parameters
- Parameters:
x – array of x values
y – array of y values
dx – array of errors values on x
dy – array of error values on y
- x = None¶
- y = None¶
sas.qtgui.Plotting.Plotter module¶
- class sas.qtgui.Plotting.Plotter.Plotter(parent=None, quickplot=False)[source]¶
Bases:
QDialog
,PlotterWidget
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.Plotter'¶
- class sas.qtgui.Plotting.Plotter.PlotterWidget(parent=None, manager=None, quickplot=False)[source]¶
Bases:
PlotterBase
1D Plot widget for use with a QDialog
- __doc__ = '\n 1D Plot widget for use with a QDialog\n '¶
- __module__ = 'sas.qtgui.Plotting.Plotter'¶
- _pan_handler(event)[source]¶
Explicitly call toolbar method to ensure range is changed. In MPL 2.2, local events take precedence over the toolbar events, so the range isn’t panned until after _zoom_pan_handler is run.
- _zoom_handler(event)[source]¶
Explicitly call toolbar method to ensure range is changed. In MPL 2.2, local events take precedence over the toolbar events, so the range isn’t zoomed until after _zoom_pan_handler is run.
- createContextMenuQuick()[source]¶
Define context menu and associated actions for the quickplot MPL widget
- property data¶
data getter
- onMplMouseMotion(event)[source]¶
Check if the left button is press and the mouse in moving. Compute delta for x and y coordinates and then perform the drag
- plot(data=None, color=None, marker=None, hide_error=False, transform=True)[source]¶
Add a new plot of self._data to the chart.
sas.qtgui.Plotting.Plotter2D module¶
- class sas.qtgui.Plotting.Plotter2D.Plotter2D(parent=None, quickplot=False, dimension=2)[source]¶
Bases:
QDialog
,Plotter2DWidget
Plotter widget implementation
- __doc__ = '\n Plotter widget implementation\n '¶
- __module__ = 'sas.qtgui.Plotting.Plotter2D'¶
- class sas.qtgui.Plotting.Plotter2D.Plotter2DWidget(parent=None, manager=None, quickplot=False, dimension=2)[source]¶
Bases:
PlotterBase
2D Plot widget for use with a QDialog
- __doc__ = '\n 2D Plot widget for use with a QDialog\n '¶
- __module__ = 'sas.qtgui.Plotting.Plotter2D'¶
- createContextMenuQuick()[source]¶
Define context menu and associated actions for the quickplot MPL widget
- property data¶
data getter
- property data0¶
- imageShow(img, origin=None)[source]¶
Show background image :Param img: [imread(path) from matplotlib.pyplot]
- plot(data=None, marker=None, show_colorbar=True, update=False)[source]¶
Plot 2D self._data marker - unused
- replacePlot(id, new_plot)[source]¶
Replace data in current chart. This effectively refreshes the chart with changes to one of its plots
- setSlicer(slicer, reset=True)[source]¶
Clear the previous slicer and create a new one. slicer: slicer class to create
sas.qtgui.Plotting.PlotterBase module¶
- class sas.qtgui.Plotting.PlotterBase.PlotterBase(parent=None, manager=None, quickplot=False)[source]¶
Bases:
QWidget
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.PlotterBase'¶
- createContextMenuQuick()[source]¶
Define context menu and associated actions for the quickplot MPL widget
- property data¶
data getter
- property item¶
getter for this plot’s QStandardItem
- property showLegend¶
Legend visibility getter
- update(self)[source]¶
- update(self, a0: QRect) None
- update(self, a0: QRegion) None
- update(self, ax: int, ay: int, aw: int, ah: int) None
- property xLabel¶
x-label setter
- property xscale¶
X-axis scale getter
- property yLabel¶
y-label setter
- property yscale¶
Y-axis scale getter
sas.qtgui.Plotting.PlotterData module¶
Adapters for fitting module
- class sas.qtgui.Plotting.PlotterData.Data1D(x=None, y=None, dx=None, dy=None)[source]¶
Bases:
PlottableData1D
,Data1D
- ROLE_DATA = 0¶
- ROLE_DEFAULT = 1¶
- ROLE_DELETABLE = 2¶
- ROLE_RESIDUAL = 3¶
- __doc__ = '\n '¶
- __module__ = 'sas.qtgui.Plotting.PlotterData'¶
- class sas.qtgui.Plotting.PlotterData.Data2D(image=None, err_image=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)[source]¶
Bases:
PlottableData2D
,Data2D
- __doc__ = '\n '¶
- __init__(image=None, err_image=None, qx_data=None, qy_data=None, q_data=None, mask=None, dqx_data=None, dqy_data=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None)[source]¶
- __module__ = 'sas.qtgui.Plotting.PlotterData'¶
- _perform_operation(other, operation)[source]¶
Perform 2D operations between data sets
- Parameters:
other – other data set
operation – function defining the operation
sas.qtgui.Plotting.QRangeSlider module¶
Double slider interactor for setting the Q range for a fit or function
- class sas.qtgui.Plotting.QRangeSlider.LineInteractor(base: Plotter, axes: Plotter.ax, color: str = 'black', zorder: int = 5, x: float = 0.5, y: float = 0.5, input: [str] = None, setter: [str] = None, getter: [str] = None, perspective: str = None, tab: str = None)[source]¶
Bases:
BaseInteractor
Draw a single vertical line that can be dragged on a plot
- __doc__ = '\n Draw a single vertical line that can be dragged on a plot\n '¶
- __init__(base: Plotter, axes: Plotter.ax, color: str = 'black', zorder: int = 5, x: float = 0.5, y: float = 0.5, input: [str] = None, setter: [str] = None, getter: [str] = None, perspective: str = None, tab: str = None) None [source]¶
Initialize the line interactor object
- __module__ = 'sas.qtgui.Plotting.QRangeSlider'¶
- _get_input_or_callback(connection_list: [str] = None) QLineEdit | QTextEdit | None [source]¶
Returns an input or callback method based on a list of inputs/commands
- draw(zorder: int = 5) None [source]¶
Draw the line and marker on the linked plot using the latest x and y values
- property getter: callable | None¶
Get the x-value getter method associated with this slider
- property input: QLineEdit | QTextEdit | None¶
Get the text input that should be linked to the position of this slider
- inputChanged() None [source]¶
Track the input linked to the x value for this slider and update as needed
- move(x: float, y: float, ev: QEvent) None [source]¶
Process move to a new position, making sure that the move is allowed.
- property setter: callable | None¶
Get the x-value setter method associated with this slider
- class sas.qtgui.Plotting.QRangeSlider.QRangeSlider(base: Plotter, axes: Plotter.ax, color: str = 'black', zorder: int = 5, data: Data1D = None)[source]¶
Bases:
BaseInteractor
Draw a pair of draggable vertical lines. Each line can be linked to a GUI input. The GUI input should update the lines and vice-versa.
- __doc__ = ' Draw a pair of draggable vertical lines. Each line can be linked to a GUI input.\n The GUI input should update the lines and vice-versa.\n '¶
- __init__(base: Plotter, axes: Plotter.ax, color: str = 'black', zorder: int = 5, data: Data1D = None) None [source]¶
Initialize the slideable lines and associated markers
- __module__ = 'sas.qtgui.Plotting.QRangeSlider'¶
sas.qtgui.Plotting.ScaleProperties module¶
- class sas.qtgui.Plotting.ScaleProperties.ScaleProperties(parent=None, init_scale_x='x', init_scale_y='y')[source]¶
Bases:
QDialog
,Ui_scalePropertiesUI
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.ScaleProperties'¶
sas.qtgui.Plotting.SetGraphRange module¶
Allows users to change the range of the current graph
- class sas.qtgui.Plotting.SetGraphRange.SetGraphRange(parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0))[source]¶
Bases:
QDialog
,Ui_setGraphRangeUI
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.SetGraphRange'¶
sas.qtgui.Plotting.SlicerModel module¶
- class sas.qtgui.Plotting.SlicerModel.SlicerModel[source]¶
Bases:
object
- __dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.SlicerModel', '__init__': <function SlicerModel.__init__>, 'setModelFromParams': <function SlicerModel.setModelFromParams>, 'setParamsFromModel': <function SlicerModel.setParamsFromModel>, 'setParamsFromModelItem': <function SlicerModel.setParamsFromModelItem>, 'model': <function SlicerModel.model>, 'getParams': <function SlicerModel.getParams>, 'setParams': <function SlicerModel.setParams>, 'validate': <function SlicerModel.validate>, '__dict__': <attribute '__dict__' of 'SlicerModel' objects>, '__weakref__': <attribute '__weakref__' of 'SlicerModel' objects>, '__doc__': None, '__annotations__': {}})¶
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.SlicerModel'¶
- __weakref__¶
list of weak references to the object (if defined)
sas.qtgui.Plotting.SlicerParameters module¶
Allows users to modify the box slicer parameters.
- class sas.qtgui.Plotting.SlicerParameters.EditDelegate(parent=None, validate_method=None)[source]¶
Bases:
QStyledItemDelegate
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.SlicerParameters'¶
- createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) QWidget [source]¶
- refocus_signal¶
- class sas.qtgui.Plotting.SlicerParameters.PositiveDoubleEditor(parent=None)[source]¶
Bases:
QLineEdit
- __doc__ = None¶
- __module__ = 'sas.qtgui.Plotting.SlicerParameters'¶
- editingFinished¶
- class sas.qtgui.Plotting.SlicerParameters.ProxyModel(parent=None)[source]¶
Bases:
QIdentityProxyModel
Trivial proxy model with custom column edit flag
- __doc__ = '\n Trivial proxy model with custom column edit flag\n '¶
- __module__ = 'sas.qtgui.Plotting.SlicerParameters'¶
- class sas.qtgui.Plotting.SlicerParameters.SlicerParameters(parent=None, model=None, active_plots=None, validate_method=None, communicator=None)[source]¶
Bases:
QDialog
,Ui_SlicerParametersUI
Interaction between the QTableView and the underlying model, passed from a slicer instance.
- __doc__ = '\n Interaction between the QTableView and the underlying model,\n passed from a slicer instance.\n '¶
- __init__(parent=None, model=None, active_plots=None, validate_method=None, communicator=None)[source]¶
- __module__ = 'sas.qtgui.Plotting.SlicerParameters'¶
- closeEvent(event)[source]¶
Overwritten close widget method in order to send the close signal to the parent.
- closeWidgetSignal¶
- getCurrentPlotDict()[source]¶
Returns a dictionary of currently shown plots {plot_name:checkbox_status}
sas.qtgui.Plotting.WindowTitle module¶
Allows users to change the title of the current graph from “Graph_n” to any ASCII text.
- class sas.qtgui.Plotting.WindowTitle.WindowTitle(parent=None, new_title='')[source]¶
Bases:
QDialog
,Ui_WindowTitle
Simple GUI for a single line text query
- __doc__ = ' Simple GUI for a single line text query '¶
- __module__ = 'sas.qtgui.Plotting.WindowTitle'¶
sas.qtgui.Plotting.rangeSlider module¶
- class sas.qtgui.Plotting.rangeSlider.RangeSlider(*args)[source]¶
Bases:
QSlider
A slider for ranges.
This class provides a dual-slider for ranges, where there is a defined maximum and minimum, as is a normal slider, but instead of having a single slider value, there are 2 slider values.
This class emits the same signals as the QSlider base class, with the exception of valueChanged.
In addition, two new signals are emitted to catch the movement of each handle, lowValueChanged(int) and highValueChanged(int).
- __doc__ = ' A slider for ranges.\n \n This class provides a dual-slider for ranges, where there is a defined\n maximum and minimum, as is a normal slider, but instead of having a\n single slider value, there are 2 slider values.\n \n This class emits the same signals as the QSlider base class, with the \n exception of valueChanged. \n\n In addition, two new signals are emitted to catch the movement of \n each handle, lowValueChanged(int) and highValueChanged(int).\n '¶
- __module__ = 'sas.qtgui.Plotting.rangeSlider'¶
- __pick(pt)¶
- __pixelPosToRangeValue(pos)¶
- highValueChanged¶
- lowValueChanged¶