ó
ý™xTc           @   s‡   d  d l  m Z d  d l Z d  d l m Z d e f d „  ƒ  YZ e d k rƒ d  d l Z x& e j d D] Z	 e j
 e	 ƒ GHqh Wn  d S(   iÿÿÿÿ(   t   divisionN(   t	   FormatCBFt   FormatCBFFullc           B   sS   e  Z d  Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   ss   An image reading class for full CBF format images i.e. those from
  a variety of cameras which support this format.c         C   s/   t  j |  ƒ } d | k r+ d | k r+ t St S(   sV   Check to see if this looks like an CBF format image, i.e. we can
    make sense of it.s
   _diffrn.idt   _diffrn_source(   R   t   get_cbf_headert   Falset   True(   t
   image_filet   header(    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyt
   understand   s    c         C   s)   |  j  | ƒ s t ‚ t j |  | ƒ d S(   s3   Initialise the image structure from the given file.N(   R	   t   AssertionErrorR   t   __init__(   t   selfR   (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyR   "   s    c         C   sh   t  j |  ƒ t j ƒ  |  _ |  j j |  j t j ƒ d d l m	 } | |  j ƒ |  _
 |  j
 j ƒ  d S(   sK   Open the image file as a cbf file handle, and keep this somewhere
    safe.iÿÿÿÿ(   t   CBFImageN(   R   t   _startt   pycbft   cbf_handle_structt   _cbf_handlet   read_widefilet   _image_filet
   MSG_DIGESTt   iotbx.detectors.cbfR   t   detectorbaset
   readHeader(   R   R   (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyR   +   s    c         C   s   |  j  j |  j ƒ S(   s%   Return a working goniometer instance.(   t   _goniometer_factoryt   imgCIF_HR   (   R   (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyt   _goniometer8   s    c         C   s   |  j  j |  j d ƒ S(   s#   Return a working detector instance.t   unknown(   t   _detector_factoryR   R   (   R   (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyt	   _detector=   s    c         C   s   |  j  j |  j ƒ S(   s   Return a working beam instance.(   t   _beam_factoryR   R   (   R   (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyt   _beamB   s    c         C   s   |  j  j |  j |  j ƒ S(   s   Return a working scan instance.(   t   _scan_factoryR   R   R   (   R   (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyt   _scanG   s    (   t   __name__t
   __module__t   __doc__t   staticmethodR	   R   R   R   R   R   R!   (    (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyR      s   						t   __main__i   (   t
   __future__R    R   t   dxtbx.format.FormatCBFR   R   R"   t   syst   argvt   argR	   (    (    (    sH   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatCBFFull.pyt   <module>   s   :