ó
ú™xTc           @   s{   d  d l  m Z d  d l m Z d e f d „  ƒ  YZ e d k rw d  d l Z x& e j d D] Z e j	 e ƒ GHq\ Wn  d S(   iÿÿÿÿ(   t   division(   t   Formatt   FormatEDFALS733c           B   sS   e  Z d  Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   sl   EDF is the ESRF data format.
  In present context, ALS 7.3.3 uses this format for its single-tile Pilatus
  c         C   s@   y t  j |  d ƒ j d ƒ } Wn t k
 r5 } t SX| d k S(   Nt   rbi
   s
   {
HeaderID(   R   t	   open_filet   readt   IOErrort   False(   t
   image_filet   tagt   e(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.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   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyR      s    c         C   s3   d d l  m } | |  j ƒ |  _ |  j j ƒ  d S(   sÂ   Open the image file, read the image header, copy the key / value
    pairs into an internal dictionary self._header_dictionary along with
    the length of the header in bytes self._header_size.iÿÿÿÿ(   t
   EDFWrapperN(   t   iotbx.detectorsR   t   _image_filet   detectorbaset
   readHeader(   R   R   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyt   _start   s    c         C   s   |  j  j ƒ  S(   N(   t   _goniometer_factoryt   single_axis(   R   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyt   _goniometer$   s    c         C   s­   d } |  j  j d d d |  j j d d |  j j d |  j j d f d	 d
 d d d |  j j d |  j j d f d |  j j d |  j j d f d d |  j j f d g  ƒ 	S(   s$   Return a model for a simple detectorg        t   sensort   PADt   distancet   DISTANCEt   beam_centret   BEAM_CENTER_Xt   BEAM_CENTER_Yt   fast_directions   +xt   slow_directions   -yt
   pixel_sizet
   PIXEL_SIZEt
   image_sizet   SIZE1t   SIZE2t   trusted_rangei    t   mask(   t   _detector_factoryt   simpleR   t
   parameterst
   saturation(   R   t   twotheta(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyt	   _detector(   s    c         C   s   |  j  j d d ƒ S(   s#   Return a simple model for the beam.t
   wavelengthg      ð?(   t   _beam_factoryR)   (   R   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyt   _beam;   s    c         C   s>   |  j  j d |  j d d d |  j j d d d d d d	 d
 ƒ S(   s+   Return the scan information for this image.t   filenamet   formatt   EDFt   exposure_timest
   count_timet	   osc_startg        t	   osc_widtht   epochN(   t   _scan_factoryt   singleR   R   R*   t   None(   R   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyt   _scan@   s    	(   t   __name__t
   __module__t   __doc__t   staticmethodR   R   R   R   R-   R0   R<   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyR      s   						t   __main__Ni   (
   t
   __future__R    t   dxtbx.format.FormatR   R   R=   t   syst   argvt   argR   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatEDFALS733.pyt   <module>   s   D