ó
£áSc        
   @` s  d  Z  d d l m Z m Z m Z d Z d d l Z d d l Z d d l Z	 d d l
 j j Z d d l m Z d d l m Z m Z m Z m Z m Z d d l m Z m Z e	 j j j Z e j Z d d l j Z d d l m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' e j j( Z( d	 d
 d d d d g Z) d d d d g Z* d „  Z+ e, d „ Z- d „  Z. d	 e! e/ f d „  ƒ  YZ0 d „  Z1 e0 Z2 e, e, e, e, e, e3 e, e, d „ Z e, e, e, e, e, e3 e, e, e# d „	 Z d „  Z4 d „  Z5 e, d d e, e, d „ Z6 e, d „ Z7 d S(    s#  :mod:`numpy.ma..mrecords`

Defines the equivalent of :class:`numpy.recarrays` for masked arrays,
where fields can be accessed as attributes.
Note that :class:`numpy.ma.MaskedArray` already supports structured datatypes
and the masking of individual fields.

:author: Pierre Gerard-Marchant

i    (   t   divisiont   absolute_importt   print_functions   Pierre GF Gerard-MarchantN(   t
   basestring(   t   bool_t   dtypet   ndarrayt   recarrayt   array(   t
   fromarrayst   fromrecords(   t   MAErrort   MaskedArrayt   maskedt   nomaskt   masked_arrayt   getdatat   getmaskarrayt   filledt   MaskedRecordst	   mrecarrayR	   R
   t   fromtextfilet   addfieldt   _datat   _maskt
   _fieldmaskR   c         C` s³   t  |  d ƒ r9 d j g  |  j j D] } | d ^ q" ƒ Sd } xi |  D]a } t j | ƒ } | t | j j 7} t | j j t	 j
 ƒ r� | t | j ƒ 7} n  | d 7} qF W| d  S(   sK   Returns the formats of each array of arraylist as a comma-separated string.R   t   ,i   t    iÿÿÿÿ(   t   hasattrt   joinR   t   descrt   npt   asarrayt   _typestrt   typet
   issubclasst   ntypest   flexiblet   reprt   itemsize(   t   datat   desct   formatst   obj(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   _getformats3   s    *c   
      C` s[  t  |  ƒ } g  t | ƒ D] } d | ^ q } | d k rD | } n~ t | t t f ƒ rb | } n7 t | t ƒ rƒ | j d ƒ } n t d t	 | ƒ ƒ ‚ t  | ƒ } | | k  rÂ | | | 7} n  g  } xƒ t
 | | |  j ƒ D]l \ } } }	 | t k r3|	 d t k r#| j | |	 d f ƒ qJ| j |	 ƒ qÞ | j | |	 d f ƒ qÞ Wt j | ƒ S(   sÞ   Checks that the field names of the descriptor ``descr`` are not some
reserved keywords. If this is the case, a default 'f%i' is substituted.
If the argument `names` is not None, updates the field names to valid names.
    s   f%iR   s   illegal input names %si    i   N(   t   lent   ranget   Nonet
   isinstancet   tuplet   listt   strt   splitt	   NameErrorR&   t   zipR   t   reserved_fieldst   appendR   R   (
   R   t   namest   ndescrt   it   default_namest	   new_namest   nnamest   nt   dt   t(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   _checknamesA   s(    #		%c         C` s]   g  |  j  j D] } | d f ^ q } t j |  j d | ƒ} t t g t | ƒ ƒ | _ | S(   Ns   |b1R   (	   R   R9   R   t   emptyt   shapeR1   t   FalseR-   t   flat(   t   selfR?   t   mdescrt   fdmask(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   _get_fieldmask`   s    %c           B` s
  e  Z d  Z d d d d d d d d e e e d e e d „ Z d „  Z d „  Z	 e
 d e	 ƒ Z d „  Z e
 d e ƒ Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d d d „ Z d „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z RS(   s…  

*IVariables*:
    _data : {recarray}
        Underlying data, as a record array.
    _mask : {boolean array}
        Mask of the records. A record is masked when all its fields are masked.
    _fieldmask : {boolean recarray}
        Record array of booleans, setting the mask of each individual field of each record.
    _fill_value : {record}
        Filling values for each field.
    i    c         K` sÈ  t  j |  | d | d | d | d | d | d | d | d |	 d	 |
 ƒ	} t j | j ƒ } | t k sv t j | ƒ rž | sÄt t	 g t
 | ƒ ƒ | _ qÄn&t j | d
 | ƒ} | j | j k rI| j | j } } | d k rü t j | | j ƒ } nD | | k r t j | | j ƒ } n  d d } t | | | f ƒ ‚ t } n  | sh| j | ƒ t | _ n\ | j | k r€| } n; t j g  | D] } t | g t
 | ƒ ƒ ^ q�d | ƒ} | | _ | S(   NR   t   buft   offsett   stridesR*   R9   t   titlest	   byteordert   alignedt   copyi   s/   Mask and data not compatible: data size is %i, s   mask size is %i.(   R   t   __new__t   mat   make_mask_descrR   R   R   t   sizeR1   RE   R-   R   R   RD   t   resizet   reshapeR   t   Truet   __setmask__t   _sharedmask(   t   clsRD   R   RK   RL   RM   R*   R9   RN   RO   RP   t   maskt	   hard_maskt
   fill_valuet	   keep_maskRQ   t   optionsRG   t   mdtypet   ndt   nmt   msgR   t   m(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRR   u   s8    !	"		2		c         C` s  t  | d d  ƒ } | d  k r¼ t  | d t ƒ } t j |  d ƒ } | t k ri t j |  j d | ƒ} q¼ t j | ƒ } t	 g  | D] } t
 | g t | ƒ ƒ ^ q‚ d | ƒj t ƒ } n  |  j } | j d | ƒ |  j | ƒ | d t k rÿ t | d <n  d  S(   NR   R   t
   _baseclass(   t   getattrR/   R   R   t   __getattribute__RS   t   make_mask_noneRD   RT   t   narrayR1   R-   t   viewR   t   __dict__t   updatet   _update_from(   RG   R+   R   t   objmaskt   _dtypeRH   Re   t   _dict(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   __array_finalize__ž   s    /	c         C` s   t  j |  t ƒ S(   s   Returns the data as a recarray.(   R   Rk   R   (   RG   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   _getdata³   s    t   fgetc         C` s   |  j  S(   s   Alias to mask(   R   (   RG   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   _getfieldmask¸   s    c         C` s#   |  j  r t |  j ƒ St |  j ƒ S(   s   Returns the length(   t   ndimR-   R   R   (   RG   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   __len__½   s    	c   
      C` sÜ  y t  j |  | ƒ SWn t k
 r' n Xt j |  d ƒ j } y | | d  } Wn' t t f k
 rx t d | ƒ ‚ n Xt j |  d ƒ } t j |  | d ƒ } | j | Œ  } | j	 j rË t
 d ƒ ‚ n  t } | j d d  ƒ } | d  k	 rAy | | } Wn t k
 rn X| j t j t | j	 ƒ p/d f ƒ j ƒ  } n  | j sP| rÌ| j t ƒ } t | _ t | _ | | _ | j d	 d  ƒ }	 |	 d  k	 rØy |	 | | _ WqÉt k
 rÅd  | _ qÉXqØn | j ƒ  } | S(
   NR   i   s    record array has no attribute %sRl   Rf   s6   MaskedRecords is currently limited tosimple records...R   i   t   _fill_value(   t   objectRh   t   AttributeErrorR   t   fieldst	   TypeErrort   KeyErrorRk   t   getfieldR   t   NotImplementedErrorRE   t   getR/   t
   IndexErrorR   t   boolR-   t   anyRD   R   Rf   RX   t   _isfieldR   Rx   t
   ValueErrort   item(
   RG   t   attrt	   fielddictt   rest
   _localdictR   R+   t	   hasmaskedR   Rx   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRh   Å   sF    0			c         C` sí  | d k r |  j  | ƒ d St j |  d ƒ } | | k } y t j |  | | ƒ } Wnw t j |  d ƒ j pr i  } t j |  d ƒ pŠ i  } | | k p¢ | | k s!t j ƒ  d  \ } }	 | |	 ƒ ‚ q!nT Xt j |  d ƒ j pæ i  } | | k rù | S| r!y t j |  | ƒ Wq!| SXn  y | | d  }
 Wn' t	 t
 f k
 r\t d | ƒ ‚ n X| t k rŸ| d	 } | d k	 r�| d	 | } n | } t } n t | ƒ } t | ƒ } t j |  d
 ƒ j | |
 Œ } | d j | | ƒ | S(   s)   Sets the attribute attr to the value val.R\   t	   fieldmaskNRl   R   t   _optinfoi   s    record array has no attribute %sRx   R   R   (   s   maskRŒ   (   RY   Ry   Rh   t   __setattr__R   R{   t   syst   exc_infot   __delattr__R|   R}   Rz   R   R/   RX   R   R   t   setfieldt   __setitem__(   RG   R‡   t   valRŠ   t   newattrt   retRˆ   t   optinfot   exctypet   valueR‰   Rx   t   dvalt   mvalR+   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRŽ   ò   sH    
	c         C` sõ   |  j  } t j |  d ƒ } t j |  | d ƒ } t | t ƒ rª | | j t ƒ } | | | _ t | _	 | d } | d k	 r� | | | _ n  | j r¦ | j r¦ t S| St j | | d t ƒj t ƒ } t j | | d t ƒj t ƒ | _ | S(   sh   Returns all the fields sharing the same fieldname base.
The fieldname base is either `_data` or `_mask`.R   Rf   Rx   RQ   N(   Rl   R   Rh   Rk   R0   R   R   R   RX   RZ   R/   Rx   Rv   R   R   R   RE   R   R   (   RG   t   indxRŠ   R   R   R+   t   fval(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   __getitem__'  s     		
"%c         C` s?   t  j |  | | ƒ t | t ƒ r; t j | ƒ |  j | <n  d S(   s   Sets the given record to value.N(   R   R“   R0   R   RS   R   R   (   RG   Rœ   R™   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR“   C  s    c         C` s  |  j  d k r‡ g  t g  |  j j D] } t |  | ƒ ^ q" Œ  D]2 } d d j g  | D] } t | ƒ ^ qT ƒ ^ q> } d d j | ƒ Sg  t g  |  j j D] } t |  | ƒ ^ qš ƒ D]2 } d d j g  | D] } t | ƒ ^ qÌ ƒ ^ q¶ } d d j | ƒ Sd S(   s%   Calculates the string representation.i   s   (%s)R   s   [%s]s   , s   %sN(   RU   R6   R   R9   Rg   R   R3   (   RG   t   ft   sR;   t   mstr(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   __str__J  s    ddc         C` s±   |  j  j } d t g  | D] } t | ƒ ^ q ƒ d f } g  |  j  j D] } | | t |  | ƒ f ^ qI } | j d d ƒ | j | d |  j f d g ƒ t d j	 | ƒ ƒ S(   s#   Calculates the repr representation.s   %%%is : %%si   i    s   masked_records(s       fill_values                 )s   
(
   R   R9   t   maxR-   Rg   t   insertt   extendR^   R3   R   (   RG   t   _namesR?   t   fmtRŸ   t   reprstr(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   __repr__U  s    02
c         C` s€  | d k r? | d k r* t j |  ƒ } q(t j |  | ƒ } né | d k ry@ t | t ƒ rx t j |  | ƒ } d } n t j |  | ƒ } Wq(t k
 rt j | ƒ } | j d k rñ |  j j	 d } |  j
 ƒ  j | | ƒ } | j |  ƒ n t j |  | ƒ } d | _ q(Xn t j |  | | ƒ } t | d t ƒ t k	 r|t j | j ƒ } |  j j | t ƒ | _ | j | j _ n  | S(   s    Returns a view of the mrecarray.i    R   N(   R/   R   Rk   R#   R|   R   R   R{   t	   __class__t	   __bases__t	   __array__Rn   Rx   Rg   R   RS   RT   R   RD   (   RG   R   R"   t   outputt   basetypeRa   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRk   _  s0    	c         C` s   t  |  _ d S(   s   Forces the mask to hardN(   RX   t	   _hardmask(   RG   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   harden_mask…  s    c         C` s   t  |  _ d S(   s   Forces the mask to softN(   RE   R¯   (   RG   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   soften_maskˆ  s    c         C` s=   |  j  } |  j j ƒ  j t |  ƒ ƒ } |  j j ƒ  | _ | S(   s$   Returns a copy of the masked record.(   Rl   R   RQ   Rk   R"   R   (   RG   RŠ   t   copied(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRQ   Œ  s    	c         C` sf   | d k	 r |  j | ƒ j ƒ  St |  j ƒ  j ƒ  d t ƒ} t |  j j ƒ  ƒ } d | | <| j ƒ  S(   sL  Copy the data portion of the array to a hierarchical python
        list and returns that list.

        Data items are converted to the nearest compatible Python
        type.  Masked values are converted to fill_value. If
        fill_value is None, the corresponding entries in the output
        list will be ``None``.

        R   N(   R/   R   t   tolistRj   Ry   R   (   RG   R^   t   resultR\   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR³   “  s    

c         C` s@   d |  j  |  j |  j j |  j j ƒ  |  j j ƒ  |  j f } | S(   sO   Return the internal state of the masked array, for pickling purposes.

        i   (   RD   R   t   flagst   fncR   t   tostringR   Rx   (   RG   t   state(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   __getstate__¥  s    	c         C` s•   | \ } } } } } } } t  j |  | | | | f ƒ t g  |  j j D] \ }	 }
 |	 t f ^ qG ƒ } |  j d j | | | | f ƒ | |  _ d S(   sb  Restore the internal state of the masked array, for pickling purposes.
    ``state`` is typically the output of the ``__getstate__`` output, and is a
    5-tuple:

        - class name
        - a tuple giving the shape of the data
        - a typecode for the data
        - a binary string for the data
        - a binary string for the mask.

        R   N(   R   t   __setstate__R   R   R   Rl   R^   (   RG   R¸   t   vert   shpt   typt   isft   rawt   mskt   flvt   kt   _Ra   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRº   ³  s
    1 c         C` s%   t  |  j |  j d d f |  j ƒ  f S(   s6   Return a 3-tuple for pickling a MaskedArray.

        i    t   b(   i    (   t   _mrreconstructRª   Rf   R¹   (   RG   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt
   __reduce__Å  s    N(   t   __name__t
   __module__t   __doc__R/   RE   R   RX   RR   Rr   Rs   t   propertyR   Ru   R   Rw   Rh   RŽ   Rž   R“   R¢   R©   Rk   R°   R±   RQ   R³   R¹   Rº   RÆ   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR   g   s4   	%					-	5				
&					c         C` sO   t  j | | | ƒ j |  ƒ } t  j t  | d ƒ } |  j |  | d | d | ƒS(   sb   Internal function that builds a new MaskedArray from the
    information stored in a pickle.

    t   b1R\   R   (   R   RR   Rk   (   t   subtypet	   baseclasst	   baseshapeR®   R   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyRÅ   Í  s    c	         C` sº   g  |  D] }	 t  |	 ƒ ^ q }
 g  |  D] }	 t j t |	 ƒ ƒ ^ q& } t |
 d | d | d | d | d | d | d | ƒj t ƒ } t t | Œ  ƒ | j	 _
 | d k	 r¶ | | _ n  | S(	   s  Creates a mrecarray from a (flat) list of masked arrays.

    Parameters
    ----------
    arraylist : sequence
        A list of (masked) arrays. Each element of the sequence is first converted
        to a masked array if needed. If a 2D array is passed as argument, it is
        processed line by line
    dtype : {None, dtype}, optional
        Data type descriptor.
    shape : {None, integer}, optional
        Number of records. If None, shape is defined from the shape of the
        first array in the list.
    formats : {None, sequence}, optional
        Sequence of formats for each individual field. If None, the formats will
        be autodetected by inspecting the fields and selecting the highest dtype
        possible.
    names : {None, sequence}, optional
        Sequence of the names of each field.
    fill_value : {None, sequence}, optional
        Sequence of data to be used as filling values.

    Notes
    -----
    Lists of tuples should be preferred over lists of lists for faster processing.
    R   RD   R*   R9   RN   RP   RO   N(   R   R   t
   atleast_1dR   t   recfromarraysRk   R   R2   R6   R   RF   R/   R^   (   t	   arraylistR   RD   R*   R9   RN   RP   RO   R^   t   xt   datalistt   masklistt   _array(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR	   ß  s    (	c
         C` s°  t  |  d d ƒ }
 y t |  d ƒ } Wn$ t k
 rL t |  d j ƒ } n Xt |  t ƒ rª t |  t ƒ rƒ |  j ƒ  j	 t ƒ }  n  | d k r› |  j } n  |  j
 ƒ  }  n  t |  d | d | d | d | d | d | d	 | ƒj	 t ƒ } | d k	 r| | _ n  |	 t k	 r“t j |	 d
 t ƒ}	 t |	 j ƒ } | rF|	 | j _ q“t |	 j ƒ d k rƒg  |	 D] } t | ƒ ^ qb| j _ q“| j |	 ƒ n  |
 d k	 r¬|
 | j (n  | S(   sH  Creates a MaskedRecords from a list of records.

    Parameters
    ----------
    reclist : sequence
        A list of records. Each element of the sequence is first converted
        to a masked array if needed. If a 2D array is passed as argument, it is
        processed line by line
    dtype : {None, dtype}, optional
        Data type descriptor.
    shape : {None,int}, optional
        Number of records. If None, ``shape`` is defined from the shape of the
        first array in the list.
    formats : {None, sequence}, optional
        Sequence of formats for each individual field. If None, the formats will
        be autodetected by inspecting the fields and selecting the highest dtype
        possible.
    names : {None, sequence}, optional
        Sequence of the names of each field.
    fill_value : {None, sequence}, optional
        Sequence of data to be used as filling values.
    mask : {nomask, sequence}, optional.
        External mask to apply on the data.

    Notes
    -----
    Lists of tuples should be preferred over lists of lists for faster processing.
    R   i    R   RD   R*   R9   RN   RP   RO   RQ   i   N(   Rg   R/   R-   R|   R   R0   R   R   R   Rk   R³   t   recfromrecordsR   R^   R   R   R   RE   R   RF   RD   R1   RY   (   t   reclistR   RD   R*   R9   RN   RP   RO   R^   R\   R   t   nfieldst   mrect   maskrecordlengthRe   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR
   	  s6     (c         C` s*  g  } t  j |  ƒ }  t |  j ƒ d k r7 |  d }  n$ t |  j ƒ d k r[ t d ƒ ‚ n  xÈ |  D]À } y t | ƒ Wn“ t k
 ry t | ƒ Wn[ t k
 rñ y t | ƒ } Wn! t k
 r× | j |  j	 ƒ qX| j t  j	 t ƒ ƒ q"X| j t  j	 t ƒ ƒ qb X| j t  j	 t ƒ ƒ qb W| S(   s  Tries to guess the dtypes of the str_ ndarray `arr`, by testing element-wise
conversion. Returns a list of dtypes.
The array is first converted to ndarray. If the array is 2D, the test is performed
on the first line. An exception is raised if the file is 3D or more.
    i   i    s   The array should be 2D at most!(
   R   R    R-   RD   R…   t   intt   floatt   complexR8   R   (   t   arrt   vartypesRŸ   R”   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   _guessvartypesK  s*    c         C` s‹   t  |  d ƒ r |  Sy t |  ƒ } Wn! t k
 rF t d |  ƒ ‚ n X| j ƒ  d  d k rq | j d d ƒ | S| j ƒ  t d ƒ ‚ d S(   s%   Opens the file handle of file `fname`t   readlines   No such file: '%s'i   s   \xi    s   Wow, binary fileN(   R   t   opent   IOErrorRá   t   seekt   closeR   (   t   fnameRŸ   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   openfilek  s    
t   #R   c      
   C` s2  t  |  ƒ } xT t rb | j ƒ  } | | j | ƒ  j ƒ  } | j | ƒ }	 t |	 ƒ d k r Pq q W| d k rx |	 } n  t g  | D]= } | d | k r‚ t | ƒ d k r‚ | j ƒ  j | ƒ ^ q‚ ƒ }
 |
 j	 \ } } | j
 ƒ  | d k r t |
 d ƒ } nt g  | D] } t j | ƒ ^ q} t | ƒ | k rtd } | d 7} t j | t | ƒ | f ƒ t |
 d ƒ } n  g  t | | ƒ D] \ } } | | f ^ q„} g  | D] } t j | ƒ ^ q©} |
 j | k } g  t |
 j | | | ƒ D]0 \ } } } } t | d | d | d | ƒ^ qì} t | d | ƒS(	   s¬  Creates a mrecarray from data stored in the file `filename`.

    Parameters
    ----------
    filename : {file name/handle}
        Handle of an opened file.
    delimitor : {None, string}, optional
        Alphanumeric character used to separate columns in the file.
        If None, any (group of) white spacestring(s) will be used.
    commentchar : {'#', string}, optional
        Alphanumeric character used to mark the start of a comment.
    missingchar : {'', string}, optional
        String indicating missing data, and used to create the masks.
    varnames : {None, sequence}, optional
        Sequence of the variable names. If None, a list will be created from
        the first non empty line of the file.
    vartypes : {None, sequence}, optional
        Sequence of the variables dtypes. If None, it will be estimated from
        the first non-commented line.


    Ultra simple: the varnames are in the header, one linei   i    s&   Attempting to %i dtypes for %i fields!s    Reverting to default.R\   R   R^   N(   Rç   RX   Rá   t   findt   stripR4   R-   R/   R   RD   Rå   Rà   R   R   t   warningst   warnR6   RS   t   default_fill_valuet   TR	   (   Ræ   t	   delimitort   commentchart   missingchart   varnamesRß   RŸ   t   linet	   firstlinet	   _varnamest
   _variablesRÃ   RØ   t   vRd   R?   RH   t   mfillvR   t   aRe   RA   t	   _datalist(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR   |  s6    		@
"
."Lc         C` sŒ  |  j  } |  j } | d k s* | t k r@ d t | j ƒ } n  t j | ƒ } t j | j j	 | | j f g ƒ } t
 | j | ƒ } g  | j j j ƒ  D]! } | j | j | Œ  | Œ ^ q™ | j | j  | j j | Œ | j t ƒ } t j g  | j D] } | t f ^ qú ƒ }	 t
 | j |	 ƒ }
 g  | j j j ƒ  D]! } |
 j | j | Œ  | Œ ^ q:|
 j t | ƒ |
 j j | Œ |
 | _ | S(   sÐ   Adds a new field to the masked record array, using `newfield` as data
and `newfieldname` as name. If `newfieldname` is None, the new field name is
set to 'fi', where `i` is the number of existing fields.
    s   f%iN(   R   R   R/   R7   R-   R   RS   R   R   R   R   RD   R{   t   valuesR’   R~   Rk   R   R9   R   R   (   t   mrecordt   newfieldt   newfieldnameR   R   t   newdtypet   newdataRŸ   R?   t	   newmdtypet   newmask(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyR   ¿  s&    		%5+5	(8   RÉ   t
   __future__R    R   R   t
   __author__R�   Rë   t   numpyR   t   numpy.core.numerictypest   coret   numerictypesR$   t   numpy.compatR   R   R   R   R   R   Rj   t   numpy.core.recordsR	   RÐ   R
   RÖ   t   recordst   _byteorderconvR!   t   numpy.maRS   R   R   R   R   R   R   R   R   t   _check_fill_valuet   __all__R7   R,   R/   RB   RJ   Ry   R   RÅ   R   RE   Rà   Rç   R   R   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/numpy/ma/mrecords.pyt   <module>
   sF   	(	:		ÿ g		(	@	 		B