pynbody/pynbody — pull request #185 by apontzen (2014-07-01 15:22:30+00:00)
Title: Add context managers for translations

I often use the following code template:

```
try:
f['pos']-=center
do_something
finally:
f['pos']+=center
```

Inevitably, I often can't be bothered to actually do the `try..finally` and so can end up with inconsistent simulation states.

This is an attempt to make the whole process easier by implementing the following syntax:

```
with translate(f, center) :
do_something
```

or even for some applications

```
with center(f) :
do_something
```

Let me know if you have any thoughts...

- [x] Add context managers for translations
- [x] Add nosetests
- [ ] Add context managers for rotations
- [ ] Add documentation
- [ ] Anything else?