Package qubx :: Module fit_space
[hide private]
[frames] | no frames]

Module fit_space

source code

Widget to display and control qubx.fit_robot.

Copyright 2008-2013 Research Foundation State University of New York This file is part of QUB Express.

QUB Express is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QUB Express is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License, named LICENSE.txt, in the QUB Express program directory. If not, see <http://www.gnu.org/licenses/>.

Classes [hide private]
  FitControls
Toolspace layers to control a qubx.fit_robots.FitSession.
  FitSpace
Mirrors and controls a qubx.fit_robot.FitRobot.
  StrategyDialog
  BaseFitSpaceCursor
Tracks mouse coordinates in a FitSpace.
  FitSpaceCursor
  FitSpaceModalCursor
  SubLayer_Correl
Displays a square matrix that has all entries -1 <= x <= 1, as a square subdivided into squares of color; see ScaleToColor.
  SubLayer_CorrelSquare
Displays one square from a matrix that has all entries -1 <= x <= 1, as a color and number; see ScaleToColor.
  Layer_Correl
Displays a large-size, labeled cross-correlation matrix, modally.
  Layer_Param
Presents details about one parameter, as when the user clicks "..." in the upper-left param list; you run() it like a dialog.
  SubLayer_FitIcon
Functions [hide private]
 
make_frame(w, h, appearance, controls_showing)
Returns (left, top, right, bottom) pixel coords, telling where to draw the graph given that the whole space has dimensions (w,h).
source code
 
make_x_transform(t0, t1, x0, x1)
Returns (x2t, t2x), where t=x2t(x) and x=t2x(t), mapping t in [t0..t1] to x in [x0..x1].
source code
 
make_y_transform(u0, u1, y0, y1)
Returns (y2u, u2y), where u=y2u(y) and y=u2y(u), mapping u in [u0..u1] to y in [y0..y1].
source code
 
gen_grid(u0, u1, z0, z1, appearance)
Yields successive gridline u-coordinates along one dimension.
source code
 
apply_zoom_axis(x0, x1, p0, p1) source code
 
zoom_axis(factor, p0, p1) source code
 
zoom_axis_at(factor, p, p0, p1) source code
 
pan_axis(dp, p0, p1) source code
 
draw_line(context, appearance, tt, uu, t2x, u2y, rad) source code
 
draw_hist(context, appearance, tt, uu, t2x, u2y, color, fill_color, hist_width=0.8) source code
 
draw_fit_icon(cr, w, h) source code
 
SafeName(nm)
Returns nm, modified to be a legal python identifier.
source code
 
read_data(f)
Returns (series, names) read from file-like object f.
source code
 
pick_xy(series, names, x_name, y_name)
Given (series, names) from read_data, and preferred x- and y- series names, returns the most appropriate 2 series.
source code
 
main() source code
 
PromptChartBounds(x0, y0, x1, y1, title=None, t0=None, d0=None, t1=None, d1=None) source code
Variables [hide private]
  COLOR_FITSPACE_BG = ('fit.bg', (1, 1, 1, 1))
  COLOR_FITSPACE_GRID = ('fit.grid', (0.3, 1, 0.3, 0.5))
  COLOR_FITSPACE_GRIDZERO = ('fit.gridzero', (1, 0.3, 0.3, 0.5))
  COLOR_FITSPACE_GRIDLBL = ('fit.gridlbl', (0, 0, 0, 1))
  COLOR_FITSPACE_DATA = ('fit.data', (0, 0, 0, 1))
  COLOR_FITSPACE_FILL = ('fit.fill', (0.5, 0.5, 0.5, 1))
  COLOR_FITSPACE_EXTRA = ('fit.extra', (0, 0, 1, 0.8))
  COLOR_FITSPACE_CURVE = ('fit.curve', (1, 0, 0, 0.8))
  COLOR_FITSPACE_LAYER = ('fit.layer', (1, 0.8, 0.33, 0.8))
  COLOR_FITSPACE_TEXT = ('fit.text', (0, 0.4, 0, 1))
  COLOR_FITSPACE_NUMBER = ('fit.number', (0, 0, 0, 1))
  COLOR_FITSPACE_BUTTON = ('fit.button', (0.7, 0, 0, 1))
  COLOR_CORREL_LBL = ('fit.correl.lbl', (1, 1, 1, 1))
  COLOR_FITSPACE_BACKBUTTON = ('fit.backbutton', (0.2, 0.3, 0.2,...
  LINE_EMS = 1.5
  FITFMT = '%.4g'
  ZOOM_SCROLL_FACTOR = 0.12
  TheFitCopyDialog = <CopyDialog object at 0x7fd1234b9410 (GtkDi...
  MAX_SERIES_NAME_LEN = 32
  FIT_SPACE_HELP = 'You can enter either a function, such as\n ...
  __package__ = 'qubx'
  e = 2.71828182846
  pi = 3.14159265359
Function Details [hide private]

gen_grid(u0, u1, z0, z1, appearance)

source code 

Yields successive gridline u-coordinates along one dimension.

Parameters:
  • u0 - lowest value showing
  • u1 - highest value showing
  • z0 - lowest x- or y- coord
  • z1 - highest x- or y- coord
  • appearance - qubx.toolspace.TS_Appearance

read_data(f)

source code 

Returns (series, names) read from file-like object f. The file should be tab- or comma-separated text. The first line can have column labels. Returns series, a list of numpy.array(dtype='float32'), one per column, and names, a list of str identifiers. Blank names are replaced with Y%i. If there's only one column, an ordinal series 'X' is prepended.

pick_xy(series, names, x_name, y_name)

source code 

Given (series, names) from read_data, and preferred x- and y- series names, returns the most appropriate 2 series.

Returns:
(x_series, y_series, index of x_series, index of y_series)

Variables Details [hide private]

COLOR_FITSPACE_BACKBUTTON

Value:
('fit.backbutton', (0.2, 0.3, 0.2, 1))

TheFitCopyDialog

Value:
<CopyDialog object at 0x7fd1234b9410 (GtkDialog at 0x2ff20e0)>

FIT_SPACE_HELP

Value:
'''You can enter either a function, such as
        amp * exp(-x / tau)
or a system of differential equations, such as
        y1\' = a*y2; y2\' = b*y1
The first integrated variable (e.g. y1) will be used for fitting.

You can use the minimum/maximum values of any variable, e.g.
        hi("y") - lo("y")
...