B
    {‹d   ã               @   s*   d Z dd„ Zddd„Zdd„ Zdd	„ Zd
S )z"Various generic useful functions 
c             C   s&   yt | ƒ W n   d}Y nX d}|S )z×Check if the object is a sequence.

    Parameters
    ----------
    o : any object
      The object to check

    Returns
    -------
    is_seq : bool, scalar
      True if *o* is a sequence, False otherwise
    FT)Úlen)ÚoÚis_seq© r   ú\/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/healpy/cookbook.pyr      s    
r   Fc             C   s6   t | ƒsdS x$| D ]}|r"|dkst |ƒsdS qW dS )ao  Check if the object is a sequence of sequences. No check is done on
    the sizes of the sequences.

    Parameters
    ----------
    o : any object
      The object to check
    allow_none : bool, optional
      Treat ``None`` entries as sequence.

    Returns
    -------
    is_seq_of_seq : bool
      True if *o* is a sequence of sequences, False otherwise.
    FNT)r   )r   Ú
allow_noneÚsr   r   r   Úis_seq_of_seq   s    
r   c             C   sN   t | ƒsdS d}x8| D ]0}t |ƒs&dS |dkr6t|ƒ}t|ƒ|krdS qW dS )zòCheck if *o* is conformable to a 2d array.

    Parameters
    ----------
    o : any object
      The object to check

    Returns
    -------
    is_like2d : bool, scalar
      True if *o* is conformable to a 2d array, False otherwise.
    FNT)r   r   )r   Úsizer   r   r   r   Ú	is_like2d3   s    
r
   c             C   s"   t | ƒrt| d ƒ}nt| ƒ}|S )z»Returns the length of a single array or list of arrays

    Parameters
    ----------
    o : either array or sequence of arrays

    Returns
    -------
    length : length of array
    é    )r   r   )r   Úlengthr   r   r   Úlen_array_or_arraysM   s    r   N)F)Ú__doc__r   r   r
   r   r   r   r   r   Ú<module>   s   
