astropy/astropy — pull request #2419 by mwcraig (2014-05-02 18:12:45+00:00)
Title: Modification to values accepted for initializing NDData mask, flag

This PR makes a small change to the values permitted to initialize the ``mask`` and ``flags`` attributes of an ``NDData`` object. [*currently only contains tests and docstring changes, not implementation*]

This behavior mirrors what is currently permitted for the ``data`` attribute of ``NDData``.

**Masks**
Currently mask can only be initialized with a boolean numpy array; setting a mask currently requires importing numpy as a result, and a mask like ``np.array([1,0])`` is rejected because it is not boolean.

If merged, this PR would allow anything that is array-like as an intiializer, converting it to a numpy array. All of the examples below would work for mask:
```
@pytest.mark.parametrize('mask_in', [
np.array([True, False]),
np.array([1, 0]),
[True, False],
[1, 0]])
```

**Flags**
Currently ``flag`` can be set to either a Numpy array or a ``FlagCollection``. This PR would add initialization by anything that can be converted to a numpy array. All of the examples below would work:
```
pytest.mark.parametrize('flags_in', [
np.array([True, False]),
np.array([1, 0]),
[True, False],
[1, 0],
np.array(['a', 'b']),
['a', 'b']])
```