ó
Ñ%�Tc           @   s/   d  Z  d d l m Z e d ƒ Z d „  Z d S(   sD   A log function that returns negative infinity for log(0) or log(x<0)iÿÿÿÿ(   t   logs	   -infinityc         C   s:   d } y t |  ƒ } Wn t t f k
 r5 t } n X| S(   sÐ   Calculate the log without raising an error
    
    ARGUMENTS:
        a - the value to calculate the log of
    RETURNS:
        log(a) if it is defined
        negative infinity otherwise (when a <= 0)
    N(   t   NoneR    t
   ValueErrort   OverflowErrort   negInf(   t   at   ln(    (    sU   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/safelog.pyR      s    

N(   t   __doc__t   mathR    t   floatR   R   (    (    (    sU   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/python2.7/site-packages/coot/rcrane/safelog.pyt   <module>   s   