radio-astro-tools/pvextractor — pull request #50 by keflavich (2014-08-15 08:11:53+00:00)
Title: Use .value to avoid error calling nan_to_num on quantity

Using a cube with `BUNIT = 'K'`, I ran into the following traceback:

```
File "/Users/adam/repos/pvextractor/pvextractor/pvextractor.py", line 97, in extract_pv_slice
order=order, respect_nan=respect_nan)
File "/Users/adam/repos/pvextractor/pvextractor/geometry/slices.py", line 42, in extract_slice
slice = extract_line_slice(cube, x, y, order=order)
File "/Users/adam/repos/pvextractor/pvextractor/geometry/line_slices.py", line 59, in extract_line_slice
total_slice = map_coordinates(np.nan_to_num(cube), [zi,yi,xi], order=order, cval=np.nan)
File "/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/numpy/lib/type_check.py", line 379, in nan_to_num
y[are_inf] = maxf
File "/Users/adam/repos/astropy/astropy/units/quantity.py", line 807, in __setitem__
self.view(np.ndarray).__setitem__(i, self._to_own_unit(value))
File "/Users/adam/repos/astropy/astropy/units/quantity.py", line 1023, in _to_own_unit
raise exc
UnitsError: '' (dimensionless) and 'K' (temperature) are not convertible
```

pvextractor works on ndarrays; it has no reason to concern itself with flux units.