Provide Line function (y= A + Bx)
Bases: object
Class that evaluates a linear model.
f(x) = A + Bx
List of default parameters: A = 0.0 B = 0.0
Evaluate the model
Parameters: | x – simple value |
---|---|
Returns: | (Line value) |
Evaluate the model
Parameters: | x – simple value |
---|---|
Returns: | Line value |
0: matplotlib plot 1: wx.lib.plot 2: other
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.
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.
Changes legend loc based on user input
Copy the current figure to clipboard
Set figure and canvas colours to be the same
add toolbar
Reset the plot
Draw a line on a graph, possibly with confidence intervals.
Where the actual drawing happens
Associates label to a specific legend location
Returns: | x-axis scale |
---|
Returns: | Y-axis scale |
---|
Render the current data
Draw markers with error bars
Draw markers with error bars
Pick up the legend patch
when clicking on linear Fit on context menu, display Fitting Dialog
Parameters: | plot – PlotPanel owning the graph |
---|
Changes legend loc based on user input
Default context menu for a plot panel
Add a new plottable into the graph .In this case this plottable will be used to fit some data
Parameters: |
|
---|
when clicking on linear Fit on context menu , display Fitting Dialog
Allows ON/OFF Grid
left button down and ready to drag
Dragging is done
Toggles whether legend is visible/not visible
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
On pick legend
Reset the graph by plotting the full range of data
Implement save image
ContextMenu from toolbar
Parameters: | event – toolbar event |
---|
Process mouse wheel as zoom events
Parameters: | event – Wheel event |
---|
Reset the panel color
Send to the parenet the current panel on focus
Called to register a plottable as selected
Draw markers with error bars
Set some properties of the graph. The set of properties is not yet determined.
Remove legend for ax or the current axes.
Commit the plot after all objects are drawn
For fit Dialog initial display
Return values and labels used by Fit Dialog
Put self in schedule to full redraw list
Parameters: |
|
---|
Set legend alpha
Set the resizing (True/False)
Set selected_plottable from context menu selection
Parameters: |
|
---|
Set the scale on x-axis
Parameters: | scale – the scale of x-axis |
---|
Set the scale on Y-axis
Parameters: | scale – the scale of y-axis |
---|
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 and units.
Handy function for displaying a tree of graph objects
This software was developed by Institut Laue-Langevin as part of Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
Copyright 2012 Institut Laue-Langevin
Bases: wx._windows.Dialog
Returns font size for the text box
Returns font family for the text box
Returns font size for the text box
Returns font tyle for the text box
Returns text string as input by user.
Bool for use on tick label
Returns unit string as input by user.
Returns font weight for the text box
Returns x coordinate of text box
Returns y coordinate of text box
Set the color
Set the family
Set the size
Set the style
Set the font for tick label
Set the weight
Module that draws multiple arrows in 3D coordinates
Extension to MPL to support the binding of artists to key/mouse events.
Remove connections for artists h1, h2, ...
Use clearall() to reset all connections.
Clear connections to all artists.
Use clear(h1,h2,...) to reset specific artists.
In case we need to disconnect from the canvas...
Trigger a particular event for the artist. Fallback to axes, to figure, and to ‘all’ if the event is not processed.
Store and compare selections.
This module implements a faster canvas for plotting. it ovewrites some matplolib methods to allow printing on sys.platform==’win32’
Bases: matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
Add features to the wx agg canvas for better support of AUI and faster plotting.
Render the figure using agg.
Render after a delay if no other render requests have been made.
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 axes
Setting the resizing
override printPage of matplotlib
Draw the image instance into the current axes;
Parameters: |
|
---|
Configure plotter for plottools.
This must be imported first in __init__.py for plottools.
If your application uses matplotlib outside plottools, then please do the following at the start of your application:
# Select matplotlib version and backend import sas.plottools.config
Note that plottools requires particular versions of matplotlib and a particular backend. As of this writing it is the WXAgg backend for matplotlib>=0.98.
The plottools package uses pkg_resources if available to select the correct version of matplotlib. If you need multiple matplotlib versions in your path, be sure to use “easy_install -m” for all of them. If a version is installed without “-m” that does not meet the requirements, then pkg_resources.require() will fail, even if you have installed a suitable version with “-m”. In this case you will need to fix up your site-packages directory, probably by removing site-packages/matplotlib and the associated egg file for that version, and reinstalling with “-m”. You may also need to edit site-packages/easy-install.pth.
Bases: wx._windows.Dialog
Check the validity of input values
transform a float.
transform a float.It is use to determine the x.View min and x.View max for values not in x
transform a float.It is use to determine the x. View min and x.View max for values not in x
Method to register the close event to a parent window that needs notification when the dialog is closed
Parameters: | owner – parent window |
---|
Set fit parameters
Set the fit region :param xmin: minimum x-value to be included in fit :param xmax: maximum x-value to be included in fit
Bases: wx._core.App
Return a float in a standardized, human-readable formatted string
Class to handle model parameters
Set the value of the parameter
Fit function
Parameters: |
|
---|
This module allows more interaction with the plot
Bases: sas.plottools.BaseInteractor._BaseInteractor
Connect markers to callbacks
Update
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.
Bases: sas.plottools.plottables.Plottable
Chisq plottable plots the chisq
Set the chisq value.
Bases: sas.plottools.plottables.Plottable
Data plottable: scatter plot of x,y with errors in x and y.
Build a label mostly unique within a collection
Renders the plottable on the graph
Bases: sas.plottools.plottables.Plottable
2D data class for image plotting
Build a label mostly unique within a collection
Renders the plottable on the graph
Use datainfo object to initialize data2D
Parameters: | datainfo – object |
---|
set x-axis
Parameters: |
|
---|
set y-axis
Parameters: |
|
---|
set z-axis
Parameters: |
|
---|
Bases: sas.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.
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 a new plottable to the graph
Detect if any graphed plottables have changed
Remove an existing plottable from the graph
Get the graph properties
Return the plottable with the given name if it exists. Otherwise return None
Return the range of all displayed plottables
Return True is the plottable is already on the graph
Redraw the graph
Replace an existing plottable from the graph
Reset the graph.
Resets the scale transformation data to the underlying data
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 the graph properties
Graph title
Properties of the x axis.
Properties of the y axis.
Bases: object
Since no transformation is made for log10(x), check that no negative values is plot in log scale
Since no transformation is made for log10(y), check that no negative values is plot in log scale
Return the number of colors need to render the object
Return the units and name of x-axis
Return the units and name of y- axis
Returns True if there is no data stored in the plottable
Construct a set of unique labels for a collection of plottables of the same type.
Returns a map from plottable to name.
It limits View data range to plot from min to max
Parameters: |
|
---|
Reset x, y, dx, dy view with its parameters
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.
Reload view with new value to plot
Return View parameters and it is used by Fit Dialog
It takes a label of the x and y transformation and set View parameters
Parameters: |
|
---|
Load View
It transforms x, y before displaying
Receive pointers to function that transform x and dx and set corresponding View pointers
Parameters: |
|
---|
Receive pointers to function that transform y and dy and set corresponding View pointers
Parameters: |
|
---|
Set the name and unit of x_axis
Parameters: |
|
---|
Set the name and unit of y_axis
Parameters: |
|
---|
Bases: sas.plottools.plottables.Plottable
Get the text string.
Set the text string.
Set the x position of the text ACCEPTS: float
Set the y position of the text ACCEPTS: float
Bases: sas.plottools.plottables.Plottable
Theory plottable: line plot of x,y with confidence interval y.
Build a label mostly unique within a collection
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.
Representation of the data that might include a transformation
Remove negative value in x vector to avoid plotting negative value of Log10
Remove negative value in y vector to avoid plotting negative value of Log10
It limits View data range to plot from min to max
Parameters: |
|
---|
Reset x,y,dx and y in their full range and in the initial scale in case their previous range has changed
Return View x,y,dx,dy
Receive pointers to function that transform x and dx and set corresponding View pointers
Parameters: |
|
---|
Receive pointers to function that transform y and dy and set corresponding View pointers
Parameters: |
|
---|
Parameters: |
|
---|
This module overwrites matplotlib toolbar
Bases: matplotlib.backends.backend_wxagg.NavigationToolbar2WxAgg
Overwrite matplotlib toolbar
Plot menu
Reset plot
calculate error of sqrt(x)
Parameters: |
|
---|
calculate error of x^1/4
Parameters: |
|
---|
Calculate error on 1/sqrt(x)
calculate error on 1/x
calculate error of Log(x)
Parameters: |
|
---|
calculate error of Log(x)
Parameters: |
|
---|
calculate error of Log(xy)
calculate error of Log(yx**2)
error for ln(y*x^(4))
Parameters: | x – float value |
---|
calculate error of x**2
Parameters: |
|
---|
calculate error of x**2
Parameters: |
|
---|
calculate error of x**4
Parameters: |
|
---|
calculate error of x**2
Parameters: |
|
---|
error for (y*x^(4))
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View Calculate square root of x
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View Calculate square root of x
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View calculate log x
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View calculate log x
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View
Parameters: | x – Float value |
---|---|
Returns: | x |
This function is used to load value on Plottable.View
Calculate x^(2)
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View
Calculate x^(4)
Parameters: | x – float value |
---|
This function is used to load value on Plottable.View
Parameters: | x – Float value |
---|---|
Returns: | x |