sas.qtgui.Plotting.Slicers package

Submodules

sas.qtgui.Plotting.Slicers.AnnulusSlicer module

class sas.qtgui.Plotting.Slicers.AnnulusSlicer.AnnulusInteractor(base, axes, item=None, color='black', zorder=3)

Bases: BaseInteractor, SlicerModel

AnnulusInteractor plots a data1D average of an annulus area defined in a Data2D object. The data1D averaging itself is performed in sasdata by manipulations.py

This class uses the RingInteractor class to define two rings of radius r1 and r2 (Q1 and Q2). All Q points at a constant angle phi from the x-axis are averaged together to provide a 1D array in phi from 0 to 180 degrees.

__annotations__ = {}
__doc__ = '\n    AnnulusInteractor plots a data1D average of an annulus area defined in a\n    Data2D object. The data1D averaging itself is performed in sasdata by\n    manipulations.py\n\n    This class uses the RingInteractor class to define two rings of radius\n    r1 and r2 (Q1 and Q2). All Q points at a constant angle phi from the x-axis\n    are averaged together to provide a 1D array in phi from 0 to 180 degrees.\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.AnnulusSlicer'
_post_data(nbins=None)

Uses annulus parameters to plot averaged data into 1D data.

Parameters:

nbins – the number of points to plot

clear()

Clear the slicer and all connected events related to this slicer

draw()
getParams()

Store a copy of values of parameters of the slicer into a dictionary. :return params: the dictionary created

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)

Called when any dragging motion ends. Redraw the plot with new parameters.

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)

Receive a dictionary and reset the slicer with values contained in the values of the dictionary.

Parameters:

params – a dictionary containing name of slicer parameters and values the user assigned to the slicer.

set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel :param n: the number of layer

update()

Respond to changes in the model by recalculating the profiles and resetting the widgets.

validate(param_name, param_value)

Test the proposed new value “value” for row “row” of parameters

class sas.qtgui.Plotting.Slicers.AnnulusSlicer.RingInteractor(base, axes, color='black', zorder=5, r=1.0, sign=1)

Bases: BaseInteractor

Draw a ring on a data2D plot centered at (0,0) given a radius

__annotations__ = {}
__doc__ = '\n     Draw a ring on a data2D plot centered at (0,0) given a radius\n    '
__init__(base, axes, color='black', zorder=5, r=1.0, sign=1)
Param:

the color of the line that defined the ring

Parameters:
  • r – the radius of the ring

  • sign – the direction of motion the marker

__module__ = 'sas.qtgui.Plotting.Slicers.AnnulusSlicer'
clear()

Clear the slicer and all connected events related to this slicer

getParams()

Store a copy of values of parameters of the slicer into a dictionary. :return params: the dictionary created

get_radius()
Return self._inner_mouse_x:

the current radius of the ring

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)

Called after a dragging motion

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)

Receive a dictionary and reset the slicer with values contained in the values of the dictionary.

Parameters:

params – a dictionary containing name of slicer parameters and values the user assigned to the slicer.

set_cursor(x, y)

draw the ring given x, y value

set_layer(n)

Allow adding plot to the same panel

Parameters:

n – the number of layer

update()

Draw the new roughness on the graph.

sas.qtgui.Plotting.Slicers.ArcInteractor module

class sas.qtgui.Plotting.Slicers.ArcInteractor.ArcInteractor(base, axes, color='black', zorder=5, r=1.0, theta=1.0471975511965976, phi=0.39269908169872414)

Bases: BaseInteractor

Draw an arc on a data2D plot with a variable radius (centered at [0,0]). User interaction adjusts the parameter r

param r: radius from (0,0) of the arc on a data2D plot param theta: angle from x-axis of the central point on the arc param phi: angle from the centre point on the arc to each of its edges

__annotations__ = {}
__doc__ = '\n    Draw an arc on a data2D plot with a variable radius (centered at [0,0]).\n    User interaction adjusts the parameter r\n\n    param r: radius from (0,0) of the arc on a data2D plot\n    param theta: angle from x-axis of the central point on the arc\n    param phi: angle from the centre point on the arc to each of its edges\n    '
__init__(base, axes, color='black', zorder=5, r=1.0, theta=1.0471975511965976, phi=0.39269908169872414)
__module__ = 'sas.qtgui.Plotting.Slicers.ArcInteractor'
clear()

Clear this slicer and its markers

move(x, y, ev)

Process move to a new position.

moveend(ev)

After a dragging motion reset the flag self.has_move to False :param ev: event

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel :param n: the number of layer

update(theta=None, phi=None, r=None)

Draw the new roughness on the graph. :param theta: angle from x-axis of the central point on the arc :param phi: angle from the centre point on the arc to each of its edges :param r: radius from (0,0) of the arc on a data2D plot

sas.qtgui.Plotting.Slicers.BaseInteractor module

class sas.qtgui.Plotting.Slicers.BaseInteractor.BaseInteractor(base, axes, color='black')

Bases: object

Share some functions between the interface interactor and various layer interactors.

Individual interactors need the following functions:

save(ev) - save the current state for later restore restore() - restore the old state move(x,y,ev) - move the interactor to position x,y moveend(ev) - end the drag event update() - draw the interactors

The following are provided by the base class:

connect_markers(markers) - register callbacks for all markers clear_markers() - remove all items in self.markers onHilite(ev) - enter/leave event processing onLeave(ev) - enter/leave event processing onClick(ev) - mouse click: calls save() onRelease(ev) - mouse click ends: calls moveend() onDrag(ev) - mouse move: calls move() or restore() onKey(ev) - keyboard move: calls move() or restore()

Interactor attributes:

base - model we are operating on axes - axes holding the interactor color - color of the interactor in non-active state markers - list of handles for the interactor

__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'sas.qtgui.Plotting.Slicers.BaseInteractor', '__doc__': '\n    Share some functions between the interface interactor and various layer\n    interactors.\n\n    Individual interactors need the following functions:\n\n        save(ev)  - save the current state for later restore\n        restore() - restore the old state\n        move(x,y,ev) - move the interactor to position x,y\n        moveend(ev) - end the drag event\n        update() - draw the interactors\n\n    The following are provided by the base class:\n\n        connect_markers(markers) - register callbacks for all markers\n        clear_markers() - remove all items in self.markers\n        onHilite(ev) - enter/leave event processing\n        onLeave(ev) - enter/leave event processing\n        onClick(ev) - mouse click: calls save()\n        onRelease(ev) - mouse click ends: calls moveend()\n        onDrag(ev) - mouse move: calls move() or restore()\n        onKey(ev) - keyboard move: calls move() or restore()\n\n    Interactor attributes:\n\n        base  - model we are operating on\n        axes  - axes holding the interactor\n        color - color of the interactor in non-active state\n        markers - list of handles for the interactor\n\n    ', '__init__': <function BaseInteractor.__init__>, 'clear_markers': <function BaseInteractor.clear_markers>, 'save': <function BaseInteractor.save>, 'restore': <function BaseInteractor.restore>, 'move': <function BaseInteractor.move>, 'moveend': <function BaseInteractor.moveend>, 'connect_markers': <function BaseInteractor.connect_markers>, 'onHilite': <function BaseInteractor.onHilite>, 'onLeave': <function BaseInteractor.onLeave>, 'onClick': <function BaseInteractor.onClick>, 'onRelease': <function BaseInteractor.onRelease>, 'onDrag': <function BaseInteractor.onDrag>, 'onKey': <function BaseInteractor.onKey>, 'dpixel': <function BaseInteractor.dpixel>, '__dict__': <attribute '__dict__' of 'BaseInteractor' objects>, '__weakref__': <attribute '__weakref__' of 'BaseInteractor' objects>, '__annotations__': {}})
__doc__ = '\n    Share some functions between the interface interactor and various layer\n    interactors.\n\n    Individual interactors need the following functions:\n\n        save(ev)  - save the current state for later restore\n        restore() - restore the old state\n        move(x,y,ev) - move the interactor to position x,y\n        moveend(ev) - end the drag event\n        update() - draw the interactors\n\n    The following are provided by the base class:\n\n        connect_markers(markers) - register callbacks for all markers\n        clear_markers() - remove all items in self.markers\n        onHilite(ev) - enter/leave event processing\n        onLeave(ev) - enter/leave event processing\n        onClick(ev) - mouse click: calls save()\n        onRelease(ev) - mouse click ends: calls moveend()\n        onDrag(ev) - mouse move: calls move() or restore()\n        onKey(ev) - keyboard move: calls move() or restore()\n\n    Interactor attributes:\n\n        base  - model we are operating on\n        axes  - axes holding the interactor\n        color - color of the interactor in non-active state\n        markers - list of handles for the interactor\n\n    '
__init__(base, axes, color='black')
__module__ = 'sas.qtgui.Plotting.Slicers.BaseInteractor'
__weakref__

list of weak references to the object

clear_markers()

Clear old markers and interfaces.

connect_markers(markers)

Connect markers to callbacks

dpixel(x, y, nudge=False)

Return the step size in data coordinates for a small step in screen coordinates. If nudge is False (default) the step size is one pixel. If nudge is True, the step size is 0.2 pixels.

move(x, y, ev)
moveend(ev)
onClick(ev)

Prepare to move the artist. Calls save() to preserve the state for later restore().

onDrag(ev)

Move the artist. Calls move() to update the state, or restore() if the mouse leaves the window.

onHilite(ev)

Hilite the artist reporting the event, indicating that it is ready to receive a click.

onKey(ev)

Respond to keyboard events. Arrow keys move the widget. Escape restores it to the position before the last click.

Calls move() to update the state. Calls restore() on escape.

onLeave(ev)

Restore the artist to the original colour when the cursor leaves.

onRelease(ev)
restore(ev)
save(ev)

sas.qtgui.Plotting.Slicers.BoxSlicer module

class sas.qtgui.Plotting.Slicers.BoxSlicer.BoxInteractor(base, axes, item=None, color='black', zorder=3, direction=None)

Bases: BaseInteractor, SlicerModel

BoxInteractor plots a data1D average of a rectangular area defined in a Data2D object. The data1D averaging itself is performed in sasdata by manipulations.py

This class uses two other classes, HorizontalLines and VerticalLines, to define the rectangle area: x1, x2 ,y1, y2. It is subclassed by BoxInteractorX and BoxInteracgtorY which define the direction of the average. BoxInteractorX averages all the points from y1 to y2 as a function of Q_x and BoxInteractorY averages all the points from x1 to x2 as a function of Q_y

__annotations__ = {}
__doc__ = '\n    BoxInteractor plots a data1D average of a rectangular area defined in\n    a Data2D object. The data1D averaging itself is performed in sasdata\n    by manipulations.py\n\n    This class uses two other classes, HorizontalLines and VerticalLines,\n    to define the rectangle area: x1, x2 ,y1, y2. It is subclassed by\n    BoxInteractorX and BoxInteracgtorY which define the direction of the\n    average. BoxInteractorX averages all the points from y1 to y2 as a\n    function of Q_x and BoxInteractorY averages all the points from\n    x1 to x2 as a function of Q_y\n    '
__init__(base, axes, item=None, color='black', zorder=3, direction=None)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSlicer'
_post_data(new_slab=None, nbins=None, direction=None)

post 1D data averaging in Qx or Qy given new_slab type

Parameters:
  • new_slab – slicer that determine with direction to average

  • nbins – the number of points plotted when averaging

  • direction – the direction of averaging

clear()

Clear the slicer and all connected events related to this slicer

draw()

Draws the Canvas using the canvas.Draw from the calling class that instantiated this object.

getParams()

Store a copy of values of parameters of the slicer into a dictionary.

Return params:

the dictionary created

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)

Called after a dragging event. Post the slicer new parameters and creates a new Data1D corresponding to the new average

restore(ev)

Restore the roughness for this layer. Only restores things that have moved. Otherwise you are restoring too far back.

Save is only done when the mouse is clicked not when it is released. Thus, if vertical lines have changed, they will move horizontal lines also, but the original state of those horizontal lines has not been saved (there was no click event on the horizontal lines). However, restoring the vertical lines and then doing an updated will take care of the related values in horizontal lines.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)

Receive a dictionary and reset the slicer with values contained in the values of the dictionary.

Parameters:

params – a dictionary containing name of slicer parameters and values the user assigned to the slicer.

set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel

Parameters:

n – the number of layer

update()

Respond to changes in the model by recalculating the profiles and resetting the widgets.

update_and_post()

Update the slicer and plot the resulting data

validate(param_name, param_value)

Validate input from user. Values get checked at apply time. * nbins cannot be zero or samller * The full ROI should stay within the data. thus center_x and center_y

are restricted such that the center +/- width (or height) cannot be greate or smaller than data max/min.

  • The width/height should not be set so small as to leave no data in the ROI. Here we only make sure that the width/height is not zero as done when dragging the vertical or horizontal lines. We let the call to _post_data capture the ValueError of no points in ROI raised by manipulations.py, log the message and negate the entry at that point.

class sas.qtgui.Plotting.Slicers.BoxSlicer.BoxInteractorX(base, axes, item=None, color='black', zorder=3)

Bases: BoxInteractor

Average in Qx direction. The data for all Qy at a constant Qx are averaged together to provide a 1D array in Qx (to be plotted as a function of Qx)

__annotations__ = {}
__doc__ = '\n    Average in Qx direction. The data for all Qy at a constant Qx are\n    averaged together to provide a 1D array in Qx (to be plotted as a function\n    of Qx)\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSlicer'
_post_data(new_slab=None, nbins=None, direction=None)

Post data creating by averaging in Qx direction

class sas.qtgui.Plotting.Slicers.BoxSlicer.BoxInteractorY(base, axes, item=None, color='black', zorder=3)

Bases: BoxInteractor

Average in Qy direction. The data for all Qx at a constant Qy are averaged together to provide a 1D array in Qy (to be plotted as a function of Qy)

__annotations__ = {}
__doc__ = '\n    Average in Qy direction. The data for all Qx at a constant Qy are\n    averaged together to provide a 1D array in Qy (to be plotted as a function\n    of Qy)\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSlicer'
_post_data(new_slab=None, nbins=None, direction=None)

Post data creating by averaging in Qy direction

class sas.qtgui.Plotting.Slicers.BoxSlicer.HorizontalDoubleLine(base, axes, color='black', zorder=5, half_width=0.5, half_height=0.5, center_x=0.0, center_y=0.0)

Bases: BaseInteractor

Draw 2 vertical lines that can move symmetrically in opposite directions in y and centered on a point (PointInteractor). It also defines the left and right x positions of a box.

__annotations__ = {}
__doc__ = '\n    Draw 2 vertical lines that can move symmetrically in opposite directions in y and centered on\n    a point (PointInteractor). It also defines the left and right x positions of a box.\n    '
__init__(base, axes, color='black', zorder=5, half_width=0.5, half_height=0.5, center_x=0.0, center_y=0.0)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSlicer'
clear()

Clear this figure and its markers

move(x, y, ev)

Process move to a new position, making sure that the move is allowed. In principle, the move must not create a box without any data points in it. For the dragging (continuous move), we make sure that the width or height are not negative and that the entire ROI resides withing the data. We leave the check of whether there are any data in that ROI to the manipulations.py which is called from _post_data, itself being called on moveend(ev).

moveend(ev)

After a dragging motion update the 1D average plot and then reset the flag self.has_move to False.

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc. This save is run on mouse click (not a drag event) by BaseInteractor

setCursor(x, y)

Update the figure given x and y

setLayer(n)

Allow adding plot to the same panel @param n: the number of layer

update(x1=None, x2=None, y1=None, y2=None, half_width=None, half_height=None, center=None)

Draw the new roughness on the graph. :param x1: new maximum value of x coordinates :param x2: new minimum value of x coordinates :param y1: new maximum value of y coordinates :param y2: new minimum value of y coordinates :param half_width: is the half width of the new rectangle :param half_height: is the half height of the new rectangle :param center: provided x, y coordinates of the center point

class sas.qtgui.Plotting.Slicers.BoxSlicer.PointInteractor(base, axes, color='black', zorder=5, center_x=0.0, center_y=0.0)

Bases: BaseInteractor

Draw a point that can be dragged with the marker. this class controls the motion the center of the BoxSum

__annotations__ = {}
__doc__ = '\n    Draw a point that can be dragged with the marker.\n    this class controls the motion the center of the BoxSum\n    '
__init__(base, axes, color='black', zorder=5, center_x=0.0, center_y=0.0)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSlicer'
clear()

Clear this figure and its markers

move(x, y, ev)

Process move to a new position. BaseInteractor checks that the center is within the data. Here we check to make sure that the center move does not cause any part of the ROI box to move outside the data.

moveend(ev)
restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setCursor(x, y)
..todo:: the cursor moves are currently being captured somewhere upstream

of BaseInteractor so this never gets called.

setLayer(n)

Allow adding plot to the same panel @param n: the number of layer

update(center_x=None, center_y=None)

Draw the new roughness on the graph.

class sas.qtgui.Plotting.Slicers.BoxSlicer.VerticalDoubleLine(base, axes, color='black', zorder=5, half_width=0.5, half_height=0.5, center_x=0.0, center_y=0.0)

Bases: BaseInteractor

Draw 2 vertical lines that can move symmetrically in opposite directions in x and centered on a point (PointInteractor). It also defines the top and bottom y positions of a box.

__annotations__ = {}
__doc__ = '\n    Draw 2 vertical lines that can move symmetrically in opposite directions in x and centered on\n    a point (PointInteractor). It also defines the top and bottom y positions of a box.\n    '
__init__(base, axes, color='black', zorder=5, half_width=0.5, half_height=0.5, center_x=0.0, center_y=0.0)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSlicer'
clear()

Clear this slicer and its markers

move(x, y, ev)

Process move to a new position, making sure that the move is allowed. In principle, the move must not create a box without any data points in it. For the dragging (continuous move), we make sure that the width or height are not negative and that the entire ROI resides withing the data. We leave the check of whether there are any data in that ROI to the manipulations.py which is called from _post_data, itself being called on moveend(ev).

moveend(ev)

After a dragging motion update the 1D average plot and then reset the flag self.has_move to False.

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc. This save is run on mouse click (not a drag event) by BaseInteractor

setCursor(x, y)

Update the figure given x and y

setLayer(n)

Allow adding plot to the same panel :param n: the number of layer

update(x1=None, x2=None, y1=None, y2=None, half_width=None, half_height=None, center=None)

Draw the new roughness on the graph. :param x1: new maximum value of x coordinates :param x2: new minimum value of x coordinates :param y1: new maximum value of y coordinates :param y2: new minimum value of y coordinates :param half_ width: is the half width of the new rectangle :param half_height: is the half height of the new rectangle :param center: provided x, y coordinates of the center point

sas.qtgui.Plotting.Slicers.BoxSum module

class sas.qtgui.Plotting.Slicers.BoxSum.BoxSumCalculator(base, axes, color='black', zorder=3)

Bases: BaseInteractor

BoxSumCalculator Class computes properties (such as sum and average of intensities) from a rectangular area defined in a data2D object. The actual calculations are done by manipulations.py

This class uses three other classes, PointerInteractor to define the center of the rectangle, and VerticalDoubleLine and HorizontalDoubleLine to define the rectangle x1,x2,y1,y2.

..TODO: the 3 classes here are the same as used by the BoxSlicer. These

should probably be abstracted out.

@param zorder: Artists with lower zorder values are drawn first. @param x_min: the minimum value of the x coordinate @param x_max: the maximum value of the x coordinate @param y_min: the minimum value of the y coordinate @param y_max: the maximum value of the y coordinate

__annotations__ = {}
__doc__ = '\n    BoxSumCalculator Class computes properties (such as sum and average of\n    intensities) from a rectangular area defined in a data2D object. The actual\n    calculations are done by manipulations.py\n\n    This class uses three other classes, PointerInteractor to define the center\n    of the rectangle, and VerticalDoubleLine and HorizontalDoubleLine to define\n    the rectangle x1,x2,y1,y2.\n\n    ..TODO: the 3 classes here are the same as used by the BoxSlicer. These\n            should probably be abstracted out.\n\n    @param zorder:  Artists with lower zorder values are drawn first.\n    @param x_min: the minimum value of the x coordinate\n    @param x_max: the maximum value of the x coordinate\n    @param y_min: the minimum value of the y coordinate\n    @param y_max: the maximum value of the y coordinate\n\n    '
__init__(base, axes, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSum'
clear()

Clear the slicer and all connected events related to this slicer

draw()

Redraw canvas

getParams()

Store a copy of values of parameters of the slicer into a dictionary. :return params: the dictionary created

getResult()

Return the result of box summation

model()

model accessor

moveend(ev)

After a dragging motion this function is called to compute the error and the sum of pixel of a given data 2D

postData()

Get the limits of the boxsum and compute the sum of the pixel contained in that region and the error on that sum

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setLayer(n)

Allow adding plot to the same panel :param n: the number of layer

setModelFromParams()

Set up the Qt model for data handling between controls

setPanelName(name)

Store the name of the panel associated to this slicer @param name: the name of this panel

setParams(params)

Receive a dictionary and reset the slicer with values contained in the values of the dictionary. :param params: a dictionary containing name of slicer parameters and values the user assigned to the slicer.

setParamsFromModel()

Cast model content onto params dict

setReadOnlyParametersFromModel()

Cast model content onto “read-only” subset of parameters

update()

Respond to changes in the model by recalculating the profiles and resetting the widgets.

validate(param_name, param_value)

Validate input from user

class sas.qtgui.Plotting.Slicers.BoxSum.HorizontalDoubleLine(base, axes, color='black', zorder=5, x=0.5, y=0.5, center_x=0.0, center_y=0.0)

Bases: BaseInteractor

Draw 2 horizontal lines moving in opposite direction and centered on a point (PointInteractor)

__annotations__ = {}
__doc__ = '\n    Draw 2 horizontal lines moving in opposite direction and centered on\n    a point (PointInteractor)\n    '
__init__(base, axes, color='black', zorder=5, x=0.5, y=0.5, center_x=0.0, center_y=0.0)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSum'
clear()

Clear this figure and its markers

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)

After a dragging motion reset the flag self.has_move to False

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setCursor(x, y)

Update the figure given x and y

setLayer(n)

Allow adding plot to the same panel @param n: the number of layer

update(x1=None, x2=None, y1=None, y2=None, width=None, height=None, center=None)

Draw the new roughness on the graph. :param x1: new maximum value of x coordinates :param x2: new minimum value of x coordinates :param y1: new maximum value of y coordinates :param y2: new minimum value of y coordinates :param width: is the width of the new rectangle :param height: is the height of the new rectangle :param center: provided x, y coordinates of the center point

class sas.qtgui.Plotting.Slicers.BoxSum.PointInteractor(base, axes, color='black', zorder=5, center_x=0.0, center_y=0.0)

Bases: BaseInteractor

Draw a point that can be dragged with the marker. this class controls the motion the center of the BoxSum

__annotations__ = {}
__doc__ = '\n    Draw a point that can be dragged with the marker.\n    this class controls the motion the center of the BoxSum\n    '
__init__(base, axes, color='black', zorder=5, center_x=0.0, center_y=0.0)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSum'
clear()

Clear this figure and its markers

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)
restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setCursor(x, y)
setLayer(n)

Allow adding plot to the same panel @param n: the number of layer

update(center_x=None, center_y=None)

Draw the new roughness on the graph.

class sas.qtgui.Plotting.Slicers.BoxSum.VerticalDoubleLine(base, axes, color='black', zorder=5, x=0.5, y=0.5, center_x=0.0, center_y=0.0)

Bases: BaseInteractor

Draw 2 vertical lines moving in opposite direction and centered on a point (PointInteractor)

__annotations__ = {}
__doc__ = '\n    Draw 2 vertical lines moving in opposite direction and centered on\n    a point (PointInteractor)\n    '
__init__(base, axes, color='black', zorder=5, x=0.5, y=0.5, center_x=0.0, center_y=0.0)
__module__ = 'sas.qtgui.Plotting.Slicers.BoxSum'
clear()

Clear this slicer and its markers

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)

After a dragging motion reset the flag self.has_move to False

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setCursor(x, y)

Update the figure given x and y

setLayer(n)

Allow adding plot to the same panel :param n: the number of layer

update(x1=None, x2=None, y1=None, y2=None, width=None, height=None, center=None)

Draw the new roughness on the graph. :param x1: new maximum value of x coordinates :param x2: new minimum value of x coordinates :param y1: new maximum value of y coordinates :param y2: new minimum value of y coordinates :param width: is the width of the new rectangle :param height: is the height of the new rectangle :param center: provided x, y coordinates of the center point

sas.qtgui.Plotting.Slicers.RadiusInteractor module

class sas.qtgui.Plotting.Slicers.RadiusInteractor.RadiusInteractor(base, axes, color='black', zorder=5, r1=1.0, r2=2.0, theta=1.0471975511965976, phi=0.39269908169872414)

Bases: BaseInteractor

Draw a pair of lines radiating from a center at [0,0], between radius values r1 and r2 with and average angle from the x-axis of theta, and an angular diaplacement of phi either side of this average. Used for example to to define the left and right edges of the a wedge area on a plot, see WedgeInteractor. User interaction adjusts the parameter phi.

Parameters:
  • r1 – radius of the inner end of the radial lines

  • r2 – radius of the outer end of the radial lines

  • theta – average angle of the lines from the x-axis

  • phi – angular displacement of the lines either side of theta

__annotations__ = {}
__doc__ = '\n    Draw a pair of lines radiating from a center at [0,0], between radius\n    values r1 and r2 with and average angle from the x-axis of theta, and an\n    angular diaplacement of phi either side of this average. Used for example\n    to to define the left and right edges of the a wedge area on a plot, see\n    WedgeInteractor. User interaction adjusts the parameter phi.\n\n    :param r1: radius of the inner end of the radial lines\n    :param r2: radius of the outer end of the radial lines\n    :param theta: average angle of the lines from the x-axis\n    :param phi: angular displacement of the lines either side of theta\n    '
__init__(base, axes, color='black', zorder=5, r1=1.0, r2=2.0, theta=1.0471975511965976, phi=0.39269908169872414)
__module__ = 'sas.qtgui.Plotting.Slicers.RadiusInteractor'
clear()

Clear this slicer and its markers

move(x, y, ev)

Process move to a new position.

moveend(ev)

Called when any dragging motion ends. Redraw the plot with new parameters and set self.has_move to False.

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel :param n: the number of layer

update(r1=None, r2=None, theta=None, phi=None)

Draw the new roughness on the graph. :param r1: radius of the inner end of the radial lines :param r2: radius of the outer end of the radial lines :param theta: average angle of the lines from the x-axis :param phi: angular displacement of the lines either side of theta

sas.qtgui.Plotting.Slicers.SectorSlicer module

class sas.qtgui.Plotting.Slicers.SectorSlicer.LineInteractor(base, axes, color='black', zorder=5, r=1.0, theta=0.7853981633974483, half_length=False)

Bases: BaseInteractor

Draws a line though 0,0 on a data2D plot. This is used to define the centerline around with other lines can be drawn to define a region of interest (such as a sector).

Parameters:
  • theta – the angle between the middle line and x- axis

  • half_length – Defaults to False. If True, the line is drawn from the origin rather than across the whole graph.

__annotations__ = {}
__doc__ = '\n    Draws a line though 0,0 on a data2D plot. This is used to define the\n    centerline around with other lines can be drawn to define a region of\n    interest (such as a sector).\n\n    :param theta: the angle between the middle line and x- axis\n    :param half_length: Defaults to False. If True, the line is drawn from the\n                        origin rather than across the whole graph.\n    '
__init__(base, axes, color='black', zorder=5, r=1.0, theta=0.7853981633974483, half_length=False)
__module__ = 'sas.qtgui.Plotting.Slicers.SectorSlicer'
clear()
getParams()
move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)
restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)
set_cursor(x, y)
set_layer(n)
update(theta=None)

Draw the new roughness on the graph.

class sas.qtgui.Plotting.Slicers.SectorSlicer.SectorInteractor(base, axes, item=None, color='black', zorder=3)

Bases: BaseInteractor, SlicerModel

SectorInteractor plots a data1D average of a sector area defined in a Data2D object. The data1D averaging itself is performed in sasdata by manipulations.py. Sectors all go through a single point as (0,0).

This class uses two other classes, LineInteractor and SideInteractor, to define a sector centered around a main line defined by LineInteractor which goes through 0,0 at some user settable angle theta from 0. The sector itself is defined by the right and left sidelines, both of which also go through (0,0), and set by SideInteractor from -phi to +phi around the center line defined by the main line. All points at a constant Q from -phi to +phi are averaged together to provide a 1D array in Q (to be plotted as a function of Q).

..TODO: the 2 subclasses here are the same as used by the BoxSum. These

should probably be abstracted out.

__annotations__ = {}
__doc__ = '\n    SectorInteractor plots a data1D average of a sector area defined in a\n    Data2D object. The data1D averaging itself is performed in sasdata by\n    manipulations.py. Sectors all go through a single point as (0,0).\n\n    This class uses two other classes, LineInteractor and SideInteractor, to\n    define a sector centered around a main line defined by LineInteractor\n    which goes through 0,0 at some user settable angle theta from 0. The\n    sector itself is defined by the right and left sidelines, both of which\n    also go through (0,0), and set by SideInteractor from -phi to +phi around\n    the center line defined by the main line. All points at a constant Q from\n    -phi to +phi are averaged together to provide a 1D array in Q (to be\n    plotted as a function of Q).\n\n        ..TODO: the 2 subclasses here are the same as used by the BoxSum. These\n            should probably be abstracted out.\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.SectorSlicer'
_post_data(nbins=None)

compute sector averaging of data2D into data1D :param nbins: the number of point to plot for the average 1D data

clear()

Clear the slicer and all connected events related to this slicer

draw()

Redraw canvas

getParams()

Store a copy of values of parameters of the slicer into a dictionary. :return params: the dictionary created

move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)

Called a dragging motion ends.Get slicer event

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)

Receive a dictionary and reset the slicer with values contained in the values of the dictionary.

Parameters:

params – a dictionary containing name of slicer parameters and values the user assigned to the slicer.

set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel

Parameters:

n – the number of layer

update()

Respond to changes in the model by recalculating the profiles and resetting the widgets.

validate(param_name, param_value)

Test the proposed new value “value” for row “row” of parameters

class sas.qtgui.Plotting.Slicers.SectorSlicer.SideInteractor(base, axes, color='black', zorder=5, r=1.0, phi=0.7853981633974483, theta2=1.0471975511965976)

Bases: BaseInteractor

Draws a line though 0,0 on a data2D plot with reference to a center line. This is used to define both a left and right line which are always updated together as they must remain symmetric at some phi value around the main line (at -phi and +phi).

Parameters:
  • phi – the phase between the middle line and one side line

  • theta2 – the angle between the middle line and x- axis

__annotations__ = {}
__doc__ = '\n    Draws a line though 0,0 on a data2D plot with reference to a center line.\n    This is used to define both a left and right line which are always updated\n    together as they must remain symmetric at some phi value around the main\n    line (at -phi and +phi).\n\n    :param phi: the phase between the middle line and one side line\n    :param theta2: the angle between the middle line and x- axis\n\n    '
__init__(base, axes, color='black', zorder=5, r=1.0, phi=0.7853981633974483, theta2=1.0471975511965976)
__module__ = 'sas.qtgui.Plotting.Slicers.SectorSlicer'
clear()

Clear the slicer and all connected events related to this slicer

getParams()
move(x, y, ev)

Process move to a new position, making sure that the move is allowed.

moveend(ev)
restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)
set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel

Parameters:

n – the number of layer

update(phi=None, delta=None, mline=None, side=False, left=False, right=False)

Draw oblique line

Parameters:
  • phi – the phase between the middle line and the current line

  • delta – phi/2 applied only when the mline was moved

sas.qtgui.Plotting.Slicers.WedgeSlicer module

class sas.qtgui.Plotting.Slicers.WedgeSlicer.WedgeInteractor(base, axes, item=None, color='black', zorder=3)

Bases: BaseInteractor, SlicerModel

This WedgeInteractor is a cross between the SectorInteractor and the AnnulusInteractor. It plots a data1D average of a wedge area defined in a Data2D object, in either the Q direction or the Phi direction. The data1D averaging itself is performed in sasdata by manipulations.py.

This class uses three other classes, ArcInteractor (in ArcInteractor.py), RadiusInteractor (in RadiusInteractor.py), and LineInteractor (in SectorSlicer.py), to define a wedge area contained between two radial lines running through (0,0) defining the left and right edges of the wedge (similar to the sector), and two rings at Q1 and Q2 (similar to the annulus). The wedge is centred on the line defined by LineInteractor, which the radial lines move symmetrically around. This class is itself subclassed by SectorInteractorPhi and SectorInteractorQ which define the direction of the averaging. SectorInteractorPhi averages all Q points at constant Phi (as for the AnnulusSlicer) and SectorInteractorQ averages all phi points at constant Q (as for the SectorSlicer).

__annotations__ = {}
__doc__ = '\n    This WedgeInteractor is a cross between the SectorInteractor and the\n    AnnulusInteractor. It plots a data1D average of a wedge area defined in a\n    Data2D object, in either the Q direction or the Phi direction. The data1D\n    averaging itself is performed in sasdata by manipulations.py.\n\n    This class uses three other classes, ArcInteractor (in ArcInteractor.py),\n    RadiusInteractor (in RadiusInteractor.py), and LineInteractor\n    (in SectorSlicer.py), to define a wedge area contained\n    between two radial lines running through (0,0) defining the left and right\n    edges of the wedge (similar to the sector), and two rings at Q1 and Q2\n    (similar to the annulus). The wedge is centred on the line defined by\n    LineInteractor, which the radial lines move symmetrically around.\n    This class is itself subclassed by SectorInteractorPhi and\n    SectorInteractorQ which define the direction of the averaging.\n    SectorInteractorPhi averages all Q points at constant Phi (as for the\n    AnnulusSlicer) and SectorInteractorQ averages all phi points at constant Q\n    (as for the SectorSlicer).\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.WedgeSlicer'
_post_data(new_sector=None, nbins=None)

post 1D data averagin in Q or Phi given new_sector type

Parameters:
  • new_sector – slicer used for directional averaging in Q or Phi

  • nbins – the number of point plotted when averaging

:TODO

Unlike other slicers, the two sector types are sufficiently different that this method contains three instances of If (check class name) do x. The point of post_data vs _post_data I think was to avoid this kind of thing and suggests that in this case we may need a new method in the WedgeInteracgtorPhi and WedgeInteractorQ to handle these specifics. Probably by creating the 1D plot object in those top level classes along with the specifc attributes.

clear()

Clear the slicer and all connected events related to this slicer

draw()

Draws the Canvas using the canvas.draw from the calling class that instantiated this object.

getParams()

Store a copy of values of parameters of the slicer into a dictionary. :return params: the dictionary created

move(x, y, ev)

Process move to a new position.

moveend(ev)

Called after a dragging event. Post the slicer new parameters and creates a new Data1D corresponding to the new average

restore(ev)

Restore the roughness for this layer.

save(ev)

Remember the roughness for this layer and the next so that we can restore on Esc.

setParams(params)

Receive a dictionary and reset the slicer with values contained in the values of the dictionary.

Parameters:

params – a dictionary containing name of slicer parameters and values the user assigned to the slicer.

set_cursor(x, y)
set_layer(n)

Allow adding plot to the same panel :param n: the number of layer

update()

If one of the interactors has been moved, update it and the parameter it controls, then update the other interactors accordingly

validate(param_name, param_value)

Validate input from user. Values get checked at apply time.

class sas.qtgui.Plotting.Slicers.WedgeSlicer.WedgeInteractorPhi(base, axes, item=None, color='black', zorder=3)

Bases: WedgeInteractor

Average in phi direction. The data for all Q at a constant phi are averaged together to provide a 1D array in phi (to be plotted as a function of phi)

__annotations__ = {}
__doc__ = '\n    Average in phi direction. The data for all Q at a constant phi are\n    averaged together to provide a 1D array in phi (to be plotted as a function\n    of phi)\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.WedgeSlicer'
_post_data(new_sector=None, nbins=None)

post 1D data averagin in Q or Phi given new_sector type

Parameters:
  • new_sector – slicer used for directional averaging in Q or Phi

  • nbins – the number of point plotted when averaging

:TODO

Unlike other slicers, the two sector types are sufficiently different that this method contains three instances of If (check class name) do x. The point of post_data vs _post_data I think was to avoid this kind of thing and suggests that in this case we may need a new method in the WedgeInteracgtorPhi and WedgeInteractorQ to handle these specifics. Probably by creating the 1D plot object in those top level classes along with the specifc attributes.

class sas.qtgui.Plotting.Slicers.WedgeSlicer.WedgeInteractorQ(base, axes, item=None, color='black', zorder=3)

Bases: WedgeInteractor

Average in Q direction. The data for all phi at a constant Q are averaged together to provide a 1D array in Q (to be plotted as a function of Q)

__annotations__ = {}
__doc__ = '\n    Average in Q direction. The data for all phi at a constant Q are\n    averaged together to provide a 1D array in Q (to be plotted as a function\n    of Q)\n    '
__init__(base, axes, item=None, color='black', zorder=3)
__module__ = 'sas.qtgui.Plotting.Slicers.WedgeSlicer'
_post_data(new_sector=None, nbins=None)

post 1D data averagin in Q or Phi given new_sector type

Parameters:
  • new_sector – slicer used for directional averaging in Q or Phi

  • nbins – the number of point plotted when averaging

:TODO

Unlike other slicers, the two sector types are sufficiently different that this method contains three instances of If (check class name) do x. The point of post_data vs _post_data I think was to avoid this kind of thing and suggests that in this case we may need a new method in the WedgeInteracgtorPhi and WedgeInteractorQ to handle these specifics. Probably by creating the 1D plot object in those top level classes along with the specifc attributes.

Module contents