
    IR-e                     H    d dl mZ d dlZd dlmZ dgZ G d de          ZdS )    )OrderedDictN)
isiterableFlagCollectionc                       e Zd ZdZd Zd ZdS )r   a  
    The purpose of this class is to provide a dictionary for
    containing arrays of flags for the `NDData` class. Flags should be
    stored in Numpy arrays that have the same dimensions as the parent
    data, so the `FlagCollection` class adds shape checking to an
    ordered dictionary class.

    The `FlagCollection` should be initialized like an
    `~collections.OrderedDict`, but with the addition of a ``shape=``
    keyword argument used to pass the NDData shape.
    c                     d|v r>|                     d          | _        t          | j                  st          d          nt	          d          t          j        | g|R i | d S )Nshapez1FlagCollection shape should be an iterable objectz?FlagCollection should be initialized with the shape of the data)popr   r   
ValueError	Exceptionr   __init__)selfargskwargss      >lib/python3.11/site-packages/astropy/nddata/flag_collection.pyr   zFlagCollection.__init__   s    fG,,DJdj)) V !TUUUV Q   	T3D333F33333    c                     t          |t          j                  rS|j        | j        k    rt	          j        | ||fi | d S t          d                    |j        | j                            t          d          )Nz1flags array shape {} does not match data shape {}z&flags should be given as a Numpy array)	
isinstancenpndarrayr   r   __setitem__r
   format	TypeError)r   itemvaluer   s       r   r   zFlagCollection.__setitem__&   s    eRZ(( 
	F{dj(('dEDDVDDDDD GNNTZ    DEEEr   N)__name__
__module____qualname____doc__r   r    r   r   r   r      sA        
 

4 
4 
4F F F F Fr   )collectionsr   numpyr   astropy.utils.miscr   __all__r   r   r   r   <module>r$      s}    $ # # # # #     ) ) ) ) ) )
$F $F $F $F $F[ $F $F $F $F $Fr   