pyne/pyne — pull request #32 by scopatz (2012-05-15 08:42:48+00:00)
Title: Ace refactor

I have spent more time examining how to make ACE format parser faster and more useful. It was a little too slow for the amount I wanted to hammer on it and it mostly stored the data as Python lists rather than numpy arrays. I defined the following test cases based on ENDF7 data taken from Serpent. This tests Neutron and Sab libraries.
```python
def test_ace1():
ace_lib = ace.Library('92235ENDF7.ace')
ace_lib.read()

def test_ace2():
ace_lib = ace.Library('92235ENDF7.ace')
ace_lib.read('92235.03c')

def test_ace3():
ace_lib = ace.Library('sssth1')
ace_lib.read()

def test_ace4():
ace_lib = ace.Library('sssth1')
ace_lib.read('lwj3.03t')
```

Prior to the refactor, I was getting the following timings:
```python
In [1]: from test_ace import *

In [2]: timeit test_ace1()
1 loops, best of 3: 776 ms per loop

In [3]: timeit test_ace2()
1 loops, best of 3: 211 ms per loop

In [4]: timeit test_ace3()
1 loops, best of 3: 10.1 s per loop

In [5]: timeit test_ace4()
1 loops, best of 3: 4.68 s per loop
```

After the refactor, I instead see the following:
```python
In [1]: from test_ace import *

In [2]: timeit test_ace1()
1 loops, best of 3: 553 ms per loop

In [3]: timeit test_ace2()
10 loops, best of 3: 107 ms per loop

In [4]: timeit test_ace3()
1 loops, best of 3: 2.92 s per loop

In [5]: timeit test_ace4()
10 loops, best of 3: 28.9 ms per loop
```

Thus there are significant speed ups across the board, with the most dramatic one being case 4 at 162x. Note that this process also led to the discovery in numpy issue 279. Please look kindly on these changes.