astropy/astropy — pull request #303 by astrofrog (2012-06-25 20:48:38+00:00)
Title: Tidied up mask, flags, error

This is just a small update to NDData to formalize what was discussed in #224, which is that it would be good to separate the concept of mask (which should ultimately just be True/False) and that of flags (which can apply equally to good and bad data). The issue with the previous approach was the there were many different kinds of bad data (mask != 0) but only one type of good data (mask == 0).

I've also changed mask, error, and flags to be checked anytime they are set, as otherwise the user could set those attributes incorrectly since they don't have to call the validating method.

The mask and flags have to be the same dimensions as the data, but the error can be different (e.g. if the error is constant over the image, if each pixel has an image, or if each pixel has a full PDF).

I removed the ``validate`` option from ``__init__``, because at the moment, the way it was implemented, it was possible to have ``copy=True`` and ``validate=False``, and ``copy=True`` would be silently ignored.

@eteq, @crawfordsm, @wkerzendorf - any thoughts?