wxCCD documentation

Introduction

wxCCD is a small python program I wrote to display and integrate images from an x-ray CCD. It has only a small set of the features in the "qt"/"moa" package that I developed in Sol Gruner's group. On the other hand, wxCCD is cross-platform and requires only freely available open-source packages, while qt/moa requires Matlab. (Some elements of the Matlab package live on in Lois Pollack's group.)

wxCCD is not a complete analysis package, although additional features could be easily bolted on. It is intended for quick visualization of results from x-ray CCD cameras while performing an experiment.

Presently, it only reads SMV data files as acquired by the Brandeis/BioCAT CCD. I could put in functionality for TIF files from TV6 (CHESS/Gruner), if there is interest. In addition, the code is extensible, so you can edit it to add whatever input format you desire, or link to external code (it doesn't have to be in Python).

Prerequisites

On the Windows platform, installation of these packages is quite easy with self-installing exe packages. On Linux, it's no more complicated that the usual rpm/deb package.

SciPy

You will want a recent version of scipy, which means you might need to compile from source (on a linux platform). Don't take any really old packages.

There is a super-short tutorial on SciPy.plt, or see the more complete and general plotting tutorial at SciPy.org.

Download wxCCD

Individually (right click and select "Save As"): Or all of the above, in compressed archive formats: Place the extracted .py somewhere python can find it. You can add to the python search path by setting the PYTHONPATH variable. If that fails, here is a platform-independent method:
>>> import sys
>>> sys.path.insert(0,"/your-directory-path/where-wxCCD.py files are put")

Starting wxCCD


>>> import gui_thread   #  if not already done
>>> import wxCCD
>>> p = gui_thread.register(wxCCD.main)
>>> win = p()

The names win and p are arbitrary.

Once started, if you want to edit wxCCD.py and reload:

>>> reload(wxCCD)
(import wxCCD will not reload the file).

Loading/Importing Data

Loading from a File

Select File : Open from the menubar, and choose a file from the dialog. (See the sample.smv file above.)

Note: there is a bug in reading SMV files on the WIN/DOS platform. (See Bugs below.) So, choose any other filename to get a test pattern you can play with.

Importing Data

You can also import data from the Python workspace that you have created or loaded in some other fashion. Don't have some handy z values to use? You can try
z = wxCCD.test_data()
for a 100 by 100 matrix of ascending values, or
z = wxCCD.test_data(n)
for an n by n matrix. Once you have data, import with
win.image = z
and select File : Reload from the menubar.

(Note 1: if you begin with from wxCCD import * then you can replace wxCCD.test_data() with test_data() )
(Note 2: this example assumes you called your instance win following the previous example for starting wxCCD.)

Visualization

Zoom

To zoom, select a region with the left mouse button and drag a rectangle. To unzoom, right click and select "Auto Zoom"

Scaling

When a new image is displayed, a box with three slider controls will pop up. These are control the scaling of the between the data and what is shown on the screen, and are labeled minimum, maximum, beta. The minimum/maximum values determine the values that correspond to black/white on the screen. Beta is a parameter ranging from -1 to 1 that controls relative "brightness". Positive values of beta will brighten the image, negative will darken. None of the controls take effect until the Apply button is pressed. The Reset button resets the slider values, but does not immediately change the image display.

Integration

The integration function is a sum or mean over the rectangular region shown in the current image display. (That is, if you have zoomed in a region, only that region will be integrated). Integration parameters (x/y, sum/mean) are controlled by the popup dialog opened by Options : Integration.

Exporting Data

All the internal variables are accessible, if you know what they are named. Some useful ones:
win.image
z data values
win.scaled_data
z data values, scaled from 0 through 255
win.x, win.y
x,y values produced after integration

By examining the wxCCD.py source, you can find even more exotic things to access and change:

self.my_slider_box._beta_slider.GetValue()

Acknowledgements

Bugs

  1. Reading SMV files fails in Windows (WinXP specifically, maybe all DOS platforms.) Problem lies in biocatCCD.py .
  2. The integration plot overlays the image plot, instead of opening a new window. You have to select Reload to redraw the plot.

Other bugs? Please let me know.