Ejemplo n.º 1
0
    def __init__(self, image_file, **kwargs):
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        super(RAXISHelper, self).__init__(image_file, **kwargs)
Ejemplo n.º 2
0
    def __init__(self, image_file, index=0, reconst_mode=False, **kwargs):
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        self._raw_data = None
        self.index = index
        self.image_filename = image_file
        FormatHDF5.__init__(self, image_file, **kwargs)

        self.PIXEL_SIZE = 78.2 / 1000  # um
        self.RECONST_SIZE = 3840
        # This hard-coded value can be overwritten
        # by RAYONIX_DISTANCE

        self.distance = 240.0  # mm
        self.mask = None

        # Read metadata if possible
        self.read_metadata()
        # Override by environmental variables
        import os

        if "RAYONIX_DISTANCE" in os.environ:
            self.distance = float(os.environ["RAYONIX_DISTANCE"])
Ejemplo n.º 3
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file."""

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        Format.__init__(self, image_file, **kwargs)
Ejemplo n.º 4
0
    def __init__(self, image_file, **kwargs):

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        FormatMultiImageLazy.__init__(self, **kwargs)
        FormatStill.__init__(self, image_file, **kwargs)
        Format.__init__(self, image_file, **kwargs)
        self.current_index = None
        self.current_event = None
        self._psana_runs = {
        }  # empty container, to prevent breaking other formats
        if "locator_scope" in kwargs:
            self.params = FormatXTC.params_from_phil(
                master_phil=kwargs["locator_scope"],
                user_phil=image_file,
                strict=True)
        else:
            self.params = FormatXTC.params_from_phil(master_phil=locator_scope,
                                                     user_phil=image_file,
                                                     strict=True)
        assert self.params.mode == "idx", "idx mode should be used for analysis"

        self._ds = FormatXTC._get_datasource(image_file, self.params)
        self.populate_events()
        self.n_images = len(self.times)

        self._cached_psana_detectors = {}
        self._beam_index = None
        self._beam_cache = None
        self._initialized = True
        self._fee = None
Ejemplo n.º 5
0
  def __init__(self, image_file, **kwargs):
    '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

    from dxtbx import IncorrectFormatError
    if not self.understand(image_file):
      raise IncorrectFormatError(self, image_file)

    width, height, depth, order, bytes = FormatTIFF.get_tiff_header(
        image_file)

    # comment block - where the detector serial number may (or may not) be stored
    # comments = bytes[1024+1440:1024+1440+512]

    self._header_size = 4096

    if order == FormatTIFF.LITTLE_ENDIAN:
      self._I = '<I'
      self._i = '<i'
      self._ii = '<ii'
    else:
      self._I = '>I'
      self._i = '>i'
      self._ii = '>ii'

    FormatTIFF.__init__(self, image_file, **kwargs)

    return
Ejemplo n.º 6
0
  def __init__(self, image_file, **kwargs):

    from dxtbx import IncorrectFormatError
    if not self.understand(image_file):
      raise IncorrectFormatError(self, image_file)
    FormatMultiImage.__init__(self, **kwargs)
    Format.__init__(self, image_file, **kwargs)
Ejemplo n.º 7
0
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file.'''

        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        Format.__init__(self, image_file, **kwargs)
    def __init__(self, image_file, index=0, reconst_mode=False, **kwargs):
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        self._raw_data = None
        self.index = index
        self.image_filename = image_file
        FormatHDF5.__init__(self, image_file, **kwargs)

        # This hard-coded value can be overwritten
        # by RAYONIX_DISTANCE

        self.distance = 240.0  # mm
        self.mask = None

        # Read metadata if possible
        # Read pixel size from the metadata and determine the binning of rayonix
        self.read_metadata()
        self.PIXEL_SIZE = self.pixelsize_in_um / 1000  # convert um to mm
        self.bin_size = int(self.pixelsize_in_um / 39.1)
        self.RECONST_SIZE = 7680 // self.bin_size

        # Override by environmental variables
        if os.getenv("RAYONIX_DISTANCE"):
            self.distance = float(os.environ["RAYONIX_DISTANCE"])
Ejemplo n.º 9
0
    def __init__(self, image_file, **kwargs):
        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        FormatHDF5.__init__(self, image_file, **kwargs)

        self._h5_handle = h5py.File(self.get_image_file(), 'r')
        self._geometry_define()
Ejemplo n.º 10
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file."""
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        super(FormatNexusEigerDLS16M, self).__init__(image_file, **kwargs)
        self._dynamic_shadowing = self.has_dynamic_shadowing(**kwargs)
Ejemplo n.º 11
0
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatSMVRigaku.__init__(self, image_file, **kwargs)
Ejemplo n.º 12
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file."""
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        self._dynamic_shadowing = self.has_dynamic_shadowing(**kwargs)
        FormatCBFFullPilatus.__init__(self, image_file, **kwargs)
Ejemplo n.º 13
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file."""

        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatPYunspecified.__init__(self, image_file, **kwargs)
Ejemplo n.º 14
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file."""
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatCBFFull.__init__(self, image_file, **kwargs)

        self._raw_data = None
Ejemplo n.º 15
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file, including a
        proper model of the experiment."""

        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatCBFMiniPilatus.__init__(self, image_file, **kwargs)
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file, including a
    proper model of the experiment. Easy from Rigaku A200 images as
    they contain everything pretty much we need...'''

        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatSMVRigakuA200.__init__(self, image_file, **kwargs)
    def __init__(self, image_file, **kwargs):
        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        FormatSEReBIC.__init__(self, image_file, **kwargs)
        self.pedestal = os.environ.get("ADD_PEDESTAL", 0)
        self.pedestal = float(self.pedestal)
        logger.info("WARNING: Using FormatSEReBICpedestal. The value {0} will "
                    "be added to all pixels".format(self.pedestal))
Ejemplo n.º 18
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file, including a
        proper model of the experiment. Easy from Rigaku Saturn images as
        they contain everything pretty much we need..."""

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        self._image_file = image_file
        FormatBruker.__init__(self, image_file, **kwargs)
Ejemplo n.º 19
0
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file.'''

        # It appears Pycbf can not handle unicode filenames (see dials/dials#256)
        image_file = str(image_file)
        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatCBF.__init__(self, image_file, **kwargs)
        self._raw_data = None
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file.'''

        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        self._dynamic_shadowing = kwargs.get('dynamic_shadowing', False)
        FormatCBFFullPilatus.__init__(self, image_file, **kwargs)

        return
Ejemplo n.º 21
0
    def __init__(self, image_file, index=0, reconst_mode=False, **kwargs):
        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        self._raw_data = None
        self.index = index
        self.image_filename = image_file
        FormatHDF5.__init__(self, image_file, **kwargs)

        self.PIXEL_SIZE = 50 / 1000  # 50 um
        self.RECONST_SIZE = 2398  # compatible with DataConvert3 -reconst mode

        # These hard-coded values can be overwritten
        # by MPCCD_GEOMETRY and MPCCD_DISTANCE
        #
        # These values can be retrieved from SACLA API.
        # Alternatively, you can get it from a CrystFEL geometry file by
        # awk '/corner_x/{x=50*$3} /corner_y/{y=50*$3; printf x","y","rot","}
        #      /\/ss/{rot=-atan2($3, $4)/3.141592*180}' input.geom

        self.distance = 50.0  # mm
        self.panel_origins = [(-1755.000000, 51711.000000, 0.000000),
                              (-1711.000000, 24944.000000, 0.000000),
                              (817.000000, -1808.000000, 0.000000),
                              (812.000000, -28466.000000, 0.000000),
                              (-792.000000, 28544.000000, 0.000000),
                              (-781.000000, 1840.000000, 0.000000),
                              (1650.000000, -24900.000000, 0.000000),
                              (1655.000000, -51626.000000, 0.000000)]  # um
        self.panel_rotations = [
            -89.906197, -89.915802, -89.980003, -89.929298, 89.963097,
            89.880798, 90.000000, 90.029503
        ]

        import os

        if 'MPCCD_RECONST_MODE' in os.environ:
            reconst_mode = bool(os.environ['MPCCD_RECONST_MODE'])
        self.RECONST_MODE = reconst_mode
        self.RECONST_64 = True  # Set False if you want to keep panels completely horizontal
        # But this makes errors bigger.

        if 'MPCCD_GEOMETRY' in os.environ:
            try:
                tmp = map(float, os.environ['MPCCD_GEOMETRY'].split(","))
                if len(tmp) != 24:
                    raise
                for i in range(8):
                    self.panel_origins[i] = (-tmp[i * 3], tmp[i * 3 + 1], 0)
                    self.panel_rotations[i] = tmp[i * 3 + 2]
            except Exception:
                raise "Invalid MPCCD Geomtry"
        if 'MPCCD_DISTANCE' in os.environ:
            self.distance = float(os.environ['MPCCD_DISTANCE'])
Ejemplo n.º 22
0
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatSMV.__init__(self, image_file, **kwargs)

        detector_prefixes = self._header_dictionary['DETECTOR_NAMES'].split()
        self._prefix = detector_prefixes[0]
  def __init__(self, image_file, **kwargs):
    '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

    from dxtbx import IncorrectFormatError
    if not self.understand(image_file):
      raise IncorrectFormatError(self, image_file)

    FormatCBFMiniEiger.__init__(self, image_file, **kwargs)

    self._raw_data = None
    return
Ejemplo n.º 24
0
  def __init__(self, image_file, **kwargs):
    '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

    from dxtbx import IncorrectFormatError
    if not self.understand(image_file):
      raise IncorrectFormatError(self, image_file)

    from iotbx.detectors.mar import MARImage
    MARImage._read_header_asserts = lambda self: None
    FormatTIFFRayonix.__init__(self, image_file, **kwargs)

    return
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        self._raw_data = None
        self._multi_panel = kwargs.get('multi_panel', False)
        FormatCBFMiniPilatus.__init__(self, image_file, **kwargs)

        return
Ejemplo n.º 26
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file, including a
        proper model of the experiment."""

        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        self._dynamic_shadowing = self.has_dynamic_shadowing(**kwargs)
        self._multi_panel = kwargs.get("multi_panel", False)
        FormatCBFMiniPilatus.__init__(self, image_file, **kwargs)

        self._raw_data = None
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file, including a
        proper model of the experiment. Easy from Rigaku Saturn images as
        they contain everything pretty much we need..."""

        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatSMVRigaku.__init__(self, image_file, **kwargs)

        self.detector_class = "NOIR1"
        self.detector = "adsc"
Ejemplo n.º 28
0
 def __init__(self, image_file, **kwargs):
     from dxtbx import IncorrectFormatError
     if not self.understand(image_file):
         raise IncorrectFormatError(self, image_file)
     FormatStill.__init__(self, image_file, **kwargs)
     self._handle = h5py.File(image_file, "r")
     # load image components
     self._raw_panels = self._handle["raw"]
     self._is_low_gain = self._handle["gain"][()]
     self._pedestal = self._handle["dark"][()]
     self._mask = self._handle["mask"][()]
     self._low_gain_val = 6.85  # TODO : make this optional
     # load geometry components 
     self._geometry_define()
Ejemplo n.º 29
0
    def __init__(self, image_file, **kwargs):
        from dxtbx import IncorrectFormatError
        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        FormatHDF5.__init__(self, image_file, **kwargs)

        #def _start(self):
        self._h5_handle = h5py.File(self.get_image_file(), 'r')
        self._decide_multi_panel()
        self.load_dark()
        self.load_gain()
        self.load_mask()
        self.load_xyz()
        self._geometry_define()
        self._assembler_define()
Ejemplo n.º 30
0
  def __init__(self, image_file, **kwargs):
    from dxtbx import IncorrectFormatError
    if not self.understand(image_file):
      raise IncorrectFormatError(self, image_file)
    FormatMultiImageLazy.__init__(self, **kwargs)
    FormatStill.__init__(self, image_file, **kwargs)
    Format.__init__(self, image_file, **kwargs)
    self.current_index = None
    self.current_event = None

    if 'locator_scope' in kwargs:
      self.params = FormatXTC.params_from_phil(kwargs['locator_scope'],image_file,strict=True)
    else:
      self.params = FormatXTC.params_from_phil(locator_scope,image_file,strict=True)
    assert self.params.mode == 'idx', 'idx mode should be used for analysis'
    self._initialized = True