Table Of Contents

Previous topic

Utility Routines

Next topic

Change History

This Page

Graphical User Interface for Lake/Jemian desmearing

Several classes are defined in the source code. This class is used to start the GUI: jldesmear.gui.desmearinggui.DesmearingGui. The main GUI program is started with a Python command such as:

from jldesmear.gui import desmearinggui
desmearinggui.main()

desmearinggui documentation

Lake desmearing GUI using PySide (or PyQt4) and Matplotlib

class jldesmear.gui.desmearinggui.CustomSignalDef[source]

Define the signals used to communicate between the desmearing thread and the PySide (main Qt4 GUI) thread.

class jldesmear.gui.desmearinggui.FileEntryBox(parent=None, title='selected file', callback=None, tip='select a file')[source]

FileEntryBox = QGroupBox[QLineEdit + QPushButton]

selectFile(**kw)[source]

Choose file for input

class jldesmear.gui.desmearinggui.IterativeDesmear(dsm, n)[source]

Run n iterations of the desmearing operation in a separate thread. Running in a separate thread with callbacks allows the GUI widgets to be updated after each iteration.

Parameters:
  • dsm (obj) – existing Desmearing object
  • n (int) – number of iterations to perform

Start this thread with code such as this example:

IterativeDesmear(Desmear_object, number_of_iterations).start()
class jldesmear.gui.desmearinggui.PacktFigureCanvas[source]

create a MatPlotLib FigureCanvas object with a single Figure

See:http://packtlib.packtpub.com/library/9781847197900/ch06lvl1sec03#
plot = None

Note

Something is not quite right here. Both PySide and PyQt4 report problems when charts are created this way.

PyQt4 reports:

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)

PySide (on linux) reports:

(python2.7:5972): libgnomevfs-WARNING **: Cannot load module `/usr/lib/gnome-vfs-2.0/modules/libfile.so' (/usr/lib/gnome-vfs-2.0/modules/libfile.so: cannot open shared object file: No such file or directory)
Application asked to unregister timer 0x44000005 which is not registered in this thread. Fix application.

This does not stop program execution. It is an indication that some subtlety has been missed. No error is reported on MS Windows 7 using Enthought Python Distribution.

class jldesmear.gui.desmearinggui.PlotPanel(parent, title)[source]

generic creation of a plot panel in a titled box (QGroupBox)

traitsgui documentation

Lake desmearing GUI using Enthought’s Traits, Chaco, and Enable packages.

note:

If you are using Ubuntu 11.04 and cannot see a menubar, this is a bug in Ubuntu 11.04. Try setting the environment variable: UBUNTU_MENUPROXY=1

Or, the code does not call for a menubar. ... Nevermind.

class jldesmear.gui.traitsgui.ChiSqr_plot[source]
SetData(chiSqr)[source]

provide the data to be plotted, replaces any existing data on the plot

Parameters:chiSqr ([float]) – list of ChiSqr values for each iteration
class jldesmear.gui.traitsgui.DesmearingGui[source]

Provide interactive access to all the parameters used in desmearing

This is a main GUI for the Lake/Jemian small-angle scattering desmearing program. It uses Traits, Chaco, and Enable. Call it with code like this:

DesmearingGui().configure_traits()
SetStatus(msg)[source]

put text in the status box

discover_extrapolations()

return a dictionary of the available extrapolations

Extrapolation functions must be in a file named extrap_KEY.py where KEY is the key name of the extrapolation function. The file is placed in the source code tree in the same directory as the module: extrapolation.

The calc() method should be capable of handling q as a numpy.ndarray or as a float.

The file must contain:

dsm_callback(dsm)[source]

this function is called after every desmearing iteration from traditional()

Parameters:dsm (obj) – desmearing parameters object
Returns:should desmearing stop?
Return type:bool
setupDesmearing(Qvec, smr, esd)[source]

prepare to start desmearing

toInfo(params)[source]

copy local variables to Info() structure

Parameters:params (Info object) – desmearing parameters structure
class jldesmear.gui.traitsgui.IterativeDesmear(dsm, n)[source]

Run n iterations of the desmearing operation in a separate thread. Running in a separate thread with callbacks allows the GUI widgets to be updated after each iteration.

Parameters:
  • dsm (obj) – Desmearing object
  • n (int) – number of iterations to perform

Start this thread with code such as this example:

IterativeDesmear(self.obj_dsm, self.NumItr).start()