tjlane/odin — pull request #16 by dermen (2013-02-22 17:15:25+00:00)
Title: polar pilatus class

So I finished with the class if you want to pull, or I can keep chugging along on this fork.. Let me know what you think when you get a chance. For now, I will stop developing and start using this for analysis... Also, wataburger is soooooo goooooooddddd

```
In [1]: from odin import polarpilatus
WARNING:fabioimage:PIL is not installed ... trying to do without
WARNING:tifimage:PIL is not installed ... trying to do without
WARNING:bruker100image:PIL is not installed ... trying to do without
WARNING:xsdimage:lxml library is probably not part of your python installation: disabling xsdimage format

In [2]: pp = polarpilatus.polarpilatus('cbfs/p3deg_p7s_19_1_00001.cbf')
11:06:59 - Reading: cbfs/p3deg_p7s_19_1_00001.cbf
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fabio-0.1.0-py2.7-macosx-10.6-intel.egg/fabio/byte_offset.py:3: UserWarning: Module odin was already imported from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/odin/__init__.pyc, but /Users/dermen/Downloads/py27ext/odin is being added to sys.path
11:07:00 - Reading header info...
11:07:00 - Finished loading file

WELCOME TO POLAR PILATUS. LOADING DATA...
--> Calculating interpolation coefficients ...
--> Initializing center at x_center, y_center = 1231.5 , 1263.5
DONE LOADING.

In [4]: %time pp.center(300,500,1,100,25)

STARTING CENTER FINDING ALGORITHM...
(gimmie Bragg ring images)
--> Accumulating angular average maxima...
--> Calculating the center...
----> The peak intensity value is: 50383.4.
----> The max parameters are: (q,a,b) (352,1231.5,1264.5).
UPDATING CENTER TO BE x_center,y_center = 1231.5 , 1264.5
CPU times: user 3.18 s, sys: 0.00 s, total: 3.18 s
Wall time: 3.19 s

In [5]: %time pp.Interpolate_to_polar(0.02,360)

BEGINNING POLAR CONVERSION OF PILATUS 6M DETECTOR IMAGE...
FINISHED WITH THE INTERPOLATION...
CPU times: user 0.67 s, sys: 0.00 s, total: 0.68 s
Wall time: 0.68 s

In [6]: d = pp.get_polar_pixels()

In [7]: import pylab as plt

In [8]: plt.imshow(d,vmin=0,vmax=10000);plt.show()

In [9]: pp.I_profile(d)

In [10]: del pp

EXITING... HASTA LA VISTA, PILATUS 6M.

In [11]:
```
![polar_image_2D](https://f.cloud.github.com/assets/2335439/185801/150b48aa-7d13-11e2-8176-d71fee1b721e.png)

![popi_i_profile](https://f.cloud.github.com/assets/2335439/185800/0ff4ede4-7d13-11e2-8b57-64b5621a0f21.png)

As it turns out there are "some" negative pixels but they are very few and I think they are due to the gaps and the beam stop (interpolator fails when there is a lot of 0's ). Here is a histogram of polar intensities showing there existence:

![hist_popi_polar_image](https://f.cloud.github.com/assets/2335439/185805/3829d392-7d13-11e2-9705-7b1825103509.png)