gtkgui Package

gtkgui Package

Package for the GUI using the GTK2 toolkit.

dialogs Module

Dialogs derived from GTK.

class plotpy.gtkgui.dialogs.ColorDialog(title='Select Color...', activation_callback=None, auto_apply=True)[source]

Bases: gtk.ColorSelectionDialog

A specific color selection to select plot colors.

run()[source]

Keep running if apply button is pressed.

class plotpy.gtkgui.dialogs.DataView(dataset, *args, **opts)[source]

Bases: gtk.Dialog

A dialog containing a gtk.TreeView widget with gtk.ListStore to display data from a MeasurementData object.

add_data()[source]

Add the data from the dataset to the treeview.

create_columns(columns)[source]

Add columns to the treeview.

edit_data(cellrenderertext, path, new_text)[source]

Change data inserted by user.

class plotpy.gtkgui.dialogs.ExportFileChooserDialog(width, height, *args, **opts)[source]

Bases: gtk.FileChooserDialog

A file chooser dialog with two entries for with and height of an export image.

get_with_height()[source]

Return width and height of the entries.

class plotpy.gtkgui.dialogs.FileImportDialog(current_folder, wildcards, template_folder=None, **options)[source]

Bases: gtk.FileChooserDialog

File chooser dialog with additional options for import templates.

add_ascii_wildcards()[source]

Add a list of wildcards for known ascii import filters.

add_wildcards(wildcards)[source]

Add a list of wildcards to the dialogs list.

Parameters:wildcards – sequance of items (name, pattern1, pattern2, ...).
clear_wildcards()[source]

Remove all wildcards active at the moment.

run()[source]

Open the dialog and wait for response. Returns the selected files, folder, template name.

run_template_chooser()[source]

Open a dialog to select a specific template for file import.

class plotpy.gtkgui.dialogs.FixedListEntry(fixed_list)[source]

Bases: gtk.Table

Multiple item entry with labels.

class plotpy.gtkgui.dialogs.ImportWizard(file_name, title='Define ASCII import filter...', presets=None)[source]

Bases: gtk.Dialog

A wizard dialog to import data using an AsciiImportFilter object. The results can be interactively observed while changing settings.

run()[source]

Until OK or Cancel is pressed test the filter as preview.

class plotpy.gtkgui.dialogs.LabelArrowDialog(dataset, parent, title='Labels/Lines/Arrows/Rectangles', buttons=('New', 3, 'Apply', 2, 'OK', 1, 'Cancel', 0))[source]

Bases: gtk.Dialog

A tabed dialog with entries for labels, arrows/lines.

class plotpy.gtkgui.dialogs.MouseReader(title, window)[source]

Bases: gtk.Dialog

A simple dialog window used to retrieve a position on the plot.

callback(position)[source]

Called when the mouse button is pressed on the plot.

run()[source]

Like Dialog.run but works with mouse callback.

class plotpy.gtkgui.dialogs.MultipeakDialog(fit_class, fit_object, main_window, *args, **opts)[source]

Bases: gtk.Dialog

A dialog to fit multiple peaks to a given dataset.

add_peak(fit, cov)[source]

Add a new peak to the table of fits and the dialog.

Parameters:
  • fit – FitFunction object.
  • cov – Covariance matrix of the last fit
autodetect_peaks()[source]

Use CWD peak finder to automatically detect peaks.

cleanup(action=None)[source]

On delete remove the callback function.

collect_positions()[source]

Get values from all fits.

fit_peak(widget=None, action=None, peak_xy=None)[source]

Fit a new function to the peak position defined in the dialog or by mouse click.

register_mouse_callback()[source]

Set the callback function to be used when selecting a position with the mouse button.

remove_peak(item=-1)[source]

Remove the last fited peak.

run()[source]

Show the dialog and wait for input. Return the result as Dictionary and a boolen definig if the Dialog was closed or OK was pressed.

class plotpy.gtkgui.dialogs.OptionSwitchSelection(options)[source]

Bases: gtk.Table

A widget containing a radio button selector to choose between different subentries. Every not selected entries are deactivated.

class plotpy.gtkgui.dialogs.PatternListEntry(pattern_list)[source]

Bases: gtk.Table

An entry for string lists which contains entries and add/remove buttons.

class plotpy.gtkgui.dialogs.PlotTree(data_dict, connected_function, *args, **opts)[source]

Bases: gtk.Dialog

A dialog containing a gtk.TreeView widget with gtk.TreeStore to display plots imported from all files.

add_data()[source]

Add the data from the dictionary to the treeview.

create_columns()[source]

Add columns to the treeview.

create_preview(widget, action)[source]

Create a preview of the datasets and render it onto an image.

cursor_changed(widget)[source]

If an item is selected call a function with the corresponding key and index.

expand_all(widget, action)[source]

Expand all files.

set_focus_item(key, index)[source]

Highlight an item.

set_preview_parameters(plot_function, session, temp_file)[source]

Connect objects needed for preview creation.

show_all()[source]

Chow the dialog and make it transient for it’s parent.

class plotpy.gtkgui.dialogs.PreviewDialog(data_dict, show_previews=False, single_selection=False, **opts)[source]

Bases: gtk.Dialog

A dialog to show a list of plot previews to give the user the possibility to select one or more plots.

add_line(key, datalist)[source]

Add one line of previews to the main table.

Parameters:
  • key – The name of the file the previews in this line belong to.
  • datalist – List of MeasurementData object.
create_preview()[source]

Create an preview of the dataset and render it onto image.

get_active_dictionary()[source]

Return a dictionary with lists of active objects.

get_active_keys()[source]

Return the keys and indices of the activeded check_box widgets.

get_active_objects()[source]

Return a list of data object for which the checkbox is set.

get_active_objects_with_key()[source]

Return a list of data object for which the checkbox is set.

get_preview(dataset)[source]

Create an image as preview, if the dataset has no preview, add it to the list of unset previews.

get_scrolled_main_table()[source]

Create the Table which holds all previews with scrollbars.

Returns:The Table widget
run()[source]

Called to show the dialog and create unset previews.

select_all(widget, action)[source]

Select all entries of all files.

select_none(widget, action)[source]

Unselect all entries of all files.

set_preview_parameters(plot_function, session, temp_file)[source]

Connect objects needed for preview creation.

toggle_entries(widget, check_boxes, set_value)[source]

Toggle all entreis in check_boxes to set_value.

toggle_previews(widget)[source]

Show or hide all previews.

class plotpy.gtkgui.dialogs.PrintDatasetDialog(datasets, main_window, resolution=300, multiplot=False)[source]

Creating this class will create a gtk.PrintOperation and open a printing Dialog to print the datasets, supplied to the constructor. The datasets are exported to high-resolution PNG files and after processing through cairo get send to the Printer.

create_custom_widgets(operation)[source]

Create a table with custom entries for the print Dialog.

do_print()[source]

Create a PrintOperation with the number of pages corresponding to the number of datasets. Afterwards the Printing dialog is run.

multiplot(dataset_list)[source]

Method to create one multiplot in print quality.

plot(dataset)[source]

Method to create one plot in print quality.

preview(operation, preview, context, parent)[source]

Create a preview of the plots to be printed.

print_page(operation=None, context=None, page_nr=None)[source]

Method called for every page to be rendered. Creates the plot and imports,draws it with cairo.

Parameters:
  • operation – gtk.PrintOperation
  • context – gtk.PrintContext
  • current – page number
read_custom_widgets(operation, widget)[source]

Read the settings supplied by the user.

class plotpy.gtkgui.dialogs.SettingsNotebook(object_, pages)[source]

Bases: gtk.Notebook

A notebook widget which automatically build entries for a supplied object with a defined set of parameter names. The objects parameters are automatically changed when entries are changed.

add_settings_page(page_name, page, page_info)[source]

Add page with entries for each parameter supplied as a list (name, parameter).

get_settings_entry(parameter)[source]

Retrieve an attribute of the origin object and add an entry according to the type of the attribute.

class plotpy.gtkgui.dialogs.SimpleEntryDialog(title, entries, *args, **opts)[source]

Bases: gtk.Dialog

A dialog with user defined entries. The values of the entries are converted to a given type and then returned when run() is called.

cleanup(action)[source]

On delete remove the callback function.

collect_entries()[source]

Get values from all entry widgets and convert them. If conversion fails don’t change the values.

register_mouse_callback(window, entries)[source]

Set the callback function to be used when selecting a position with the mouse button.

run()[source]

Show the dialog and wait for input. Return the result as Dictionary and a boolen definig if the Dialog was closed or OK was pressed.

class plotpy.gtkgui.dialogs.StatusDialog(title=None, parent=None, flags=0, buttons=None, initial_text='')[source]

Bases: gtk.Dialog

A Dialog to show a changing text with scrollbar.

write(text)[source]

Append a string to the buffer and scroll at the end, if it was visible before.

class plotpy.gtkgui.dialogs.StringListEntry(string_list)[source]

Bases: gtk.Table

An entry for string lists which contains entries and add/remove buttons.

class plotpy.gtkgui.dialogs.StyleLine(plot_options, callback)[source]

Bases: gtk.Table

A line of options for plot styles.

change_color(widget)[source]

Open a color selection dialog.

process_changes(widget, key)[source]

Change style properties and activate the callback function.

toggle_custom_action(widget)[source]

Activate or deactivate custom settings for the plot.

plotpy.gtkgui.dialogs.connect_stdout_dialog()[source]

Replace sys.stdout with a dialog window.

Returns:The dialog window.

diverse_classes Module

Additional classes which use GTK functionalities.

class plotpy.gtkgui.diverse_classes.MultiplotList(input_list)[source]

Bases: list

A list of measurements for a multiplot.

class plotpy.gtkgui.diverse_classes.PlotProfile(name)[source]

Class for storing a profile of plot options for later use.

load(active_class)[source]

Load a stored plot options profile.

prnt()[source]

Show the profile settings.

read(config_object)[source]

Read a profile from a dictionary, see write.

save(active_class)[source]

Save the active plot settings as a Profile.

write(config_object)[source]

Export the profile settings to a dictionary which is needed to store it with the ConfigObj.

class plotpy.gtkgui.diverse_classes.RedirectError(plotting_session)[source]

Bases: plotpy.gtkgui.diverse_classes.RedirectOutput

Class to redirect all error messages to a message dialog when using the GUI. The message dialog has an option to export a bugreport, which includes the active measurement to help debugging.

flush()[source]

Make sure the dialog is shown and it is waited for response before the program exits/continues.

response(dialog, response_id)[source]

Hide the dialog on response and export debug information if response was OK.

Parameters:
  • dialog – The message dialog
  • response_id – The dialog response ID
write(string)[source]

Add content and show the dialog.

Parameters:string – Output string of stderr
class plotpy.gtkgui.diverse_classes.RedirectOutput(plotting_session)[source]

Bases: object

Class to redirect all print statements to the statusbar when using the GUI.

flush()[source]

Show last content line in statusbar.

write(string)[source]

Add content.

Parameters:string – Output string of stdout

dnd_handling Module

Drag and drop handling for the gui.

class plotpy.gtkgui.dnd_handling.ImageDND(main_window)[source]

Bases: object

Handling of Drag&Drop for the main image.

receive_data(widget, context, x, y, selection, targetType, time)[source]

Extract the file names and import the files.

send_data(widget, context, selection, targetType, eventTime)[source]

Drag the image to a folder.

set_drag_icon(widget, drag_context, data)[source]

Set up the drag icon.

file_actions Module

Module for data treatment and macro processing.

class plotpy.gtkgui.file_actions.FileActions(window)[source]

A Class designed to preform simple operations on one dataset and to store those in a history for later macro processing.

activate_action(action, *args)[source]

Every action performed by this class is stored so it can be shown in a log or reused in makros for other sequences.

Parameters:
  • action – The function to be called
  • args – The arguments of that function
Returns:

Return values of the called function

change_color_pattern(pattern)[source]

Change the color palette used in pm3d plots.

Parameters:pattern – pattern The string used for the palette in gnuplot
change_data_filter(filters)[source]

Change the filter settings of a MeasurementData object.

combine_data_points(binning, bin_distance=None)[source]

Combine points of a line scan to decrease their errors.

create_cross_section(x, x_0, y, y_0, w, binning, gauss_weighting=False, sigma_gauss=10000000000.0, bin_distance=None)[source]

Create a cross-section of 3d-data along an arbitrary line. It is possible to bin the extracted data and to weight the binning with a gaussian.

create_fit_object()[source]

Creates an FitSession object for data fitting and binds it to the active dataset.

create_radial_integration(x_0, y_0, dr, max_r, phi_0=0.0, dphi=180.0, symmetric=True)[source]

Create a radial integration around one point (x_0,y_0)

Parameters:
  • x_0 – x-position of the center point
  • y_0 – y-position of the center point
  • dr – Step size in radius for the created plot
  • max_r – Maximal radius to integrate to
  • phi – Direction of radian
  • dphi – Width of arc
  • symmetric – Join negative and positive directions
cross_section(x, x_0, y, y_0, w, binning, gauss_weighting=False, sigma_gauss=10000000000.0, at_end=False, bin_distance=None)[source]

Create a slice through a dataset using the create_cross_section function. This funcion is called as the action.

Parameters:
  • binning – Number of points to take a mean value of
  • gauss_weighting – If mean value of points is calculated the points are weighted by the distance to the crossection line
  • sigma_gauss – Sigma value of the gauss function used for weighting the points
  • at_end – Put the created picture at the end of the plot list, not after the picture it was created from
  • bin_distance – Use a specific distance window for binning, not a fix number of points
Returns:

If the extraction has been sucessful

do_interpolate_and_smooth(sigma_x, sigma_y, xfrom, xto, xsteps, yfrom, yto, ysteps, do_append=True)[source]

Interpolate the active dataset to a regular grid including smoothing using given parameters.

do_rebin_2d(join_pixels_x, join_pixels_y=None, do_append=True)[source]

Interpolate the active dataset to a regular grid including smoothing using given parameters.

get_butterworth(filter_steepness=6, filter_cutoff=0.5, derivative=1, at_end=False)[source]

See calculate_butterworth.

get_discrete_derivative(at_end=False)[source]

See calculate_discrete_derivative.

get_integral(at_end=False)[source]

See calculate_integral.

get_savitzky_golay(window_size=5, order=4, derivative=1, at_end=False)[source]

See calculate_savitzky_golay.

integrate_around_point(x_pos, y_pos, radius, dataset)[source]

Integrate the intensities of dataset around the point (x_pos, y_pos) up to a distance radius.

Returns:The average of the integrated values with their errors.
integrate_intensities(x_pos, y_pos, radius, destination_dimension, destination_unit, dataset_indices, dataset_destination_values)[source]

Integrate the intensities of differt datasets around the position (x_pos, y_pos) up to a distance radius.

Parameters:
  • x_pos – X-position of the reflex to be integrated
  • y_pos – Y-position of the reflex to be integrated
  • radius – Maximal distance from (x_pos,y_pos) to which points are included
  • destination_dimension – The dimension of the values in x to which the integrated points should be assigned to
  • destination_unit – The unit of the values in x to which the integrated points should be assigned to
  • dataset_indices – a list of (‘name’, i) to define the datasets to be integrated
  • dataset_destination_values – The x value of all datasets from dataset_indices
iterate_through_measurements(action_name)[source]

Change the active plotted sequence.

radial_integration(x_0, y_0, dr, max_r, phi_0=0.0, dphi=180.0, symmetric=True, at_end=False)[source]

Create a radial integration around one point of a dataset

Parameters:
  • x_0 – Center point x position
  • y_0 – Center point y position
  • dr – Step width in radius
  • max_r – Maximal radius to integrate to
Returns:

If the extraction has been sucessful

reactivate_action(action)[source]

Run an action without storing it in the history. Used when running a makro.

Parameters:action – Function and parameters to use.
Returns:Return values of the funciton
run_makro(makro)[source]

Execute the actions from a MakroRepr object.

sort_and_bin(data, binning, gauss_weighting=False, sigma_gauss=10000000000.0, bin_distance=None)[source]

Sort a dataset and bin the datapoints together. Gaussian weighting is possible and errors are calculated.

Parameters:data – A list of data points consisting of (x0, x1, x2, y, dy, weighting)
Returns:Binned dataset
store(from_index=None, to_index=None)[source]

Store a subset of the history actions as a MakroRepr object.

Returns:The MakroRepr object
unit_transformations(transformations)[source]

Make a unit transformation with the active dataset.

Parameters:transformations – A sequence of the transformation settings
class plotpy.gtkgui.file_actions.MakroRepr[source]

FileObject implementation to store makros in string representation. The class can be used to store general types with ConfigObj.

close()[source]

Dummifunction to complete file object possibilities.

flush()[source]

Dummifunction to complete file object possibilities.

from_string(string)[source]

Recreate makro from string representation.

next()[source]

Dummifunction to complete file object possibilities.

read()[source]

Simulate read from file object.

readline()[source]

Simulate readline, see read.

readlines()[source]

Simulate readlines, see read.

seek()[source]

Dummifunction to complete file object possibilities.

string = None

Stringrepresentation of the data.

tell()[source]

Dummifunction to complete file object possibilities.

write(string)[source]

As the write method from files this adds the input to it’s own string.

writelines(list_lines)[source]

Simulate writelines, see write.

plotpy.gtkgui.file_actions.calculate_butterworth(dataset, filter_steepness=6, filter_cutoff=0.5, derivative=1)[source]

Calculate a smoothed function as spectral estimate with a Butterworth low-pass filter in frouier space. This can be used to calculate derivatives.

S. Smith, The Scientist and Engineer’s Guide to Digital Signal Processing, California Technical Publishing, 1997.
Parameters:
  • dataset – MeasurementData object to be used as input
  • filter_steepness – The steepness of the low pass filter after the cut-off frequency
  • filter_cutoff – The frequency (as parts from the maximal frequency) where the filter cut-off lies
  • derivative – Which derivative to calculate with this method.
Returns:

a dataset containing the derivated data

plotpy.gtkgui.file_actions.calculate_discrete_derivative(dataset, points=5)[source]

Calculate the derivative of a dataset using step-by-step calculations. Not so nice results as the other methods but stable and independent of x-spacing.

plotpy.gtkgui.file_actions.calculate_integral(dataset)[source]

Calculate the integral of a dataset using the trapezoidal rule.

plotpy.gtkgui.file_actions.calculate_savitzky_golay(dataset, window_size=5, order=2, derivative=1)[source]

Calculate smoothed dataset with savitzky golay filter up to a maximal derivative.

Parameters:
  • dataset – The dataset to use for the data
  • window_size – Size of the filter window in points
  • order – Order of polynomials to be used for the filtering
  • derivative – The derivative to be calculated
Returns:

a dataset containing the smoothed data and it’s derivatives.

plotpy.gtkgui.file_actions.interpolate_and_smooth(dataset, sigma_x, sigma_y, grid_x, grid_y, use_matrix_data_output=False, fill_value=(0.0, 1.0))[source]

Fill a grid with datapoints from another grid, weighting the points with a gaussian up to a distance of 3*sigma.

Parameters:
  • dataset – MeasurementData object to be used as source_synopsis
  • sigma_x – Sigma for the gaussian weighting in x direction
  • sigmy_y – Sigma for the gaussian weighting in y direction
  • grid_xy – List of (x,y) tuples for the new grid
Returns:

MeasurementData or HugeMD object with the rebinned data

plotpy.gtkgui.file_actions.rebin_2d(dataset, join_pixels_x, join_pixels_y=None, use_matrix_data_output=False)[source]

Rebin data on a regular grid by summing up pixels in x and y direction.

Parameters:
  • dataset – MeasurementData object as source
  • join_pixels_x – Number of pixels to sum together in x direction
  • join_pixels_y – Number of pixels to sum together in y direction, if None use x
Returns:

New MeasurementData object with the rebinned data

plotpy.gtkgui.file_actions.savitzky_golay(y, window_size, order, deriv=0)[source]

Smooth (and optionally differentiate) data with a Savitzky-Golay filter. The Savitzky-Golay filter removes high frequency noise from data. It has the advantage of preserving the original shape and features of the signal better than other types of filtering approaches, such as moving averages techhniques.

Notes:

The Savitzky-Golay is a type of low-pass filter, particularly suited for smoothing noisy data. The main idea behind this approach is to make for each point a least-square fit with a polynomial of high order over a odd-sized window centered at the point.

. [1] A. Savitzky, M. J. E. Golay, Smoothing and Differentiation of
Data by Simplified Least Squares Procedures. Analytical Chemistry, 1964, 36 (8), pp 1627-1639.
. [2] Numerical Recipes 3rd Edition: The Art of Scientific Computing
W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery Cambridge University Press ISBN-13: 9780521880688
Parameters:
  • y – the values of the time history of the signal (array)
  • window_size – the length of the window, must be an odd integer number.
  • order – the order of the polynomial used in the filtering, must be less then window_size - 1.
  • deriv – the order of the derivative to compute (default = 0 means only smoothing)
Returns:

ys the smoothed signal (or it’s n-th derivative).

fio_dialogs Module

Dialogs for file input and output options.

class plotpy.gtkgui.fio_dialogs.ReaderOptionDialog(reader, name, defaults, default_units={}, default_description={}, path='.')[source]

Bases: gtk.Dialog

A automatically generated dialog to enter options for a file reader. A default dictrionary is used to select the appropriate entries to choose.

plotpy.gtkgui.fio_dialogs.reader_kwd_callback(reader, path, name)[source]

Check if there are appropriate preset settings for the file and reader and if not open a dialog for the user to define these settings.

gui_fit_data Module

GTK GUI functions for data fitting.

ipython_view Module

Backend to the console plugin.

author: Eitan Isaacson organization: IBM Corporation copyright: Copyright (c) 2007 IBM Corporation license: BSD

All rights reserved. This program and the accompanying materials are made available under the terms of the BSD which accompanies this distribution, and is available at U{http://www.opensource.org/licenses/bsd-license.php}

class plotpy.gtkgui.ipython_view.FitCaller(parent, fit_class)[source]

Bases: object

A class to create a specific fit object for the current dataset.

FitCallser.parameters is a list of (name,value) tuples for the default parameters.

class plotpy.gtkgui.ipython_view.FitSubWrapper(fit_session, main_window, active_session, items)[source]

Bases: object

Class to provide easy fit from the IPython console.

class plotpy.gtkgui.ipython_view.FitWrapper(main_window, active_session)[source]

Bases: object

Class to provide easy fit from the IPython console.

class plotpy.gtkgui.ipython_view.MenuWrapper(menu_root)[source]

Bases: object

Class to provide GUI menu access as attributes of a interactive object. Every attribute of this object should be hidden for the user.

ipython_view_new Module

Backend to the console plugin.

author: Eitan Isaacson organization: IBM Corporation copyright: Copyright (c) 2007 IBM Corporation license: BSD

All rights reserved. This program and the accompanying materials are made available under the terms of the BSD which accompanies this distribution, and is available at U{http://www.opensource.org/licenses/bsd-license.php}

class plotpy.gtkgui.ipython_view_new.FitCaller(parent, fit_class)[source]

Bases: object

A class to create a specific fit object for the current dataset.

FitCallser.parameters is a list of (name,value) tuples for the default parameters.

class plotpy.gtkgui.ipython_view_new.FitSubWrapper(fit_session, main_window, active_session, items)[source]

Bases: object

Class to provide easy fit from the IPython console.

class plotpy.gtkgui.ipython_view_new.FitWrapper(main_window, active_session)[source]

Bases: object

Class to provide easy fit from the IPython console.

class plotpy.gtkgui.ipython_view_new.MenuWrapper(menu_root)[source]

Bases: object

Class to provide GUI menu access as attributes of a interactive object. Every attribute of this object should be hidden for the user.

main_window Module

Main window class for all sessions.

class plotpy.gtkgui.main_window.ApplicationMainWindow(active_session=None, parent=None, script_suf='', status_dialog=None)[source]

Bases: gtk.Window, plotpy.gtkgui.main_window_ui.MainUI, plotpy.gtkgui.main_window_actions.MainActions

Main window of the GUI. Everything the GUI does is in this Class. User interface is defined in MainUI, actions in MainActions, which is derived from different other action classes

main_quit(action=None, store_config=True)[source]

When window is closed save the settings in home folder. All open dialogs are closed before exit.

plotpy.gtkgui.main_window.main_loop(session)[source]

Start the main loop.

main_window_ui Module

Main window user interface class for all sessions.

class plotpy.gtkgui.main_window_ui.MainUI[source]

Bases: object

User Interface (Menu Toolbar) for the main window.

build_menu()[source]

Create XML text for the menu and toolbar creation. In addition the variable actions are stored in a list. (See __create_action_group function) The XML text is used for the UIManager to create the bars,for more information see the pygtk documentation for the UIManager.

Returns:XML string for all menus and toolbar.
create_action_group()[source]

Create actions for menus and toolbar. Every entry creates a gtk.Action and the function returns a gtk.ActionGroup. When the action is triggered it calls a function. For more information see the pygtk documentation for the UIManager and ActionGroups.

Returns:ActionGroup for all menu entries.
rebuild_menus()[source]

Build new menu and toolbar structure.

replace_icon(item, imgfile)[source]

Cange the icon of one toolbar button to a user defined file. The file gets scaled to fit in a 24x24 pix button.

show_add_info(action)[source]

Show or hide advanced options widgets.

main_window_actions Module

Main window action class for all sessions.

class plotpy.gtkgui.main_window_actions.MainActions[source]

Bases: plotpy.gtkgui.main_window_file.MainFile, plotpy.gtkgui.main_window_data_treatment.MainData, plotpy.gtkgui.main_window_plotting.MainPlotting, plotpy.gtkgui.main_window_mouse.MainMouse

Combined actions used in the main window.

action_history(action)[source]

A list of all previous actions, that can be executed as makro actions. Will be rewritten as log and makro recording functions.

activate_about(action)[source]

Show the about dialog.

activate_plugins()[source]

If a plugin defines an activate function and the active session is in the list of sessions the function gets called.

add_multiplot(action)[source]

Add or remove the active dataset from multiplot list, which is a list of plotnumbers of the same Type.

change_active_file(action)[source]

Change the active datafile for plotted sequences.

change_active_file_object(measurements, index_mess=0)[source]

Change the active file measurements from which the plotted sequences are extracted.

Parameters:measurements – A list of MeasurementData objects from one file
change_session(action=None, transfere=None)[source]

Change the session type used to import Data.

Parameters:transfere – A dictionary of measurements to be trasfered to the new session
check_for_update_now()[source]

Read the wiki download area page to see, if there is a new version available.

Returns:Newer version number or None
check_for_updates(action=None)[source]

Function to check for upates if this was selected and to show a dialog, if an updat is possible.

closed_ipy_console(widget, oldstd)[source]

Unregister the ipython dialog when it gets destroyed.

connect_cluster(action)[source]

Open a dialog to connect to IPython Cluster.

deactivate_plugins()[source]

If a plugin defines an activate function and the active session is in the list of sessions the function gets called.

do_add_multiplot(index)[source]

Add one item to multiplot list devided by plots of the same type.

do_multi_fit(action, entries, fit_dialog, window)[source]

Called when the fit button on a multi fit dialog is pressed.

edit_user_config(action)[source]

Open a dialog to edit the user config file.

fit_dialog(action, size=None, position=None)[source]

A dialog to fit the data with a set of functions.

Parameters:
  • size – Window size (x,y)
  • position – Window position (x,y)
get_dataset_selection(action, datasets, dataset_table, data_list)[source]

Create a selection button for datasets and attach it to the dataset_table widget.

get_first_in_mp()[source]

Return the first dataset in an active multiplot.

get_position_selection(action, int_points, position_table)[source]

Return selection entries for x,y positions.

iterate_through_measurements(action)[source]

Change the active plot with arrows in toolbar.

multi_fit_dialog(action, size=(800, 250), position=None)[source]

A dialog to fit several data with a set of functions.

Parameters:
  • size – Window size (x,y)
  • position – Window position (x,y)
open_ipy_console(action=None, commands=[], show_greetings=True)[source]

This opens a window with an IPython console, which has direct access to all important objects.

plot_tree_configure(widget, event)[source]

Store plot tree dialog position and size.

plot_tree_on_delete(*ignore)[source]

Store closed plot tree dialog option.

print_plot(action)[source]

Opens a Print dialog to print the active or a selection of plots.

print_plot_dialog(action)[source]

Opens a Print dialog to print the active or a selection of plots.

remove_active_plot(action)[source]

Remove the active plot from this session.

reset_statusbar()[source]

Clear the statusbar.

run_action_makro(action)[source]

Execute a list of actions as a makro. The actions are given in a textfield, in the future there will be makro recording and saving functions.

run_last_action_makro(action)[source]

Reexecute the last makro.

set_delete_name(action)[source]

Set self.delete_name from entry object.

show_config_path(action)[source]

Show a dialog with the path to the config files.

show_plot_tree(action=None)[source]

Show the plot tree window.

show_status_dialog(action)[source]

Show the dialog which holds the file import informations.

toggle_multiplot_copymode(action)[source]

Toggle between copy and non-copy mode in multiplot.

transfere_datasets(action)[source]

Open a selection dialog to transfere datasets to another session.

unix_lpr_pring(action)[source]

Print plot with unix commandline tool.

update_size(widget, event)[source]

If resize event is triggered the window size variables are changed.

update_tree(key, index)[source]

Update the active plot from the treeview.

plotpy.gtkgui.main_window_actions.apihelp(*ignore)[source]

Open the API reference manual in a webbrowser.

Returns:Return value of webbrowser.open

main_window_data_treatment Module

Main window action class for data treatment.

class plotpy.gtkgui.main_window_data_treatment.MainData[source]

Bases: object

Data treatment actions.

change_data_filter(action)[source]

A dialog to select filters, that remove points from the plotted dataset.

change_data_filter_response(filter_dialog, response, table, filters, data)[source]

Response actions for the add data filter dialog.

combine_data_points(action)[source]

Open a dialog to combine data points together to get a better statistic.

correct_offset(action)[source]

Simple xy-offset correction.

create_transformations(items, units, dimensions)[source]

Read the transformation values from the entry widgets in ‘items’.

dataview_response(widget, id_, unchanged_dataset)[source]

Button on dataview pressed.

derivate_data(action)[source]

Derivate or smooth data using the local Savitzky Golay filter or the global spectral estimate method calculated with a Butterworth filter.

extract_cross_section(action)[source]

Open a dialog to select a cross-section through an 3D-dataset. The user can select a line and width for the cross-section, after this the data is extracted and appendet to the fileobject.

Returns:If the extraction was successful
extract_integrated_intensities(action)[source]

Open a dialog to select points and datasets for integration of intensities. Measured data around that point is avaridged and plotted agains a user defined value.

Returns:If the extraction was successful
extract_radial_integration(action)[source]

Open a dialog to select point as center of a radial integration.

Returns:If the extraction was successful
get_new_filter(table, row, data, parameters=(-1, 0, 0, False))[source]

Create all widgets for the filter selection of one filter in change_data_filter dialog and place them in a table.

Returns:Sequence of the created widgets.
get_new_transformation(transformations, dialog_table, list_, units, dimensions)[source]

Create a entry field line for a unit transformation.

integrate_data(action)[source]

Integrate dataset using the trapezoidal rule.

interpolate_and_smooth_dialog(action)[source]

Dialog to select the options for interpolation and smoothing of 2d-data into a regular grid.

normalize_data(action)[source]

Simple xy-offset correction.

open_dataview_dialog(action)[source]

Open a Dialog with the data of the current plot, which can also be edited.

peak_finder(action)[source]

Find peaks using continous wavelet transform peakfinder. Ither opens a dialog to select the search parameters or uses saved preset parameters.

peak_info(action)[source]

Calculate peak parameters and set a label accordigly.

rebin_3d_data_dialog(action)[source]

Dialog to select the options for interpolation and smoothing of 2d-data into a regular grid.

remove_transformation(action, item, table, list_)[source]

Nothing jet.

show_integrated_intensities(int_int_values)[source]

Show a Dialog with the values of the integrated intensities calculated in extract_integrated_intensities

Parameters:int_int_values – List of (x-position,y-position,value,error) for the intensities
unit_transformation(action)[source]

Open a dialog to transform the units and dimensions of one dataset. A set of common unit transformations is stored in config.transformations.

main_window_file Module

Main window action class for file import/export.

class plotpy.gtkgui.main_window_file.MainFile[source]

Bases: object

File Import/Export actions.

add_file(action=None, hide_status=True, file_names=None)[source]

Import one or more new datafiles of the same type.

Returns:List of names that have been imported.
change_ascii_import_filter(action)[source]
export_all()[source]

Open a Dialog to select which Plots to export with additional options.

export_clipboard(action)[source]

Export the active dataset as text to clipboard.

export_plot(action)[source]

Function for every export action. Export is made as .png or .ps depending on the selected file name. Save is made as gnuplot file and output files.

load_snapshot(action)[source]

Load a snapshot of earlier work.

new_ascii_import_filter(file_name)[source]

Import one or more new datafiles of the same type.

Returns:List of names that have been imported.
read_config_file()[source]

Read the options that have been stored in a config file in an earlier session. The ConfigObj python module is used to save the settings in an .ini file as this is an easy way to store dictionaries.

Returns:If the import was successful.
read_window_config()[source]

Read the window config parameters from the ConfigObj.

save_snapshot(action)[source]

Save a snapshot of the active work.

main_window_mouse Module

Main window mouse actions.

class plotpy.gtkgui.main_window_mouse.MainMouse[source]

Bases: object

Mouse movement actions.

catch_mouse_position(widget, action)[source]

Get the current mouse position when the pointer was mooved on to of the image.

get_position_on_plot()[source]

Calculate the position of the mouse cursor on the plot. If the cursor is outside, return None.

mouse_press(widget, action)[source]

Catch mouse press event on image.

mouse_release(widget, action)[source]

Catch mouse release event.

toggle_mouse_mode(action=None)[source]

Activate/Deactivate cursor mode.

update_picture(widget, event)[source]

After releasing the mouse the picture gets replot.

main_window_plotting Module

Main window action class for data plotting.

class plotpy.gtkgui.main_window_plotting.MainPlotting[source]

Bases: object

Plotting actions

apply_to_all(action)[source]

Apply changed plotsettings to all plots. This includes x,y,z-ranges, logarithmic plotting and the custom plot settings.

change(action)[source]

Change different plot settings triggered by different events.

Parameters:action – The action that triggered the event
change_color_pattern(action)[source]

Open a dialog to select a different color pattern. The colorpatterns are defined in config.gnuplot_preferences.

change_plot_options(widget, action, terminal_png, terminal_ps, x_label, y_label, z_label, plotting_parameters, plotting_parameters_errorbars, plotting_parameters_3d, plotting_settings_3d, plotting_settings_3dmap)[source]

Plot with new commands from dialog window. Gets triggerd when the apply button is pressed.

change_plot_style(action)[source]

Open a Dialog to chang the style of the current plot.

change_range(action)[source]

Change plotting range_ according to textinput.

close_plot_options_window(dialog)[source]

Reroute the plot options button and remove the textbox when dialog is closed. If this is not done, the textbox gets destroyed and we can’t reopen the dialog.

Parameters:
  • dialog – The dialog widget that will be closed
  • sw – The scrolledWindow to be unpluged before closing.
colorcode_points(action)[source]

Show points colorcoded by their number.

delete_profile(action)[source]

Delete a plot profile.

image_resize(widget, rectangel)[source]

Scale the image during a resize.

initialize_gnuplot()[source]

Check gnuplot version for capabilities.

load_profile(action)[source]

Load a plot profile.

open_plot_options_window(action)[source]

Open a dialog window to insert additional gnuplot commands. After opening the button is rerouted.

plot(session, datasets, file_name_prefix, title, names, with_errorbars, output_file='[name]_[add_info][nr].png', fit_lorentz=False, sample_name=None, show_persistent=False)[source]

Plot via script file instead of using python gnuplot pipeing.

Returns:Gnuplot error messages, which have been reported
plot_persistent(action=None)[source]

Open a persistent gnuplot window.

replot(echo=True)[source]

Recreate the current plot and clear the statusbar.

save_profile(action)[source]

Save a plot profile.

set_image()[source]

Show the image created by gnuplot.

show_last_plot_params(action)[source]

Show a text window with the text, that would be used for gnuplot to plot the current measurement. Last gnuplot errors are shown below, if there have been any.

toggle_error_bars(action)[source]

Show or remove error bars in plots.

toggle_xyprojections(action)[source]

Show or remove error bars in plots.

multiplots Module

Widgets for multiplot storage and displaying.

class plotpy.gtkgui.multiplots.ItemSortAdd(items, parent, do_replot=True)[source]

Bases: gtk.Dialog

A dialog to sort a MultiplotItem list or add new items.

class plotpy.gtkgui.multiplots.MultiplotCanvas(parent)[source]

Bases: gtk.Table

A list of MultiplotItem objects with buttons to select one and additional options.

get_list()[source]

Return a list of MultiplotList objects.

new_from_list(items_list)[source]

Clear all multiplots and creat new ones from a list of items.

new_item(items=None)[source]

Add a new MultiplotItem to the list.

select_item(index)[source]

Define the active selection.

update_labels()[source]

Reload all labels of all MultiplotItem objects.

class plotpy.gtkgui.multiplots.MultiplotItem(items=None)[source]

Bases: gtk.HBox

A list which contains all subplots for a multiplot.

append(item, just_labels=False)[source]

Add a dataset to the list of items. The dataset gets copied to make it possible to change plot settings and columns multiplot specific.

reorder_child(child, position)[source]

Change the order of the MultiplotList and the displayed items.

update_labels()[source]

Redefine the labels for all datasets.

peakfinder Module

Dialog for peakfinder algorithm.

class plotpy.gtkgui.peakfinder.FitMultiGauss(peak_params)[source]

Bases: plotpy.fitdata.FitFunction

Fit multiple Gauss functions including linear interpolated background.

fit_function(p, x)[source]

Gaussian functions for each peak.

class plotpy.gtkgui.peakfinder.FitSummary(parameter_names, parameters, **opts)[source]

Bases: gtk.Dialog

Dialog with a treeview of the peak data.

add_data(parameters)[source]

Add the data to the treeview.

create_columns()[source]

Add columns to the treeview.

class plotpy.gtkgui.peakfinder.PeakFinderDialog(parent, dataset, title='Peak Finder Parameters')[source]

Bases: gtk.Dialog

A dialog to select the peakfinder parameters and interactively plot the resulting peak positions.

plotpy.gtkgui.peakfinder.fit_result(peaks, ds, parent_window=None, summary=False)[source]

Fit Gaussians to the peaks found.

plotpy.gtkgui.peakfinder.peaks_from_preset(ds, preset, parent_window=None, summary=False)[source]

Return peak positions using parameters from a preset.

reflectometer_functions Module

Functions for reflectometer and treff sessions to work with fortran fit program. They only work if imported inside a plotting session and are expanded with specific functions in the session source code.