sas.sasgui.plottools package

Submodules

sas.sasgui.plottools.BaseInteractor module

sas.sasgui.plottools.LabelDialog module

class sas.sasgui.plottools.LabelDialog.LabelDialog(parent, id, title, label)[source]

Bases: wx._windows.Dialog

getText()[source]

sas.sasgui.plottools.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.sasgui.plottools.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

getParam(name)[source]

Return parameter value

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

setParam(name, value)[source]

Set parameter value

sas.sasgui.plottools.PlotPanel module

Plot panel.

class sas.sasgui.plottools.PlotPanel.NoRepaintCanvas(*args, **kwargs)[source]

Bases: matplotlib.backends.backend_wxagg.FigureCanvasWxAgg

We subclass FigureCanvasWxAgg, overriding the _onPaint method, so that the draw method is only called for the first two paint events. After that, the canvas will only be redrawn when it is resized.

class sas.sasgui.plottools.PlotPanel.PlotPanel(parent, id=-1, xtransform=None, ytransform=None, scale='log_{10}', color=None, dpi=None, **kwargs)[source]

Bases: wx._windows.Panel

The PlotPanel has a Figure and a Canvas. OnSize events simply set a flag, and the actually redrawing of the figure is triggered by an Idle event.

ChangeLegendLoc(label)[source]

Changes legend loc based on user input

OnCopyFigureMenu(evt)[source]

Copy the current figure to clipboard

On_Paint(event)[source]
SetColor(rgbtuple)[source]

Set figure and canvas colours to be the same

add_toolbar()[source]

add toolbar

clear()[source]

Reset the plot

curve(x, y, dy=None, color=0, symbol=0, label=None)[source]

Draw a line on a graph, possibly with confidence intervals.

cusor_line(event)[source]
draw()[source]

Where the actual drawing happens

get_loc_label()[source]

Associates label to a specific legend location

get_xscale()[source]
Returns:x-axis scale
get_yscale()[source]
Returns:Y-axis scale
image(data, qx_data, qy_data, xmin, xmax, ymin, ymax, zmin, zmax, color=0, symbol=0, markersize=0, label='data2D', cmap=<matplotlib.colors.LinearSegmentedColormap object at 0x000000000BF24518>)[source]

Render the current data

interactive_curve(x, y, dy=None, name='', color=0, symbol=0, zorder=1, id=None, label=None)[source]

Draw markers with error bars

interactive_points(x, y, dx=None, dy=None, name='', color=0, symbol=0, markersize=5, zorder=1, id=None, label=None, hide_error=False)[source]

Draw markers with error bars

is_zoomed
legend_picker(legend, event)[source]

Pick up the legend patch

linear_plottable_fit(plot)[source]

when clicking on linear Fit on context menu, display Fitting Dialog

Parameters:plot – PlotPanel owning the graph
onChangeCaption(event)[source]
onChangeLegendLoc(event)[source]

Changes legend loc based on user input

onContextMenu(event)[source]

Default context menu for a plot panel

onFitDisplay(tempx, tempy, xminView, xmaxView, xmin, xmax, func)[source]

Add a new plottable into the graph .In this case this plottable will be used to fit some data

Parameters:
  • tempx – The x data of fit line
  • tempy – The y data of fit line
  • xminView – the lower bound of fitting range
  • xminView – the upper bound of fitting range
  • xmin – the lowest value of data to fit to the line
  • xmax – the highest value of data to fit to the line
onFitting(event)[source]

when clicking on linear Fit on context menu , display Fitting Dialog

onGridOnOff(gridon_off)[source]

Allows ON/OFF Grid

onLeftDown(event)[source]

left button down and ready to drag

onLeftUp(event)[source]

Dragging is done

onLegend(legOnOff)[source]

Toggles whether legend is visible/not visible

onMouseMotion(event)[source]

check if the left button is press and the mouse in moving. computer delta for x and y coordinates and then calls draghelper to perform the drag

onPick(event)[source]

On pick legend

onPrint(event=None)[source]
onPrinterPreview(event=None)[source]

Matplotlib camvas can no longer print itself. Thus need to do everything ourselves: need to create a printpreview frame to to see the preview but needs a parent frame object. Also needs a printout object (just as any printing task).

onPrinterSetup(event=None)[source]
onResetGraph(event)[source]

Reset the graph by plotting the full range of data

onSaveImage(evt)[source]

Implement save image

onToolContextMenu(event)[source]

ContextMenu from toolbar

Parameters:event – toolbar event
onWheel(event)[source]

Process mouse wheel as zoom events

Parameters:event – Wheel event
on_kill_focus(event)[source]

Reset the panel color

on_set_focus(event)[source]

Send to the parenet the current panel on focus

plottable_selected(id)[source]

Called to register a plottable as selected

points(x, y, dx=None, dy=None, color=0, symbol=0, marker_size=5, label=None, id=None, hide_error=False)[source]

Draw markers with error bars

properties(prop)[source]

Set some properties of the graph. The set of properties is not yet determined.

remove_legend(ax=None)[source]

Remove legend for ax or the current axes.

render()[source]

Commit the plot after all objects are drawn

resetFitView()[source]

For fit Dialog initial display

returnTrans()[source]

Return values and labels used by Fit Dialog

schedule_full_draw(func='append')[source]

Put self in schedule to full redraw list

setTrans(xtrans, ytrans)[source]
Parameters:
  • xtrans – set x transformation on Property dialog
  • ytrans – set y transformation on Property dialog
set_legend_alpha(alpha=1)[source]

Set legend alpha

set_resizing(resizing=False)[source]

Set the resizing (True/False)

set_selected_from_menu(menu, id)[source]

Set selected_plottable from context menu selection

Parameters:
  • menu – context menu item
  • id – menu item id
set_xscale(scale='linear')[source]

Set the scale on x-axis

Parameters:scale – the scale of x-axis
set_yscale(scale='linear')[source]

Set the scale on Y-axis

Parameters:scale – the scale of y-axis
xaxis(label, units, font=None, color='black', t_font=None)[source]

xaxis label and units.

Axis labels know about units.

We need to do this so that we can detect when axes are not commesurate. Currently this is ignored other than for formatting purposes.

yaxis(label, units, font=None, color='black', t_font=None)[source]

yaxis label and units.

sas.sasgui.plottools.PlotPanel.show_tree(obj, d=0)[source]

Handy function for displaying a tree of graph objects

sas.sasgui.plottools.PropertyDialog module

class sas.sasgui.plottools.PropertyDialog.Properties(parent, id=-1, title='Select the scale of the graph')[source]

Bases: wx._windows.Dialog

getValues()[source]
setValues(x, y, view)[source]
viewChanged(event)[source]

sas.sasgui.plottools.RangeDialog module

class sas.sasgui.plottools.RangeDialog.RangeDialog(parent, id, title='Set Graph Range')[source]

Bases: wx._windows.Dialog

GetXRange()[source]
GetYRange()[source]
SetXRange(x_range)[source]
SetYRange(y_range)[source]

sas.sasgui.plottools.SimpleFont module

This software was developed by Institut Laue-Langevin as part of Distributed Data Analysis of Neutron Scattering Experiments (DANSE).

Copyright 2012 Institut Laue-Langevin

class sas.sasgui.plottools.SimpleFont.SimpleFont(parent, id, title)[source]

Bases: wx._windows.Dialog

InitUI()[source]
get_font()[source]
get_ticklabel_check()[source]

Get tick label check value

set_default_font(font)[source]
set_ticklabel_check(check=False)[source]

Set tick label check value

sas.sasgui.plottools.SizeDialog module

class sas.sasgui.plottools.SizeDialog.SizeDialog(parent, id, title)[source]

Bases: wx._windows.Dialog

getText()[source]

Get text typed

sas.sasgui.plottools.TextDialog module

class sas.sasgui.plottools.TextDialog.TextDialog(parent, id, title, label='', unit=None)[source]

Bases: wx._windows.Dialog

getColor()[source]

Returns font size for the text box

getFamily()[source]

Returns font family for the text box

getSize()[source]

Returns font size for the text box

getStyle()[source]

Returns font tyle for the text box

getText()[source]

Returns text string as input by user.

getTickLabel()[source]

Bool for use on tick label

getUnit()[source]

Returns unit string as input by user.

getWeight()[source]

Returns font weight for the text box

on_color(event)[source]

Set the color

on_family(event)[source]

Set the family

on_size(event)[source]

Set the size

on_style(event)[source]

Set the style

on_tick_label(event)[source]

Set the font for tick label

on_weight(event)[source]

Set the weight

sas.sasgui.plottools.arrow3d module

Module that draws multiple arrows in 3D coordinates

class sas.sasgui.plottools.arrow3d.Arrow3D(base, xs, ys, zs, colors, *args, **kwargs)[source]

Bases: matplotlib.patches.FancyArrowPatch

Draw 3D arrow

draw(renderer, rasterized=True)[source]

Drawing actually happens here

on_left_down(event)[source]

Mouse left-down event

on_left_up(event)[source]

Mouse left up event

sas.sasgui.plottools.binder module

Extension to MPL to support the binding of artists to key/mouse events.

class sas.sasgui.plottools.binder.BindArtist(figure)[source]

Bases: object

alt = False
clear(h1, h2, ...)[source]

Remove connections for artists h1, h2, ...

Use clearall() to reset all connections.

clearall()[source]

Clear connections to all artists.

Use clear(h1,h2,...) to reset specific artists.

control = False
dclick_threshhold = 0.25
disconnect()[source]

In case we need to disconnect from the canvas...

events = ['enter', 'leave', 'motion', 'click', 'dclick', 'drag', 'release', 'scroll', 'key', 'keyup']
meta = False
shift = False
trigger(actor, action, ev)[source]

Trigger a particular event for the artist. Fallback to axes, to figure, and to ‘all’ if the event is not processed.

class sas.sasgui.plottools.binder.Selection(artist=None, prop={})[source]

Bases: object

Store and compare selections.

artist = None
prop = {}

sas.sasgui.plottools.canvas module

This module implements a faster canvas for plotting. it ovewrites some matplolib methods to allow printing on sys.platform==’win32’

class sas.sasgui.plottools.canvas.FigureCanvas(*args, **kw)[source]

Bases: matplotlib.backends.backend_wxagg.FigureCanvasWxAgg

Add features to the wx agg canvas for better support of AUI and faster plotting.

draw(drawDC=None)[source]

Render the figure using agg.

draw_idle(*args, **kwargs)[source]

Render after a delay if no other render requests have been made.

scroll_event(x, y, step=1, guiEvent=None)[source]

Backend derived classes should call this function on any scroll wheel event. x,y are the canvas coords: 0,0 is lower, left. button and key are as defined in MouseEvent

set_panel(panel)[source]

Set axes

set_resizing(resizing=False)[source]

Setting the resizing

sas.sasgui.plottools.canvas.OnPrintPage(self, page)[source]

override printPage of matplotlib

sas.sasgui.plottools.canvas.draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None)[source]

Draw the image instance into the current axes;

Parameters:
  • x – is the distance in pixels from the left hand side of the canvas.
  • y – the distance from the origin. That is, if origin is upper, y is the distance from top. If origin is lower, y is the distance from bottom
  • im – the class`matplotlib._image.Image` instance
  • bbox – a class matplotlib.transforms.Bbox instance for clipping, or None
sas.sasgui.plottools.canvas.select(self)[source]
sas.sasgui.plottools.canvas.unselect(self)[source]

sas.sasgui.plottools.config module

sas.sasgui.plottools.convert_units module

Convert units to strings that can be displayed This is a cleaned up version of unitConverter.py

sas.sasgui.plottools.convert_units.convert_unit(power, unit)[source]

Convert units to strings that can be displayed

sas.sasgui.plottools.fitDialog module

class sas.sasgui.plottools.fitDialog.LinearFit(parent, plottable, push_data, transform, title)[source]

Bases: wx._windows.Dialog

checkFitValues(item)[source]

Check the validity of input values

floatForwardTransform(x)[source]

transform a float.

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.

floatTransform(x)[source]

transform a float.It is use to determine the x. View min and x.View max for values not in x

layout()[source]

Sets up the panel layout for the linear fit including all the labels, text entry boxes, and buttons.

register_close(owner)[source]

Method to register the close event to a parent window that needs notification when the dialog is closed

Parameters:owner – parent window
setFitRange(xmin, xmax, xminTrans, xmaxTrans)[source]

Set fit parameters

set_fit_region(xmin, xmax)[source]

Set the fit region :param xmin: minimum x-value to be included in fit :param xmax: maximum x-value to be included in fit

class sas.sasgui.plottools.fitDialog.MyApp(redirect=False, filename=None, useBestVisual=False, clearSigInt=True)[source]

Bases: wx._core.App

Test application

OnInit()[source]

Test application initialization

onFitDisplay(tempx, tempy, xminView, xmaxView, xmin, xmax, func)[source]

Test application dummy method

returnTrans()[source]

Test application dummy method

sas.sasgui.plottools.fitDialog.format_number(value, high=False)[source]

Return a float in a standardized, human-readable formatted string. This is used to output readable (e.g. x.xxxe-y) values to the panel.

sas.sasgui.plottools.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.sasgui.plottools.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.

set(value)[source]

Set the value of the parameter

sas.sasgui.plottools.fittings.calcCommandline(event)[source]
sas.sasgui.plottools.fittings.sasfit(model, pars, x, y, err_y, qmin=None, qmax=None)[source]

Fit function

Parameters:
  • model – sas model object
  • pars – list of parameters
  • x – vector of x data
  • y – vector of y data
  • err_y – vector of y errors

sas.sasgui.plottools.plottable_interactor module

This module allows more interaction with the plot

class sas.sasgui.plottools.plottable_interactor.PointInteractor(base, axes, color='black', zorder=3, id='')[source]

Bases: sas.sasgui.plottools.BaseInteractor._BaseInteractor

clear()[source]
connect_markers(markers)[source]

Connect markers to callbacks

curve(x, y, dy=None, color=0, symbol=0, zorder=10, label=None, width=2.0)[source]
points(x, y, dx=None, dy=None, color=0, symbol=0, zorder=1, markersize=5, label=None, hide_error=False)[source]
step(x, y, dy=None, color=0, symbol=0, zorder=1, label=None, width=2.0)[source]
update()[source]

Update

vline(x, y, dy=None, color=0, symbol=0, zorder=1, label=None, width=2.0)[source]

sas.sasgui.plottools.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.sasgui.plottools.plottables.Chisq(chisq=None)[source]

Bases: sas.sasgui.plottools.plottables.Plottable

Chisq plottable plots the chisq

render(plot, **kw)[source]
setChisq(chisq)[source]

Set the chisq value.

class sas.sasgui.plottools.plottables.Data1D(x, y, dx=None, dy=None, lam=None, dlam=None)[source]

Bases: sas.sasgui.plottools.plottables.Plottable

Data plottable: scatter plot of x,y with errors in x and y.

changed()[source]
classmethod labels(collection)[source]

Build a label mostly unique within a collection

render(plot, **kw)[source]

Renders the plottable on the graph

class sas.sasgui.plottools.plottables.Data2D(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: sas.sasgui.plottools.plottables.Plottable

2D data class for image plotting

changed()[source]
classmethod labels(collection)[source]

Build a label mostly unique within a collection

render(plot, **kw)[source]

Renders the plottable on the graph

setValues(datainfo=None)[source]

Use datainfo object to initialize data2D

Parameters:datainfo – object
set_zrange(zmin=None, zmax=None)[source]
xaxis(label, unit)[source]

set x-axis

Parameters:
  • label – x-axis label
  • unit – x-axis unit
yaxis(label, unit)[source]

set y-axis

Parameters:
  • label – y-axis label
  • unit – y-axis unit
zaxis(label, unit)[source]

set z-axis

Parameters:
  • label – z-axis label
  • unit – z-axis unit
class sas.sasgui.plottools.plottables.Fit1D(data=None, theory=None)[source]

Bases: sas.sasgui.plottools.plottables.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.

changed()[source]
render(plot, **kw)[source]
class sas.sasgui.plottools.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.

add(plottable, color=None)[source]

Add a new plottable to the graph

changed()[source]

Detect if any graphed plottables have changed

delete(plottable)[source]

Remove an existing plottable from the graph

get(key)[source]

Get the graph properties

get_plottable(name)[source]

Return the plottable with the given name if it exists. Otherwise return None

get_range()[source]

Return the range of all displayed plottables

isPlotted(plottable)[source]

Return True is the plottable is already on the graph

render(plot)[source]

Redraw the graph

replace(plottable)[source]

Replace an existing plottable from the graph

reset()[source]

Reset the graph.

reset_scale()[source]

Resets the scale transformation data to the underlying data

returnPlottable()[source]

This method returns a dictionary of plottables contained in graph It is just by Plotpanel to interact with the complete list of plottables inside the graph.

set(**kw)[source]

Set the graph properties

title(name)[source]

Graph title

xaxis(name, units)[source]

Properties of the x axis.

yaxis(name, units)[source]

Properties of the y axis.

class sas.sasgui.plottools.plottables.Plottable[source]

Bases: object

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

colors()[source]

Return the number of colors need to render the object

custom_color = None
dx = None
dy = None
get_xaxis()[source]

Return the units and name of x-axis

get_yaxis()[source]

Return the units and name of y- axis

hidden = False
interactive = True
is_empty()[source]

Returns True if there is no data stored in the plottable

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 = 5
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
onReset()[source]

Reset x, y, dx, dy view with its parameters

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.

reset_view()[source]

Reload view with new value to plot

returnValuesOfView()[source]

Return View parameters and it is used by Fit Dialog

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
set_View(x, y)[source]

Load View

set_data(x, y, dx=None, dy=None)[source]
short_name = None
transformView()[source]

It transforms x, y before displaying

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
yaxis(name, units)[source]

Set the name and unit of y_axis

Parameters:
  • name – the name of y-axis
  • units – the units of y_axis
class sas.sasgui.plottools.plottables.Text(text=None, xpos=0.5, ypos=0.9, name='text')[source]

Bases: sas.sasgui.plottools.plottables.Plottable

getText(text)[source]

Get the text string.

render(plot, **kw)[source]
setText(text)[source]

Set the text string.

set_x(x)[source]

Set the x position of the text ACCEPTS: float

set_y(y)[source]

Set the y position of the text ACCEPTS: float

class sas.sasgui.plottools.plottables.Theory1D(x, y, dy=None)[source]

Bases: sas.sasgui.plottools.plottables.Plottable

Theory plottable: line plot of x,y with confidence interval y.

class sas.sasgui.plottools.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.
class sas.sasgui.plottools.plottables.View(x=None, y=None, dx=None, dy=None)[source]

Bases: object

Representation of the data that might include a transformation

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

returnXview()[source]

Return View x,y,dx,dy

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.sasgui.plottools.plottables.all(L)[source]
sas.sasgui.plottools.plottables.any(L)[source]
sas.sasgui.plottools.plottables.demo_plotter(graph)[source]
sas.sasgui.plottools.plottables.sample_graph()[source]

sas.sasgui.plottools.toolbar module

This module overwrites matplotlib toolbar

class sas.sasgui.plottools.toolbar.NavigationToolBar(canvas, parent=None)[source]

Bases: matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg

context_menu(event)[source]

Default context menu for a plot panel

copy_figure(event)[source]
on_menu(event)[source]
print_figure(event)[source]
class sas.sasgui.plottools.toolbar.PlotPrintout(canvas)[source]

Bases: wx._windows.Printout

Create the wx.Printout object for matplotlib figure from the PlotPanel. Provides the required OnPrintPage and HasPage overrides. Other methods may be added/overriden in the future. :TODO: this needs LOTS of TLC .. but fixes immediate problem

GetPageInfo()[source]

just sets the page to 1 - no flexibility for now

OnPrintPage(page)[source]

Most rudimentry OnPrintPage override. instatiates a dc object, gets its size, gets the size of the figure object, scales it to the dc canvas size keeping the aspect ratio intact, then prints as bitmap

sas.sasgui.plottools.toolbar.bind(actor, event, action, **kw)[source]
sas.sasgui.plottools.toolbar.copy_image_to_clipboard(canvas)[source]

sas.sasgui.plottools.transform module

sas.sasgui.plottools.transform.errFromX2(x, y=None, dx=None, dy=None)[source]

calculate error of sqrt(x)

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errFromX4(x, y=None, dx=None, dy=None)[source]

calculate error of x^1/4

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errOneOverSqrtX(x, y=None, dx=None, dy=None)[source]

Calculate error on 1/sqrt(x)

sas.sasgui.plottools.transform.errOneOverX(x, y=None, dx=None, dy=None)[source]

calculate error on 1/x

sas.sasgui.plottools.transform.errToLog10X(x, y=None, dx=None, dy=None)[source]

calculate error of Log(x)

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errToLogX(x, y=None, dx=None, dy=None)[source]

calculate error of Log(x)

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errToLogXY(x, y, dx=None, dy=None)[source]

calculate error of Log(xy)

sas.sasgui.plottools.transform.errToLogYX2(y, x, dy=None, dx=None)[source]

calculate error of Log(yx**2)

sas.sasgui.plottools.transform.errToLogYX4(y, x, dy=None, dx=None)[source]

error for ln(y*x^(4))

Parameters:x – float value
sas.sasgui.plottools.transform.errToX(x, y=None, dx=None, dy=None)[source]

calculate error of x**2

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errToX2(x, y=None, dx=None, dy=None)[source]

calculate error of x**2

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errToX4(x, y=None, dx=None, dy=None)[source]

calculate error of x**4

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errToX_pos(x, y=None, dx=None, dy=None)[source]

calculate error of x**2

Parameters:
  • x – float value
  • dx – float value
sas.sasgui.plottools.transform.errToYX2(y, x, dy=None, dx=None)[source]
sas.sasgui.plottools.transform.errToYX4(y, x, dy=None, dx=None)[source]

error for (y*x^(4))

Parameters:x – float value
sas.sasgui.plottools.transform.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.sasgui.plottools.transform.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.sasgui.plottools.transform.toLogX(x, y=None)[source]

This function is used to load value on Plottable.View calculate log x

Parameters:x – float value
sas.sasgui.plottools.transform.toLogXY(y, x)[source]

This function is used to load value on Plottable.View calculate log x

Parameters:x – float value
sas.sasgui.plottools.transform.toLogYX2(y, x)[source]
sas.sasgui.plottools.transform.toLogYX4(y, x)[source]
sas.sasgui.plottools.transform.toOneOverSqrtX(y, x=None)[source]
sas.sasgui.plottools.transform.toOneOverX(x, y=None)[source]
sas.sasgui.plottools.transform.toX(x, y=None)[source]

This function is used to load value on Plottable.View

Parameters:x – Float value
Returns:x
sas.sasgui.plottools.transform.toX2(x, y=None)[source]

This function is used to load value on Plottable.View

Calculate x^(2)

Parameters:x – float value
sas.sasgui.plottools.transform.toX4(x, y=None)[source]

This function is used to load value on Plottable.View

Calculate x^(4)

Parameters:x – float value
sas.sasgui.plottools.transform.toX_pos(x, y=None)[source]

This function is used to load value on Plottable.View

Parameters:x – Float value
Returns:x
sas.sasgui.plottools.transform.toYX2(y, x)[source]
sas.sasgui.plottools.transform.toYX4(y, x)[source]

Module contents