Exemplo n.º 1
0
  def _start(self):

    from iotbx.detectors.adsc import ADSCImage
    self.detectorbase = ADSCImage(self._image_file)
    self.detectorbase.readHeader()

    FormatSMVADSC._start(self)
Exemplo n.º 2
0
  def __init__(self, image_file, **kwargs):
    '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

    assert(self.understand(image_file))

    FormatSMVADSC.__init__(self, image_file, **kwargs)
Exemplo n.º 3
0
    def __init__(self, image_file, **kwargs):
        '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

        assert (self.understand(image_file))

        FormatSMVADSC.__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.'''

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

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

        assert self.understand(image_file)

        FormatSMVADSC.__init__(self, image_file)

        return
Exemplo n.º 6
0
    def _start(self):
        # read the headers, then swap size1 and size2
        FormatSMVADSC._start(self)
        self._header_dictionary["SIZE1"] = "2527"
        self._header_dictionary["SIZE2"] = "2463"

        from iotbx.detectors import SMVImage

        self.detectorbase = SMVImage(self._image_file)
        self.detectorbase.readHeader()
        self.detectorbase.parameters["SIZE1"] = 2527
        self.detectorbase.parameters["SIZE2"] = 2463
    def understand(image_file):

        size, header = FormatSMVADSC.get_smv_header(image_file)
        if header.get("DETECTOR_SN") == "falcon3":
            return True

        return False
Exemplo n.º 8
0
    def understand(image_file):

        size, header = FormatSMVADSC.get_smv_header(image_file)
        if header.get("BEAMLINE") == "CETAD_TUI":
            return True

        return False
Exemplo n.º 9
0
    def understand(image_file):
        """Check to see if this has the correct dimensions of a pilatus"""

        size, header = FormatSMVADSC.get_smv_header(image_file)

        if int(header["SIZE1"]) == 2463 and int(header["SIZE2"]) == 2527:
            return True

        return False
Exemplo n.º 10
0
    def understand(image_file):
        '''Check to see if this has the correct dimensions of a pilatus'''

        size, header = FormatSMVADSC.get_smv_header(image_file)

        if int(header['SIZE1']) == 2463 and int(header['SIZE2']) == 2527:
            return True

        return False
Exemplo 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)

        # Mapping of serial numbers to models for known detectors
        self._sn_to_model = {
            401: "Q4U",
            402: "Q4",
            414: "Q4",
            423: "Q4R",
            428: "Q4R",
            429: "Q4",  # or Q4R?
            441: "Q210",
            442: "Q210",
            443: "Q210",
            444: "Q210",  # or Q210R?
            445: "Q210",
            446: "Q210",
            447: "Q210",
            448: "Q210",
            457: "Q210R",
            471: "Q270",
            472: "Q270",
            474: "Q270",
            901: "Q210",
            905: "Q315",
            907: "Q315R",  # or Q315?
            913: "Q315",
            917: "Q315R",
            923: "Q315R",
            925: "Q315",
            926: "Q315R",
            928: "Q315R",
            931: "Q315R",
            933: "Q315R",
        }

        FormatSMVADSC.__init__(self, image_file, **kwargs)
Exemplo n.º 12
0
    def understand(image_file):

        size, header = FormatSMVADSC.get_smv_header(image_file)

        unwanted_header_items = ["TIME", "DATE"]

        for header_item in unwanted_header_items:
            if header_item in header:
                return False

        return True
Exemplo n.º 13
0
  def understand(image_file):

    size, header = FormatSMVADSC.get_smv_header(image_file)

    unwanted_header_items = ['TIME','DATE']

    for header_item in unwanted_header_items:
      if header_item in header:
        return False

    return True
Exemplo n.º 14
0
  def understand(image_file):
    # The header must include a DATE and an integer-valued DETECTOR_SN
    # for this format to apply.

    size, header = FormatSMVADSC.get_smv_header(image_file)

    if 'DATE' not in header.keys():
      return False
    try:
      int(header['DETECTOR_SN'])
    except (KeyError, ValueError):
      return False

    return True
Exemplo n.º 15
0
  def understand(image_file):
    # The header must include a DATE and an integer-valued DETECTOR_SN
    # for this format to apply.

    size, header = FormatSMVADSC.get_smv_header(image_file)

    if 'DATE' not in header.keys():
      return False
    try:
      int(header['DETECTOR_SN'])
    except (KeyError, ValueError):
      return False

    return True
Exemplo n.º 16
0
    def understand(image_file):

        size, header = FormatSMVADSC.get_smv_header(image_file)

        # Not much to go on with these headers. Check we have exactly the keys
        # expected and no others
        if sorted(header.keys()) != [
            "BEAM_CENTER_X",
            "BEAM_CENTER_Y",
            "BIN",
            "BYTE_ORDER",
            "DATE",
            "DETECTOR_SN",
            "DIM",
            "DISTANCE",
            "HEADER_BYTES",
            "OSC_RANGE",
            "OSC_START",
            "PHI",
            "PIXEL_SIZE",
            "SIZE1",
            "SIZE2",
            "TIME",
            "TWOTHETA",
            "TYPE",
            "WAVELENGTH",
        ]:
            return False

        # Check a few values are as expected
        if header.get("DETECTOR_SN") != "unknown":
            return False
        if header.get("BIN") != "2x2":
            return False
        if header.get("BYTE_ORDER") != "little_endian":
            return False
        if header.get("HEADER_BYTES") != "512":
            return False
        if header.get("PIXEL_SIZE") != "0.0311999992":
            return False
        if header.get("SIZE1") != "2048":
            return False
        if header.get("SIZE2") != "2048":
            return False
        if header.get("TYPE") != "unsigned_short":
            return False

        return True
Exemplo n.º 17
0
    def understand(image_file):

        # assert for this that the image file has to be a file not a URL
        if not os.path.exists(image_file):
            return False

        size, header = FormatSMVADSC.get_smv_header(image_file)

        wanted_header_items = ["TIME"]
        if any(item not in header for item in wanted_header_items):
            return False

        unwanted_header_items = ["DATE"]

        if any(item in header for item in unwanted_header_items):
            return False

        return True
  def understand(image_file):

    # assert for this that the image file has to be a file not a URL

    import os
    if not os.path.exists(image_file):
      return False

    size, header = FormatSMVADSC.get_smv_header(image_file)

    wanted_header_items = ['TIME']

    for header_item in wanted_header_items:
      if not header_item in header:
        return False

    unwanted_header_items = ['DATE']

    for header_item in unwanted_header_items:
      if header_item in header:
        return False

    return True
    def understand(image_file):

        # assert for this that the image file has to be a file not a URL

        import os
        if not os.path.exists(image_file):
            return False

        size, header = FormatSMVADSC.get_smv_header(image_file)

        wanted_header_items = ['TIME']

        for header_item in wanted_header_items:
            if not header_item in header:
                return False

        unwanted_header_items = ['DATE']

        for header_item in unwanted_header_items:
            if header_item in header:
                return False

        return True
Exemplo n.º 20
0
 def _start(self):
     # read the headers, then swap size1 and size2
     FormatSMVADSC._start(self)
     self._header_dictionary['SIZE1'] = '2527'
     self._header_dictionary['SIZE2'] = '2463'
Exemplo n.º 21
0
    def understand(image_file):

        size, header = FormatSMVHamamatsu.get_smv_header(image_file)

        wanted_header_items = ["DETECTOR_NAME"]

        for header_item in wanted_header_items:
            if not header_item in header:
                return 0

        return header["DETECTOR_NAME"].lower().find("hamamatsu") >= 0

    def _start(self):

        FormatSMVADSC._start(self)

    def detectorbase_start(self):
        from iotbx.detectors.hamamatsu import HamamatsuImage

        self.detectorbase = HamamatsuImage(self._image_file)
        self.detectorbase.open_file = self.open_file
        self.detectorbase.readHeader()


if __name__ == "__main__":

    import sys

    for arg in sys.argv[1:]:
        print(FormatSMVADSC.understand(arg))
Exemplo n.º 22
0
  def _start(self):

    FormatSMVADSC._start(self)
    from iotbx.detectors.hamamatsu import HamamatsuImage
    self.detectorbase = HamamatsuImage(self._image_file)
    self.detectorbase.readHeader()
Exemplo n.º 23
0
from dxtbx.format.FormatSMVADSC import FormatSMVADSC

class FormatSMVHamamatsu(FormatSMVADSC):

  @staticmethod
  def understand(image_file):

    size, header = FormatSMVHamamatsu.get_smv_header(image_file)

    wanted_header_items = ['DETECTOR_NAME']

    for header_item in wanted_header_items:
      if not header_item in header:
        return 0

    return header["DETECTOR_NAME"].lower().find("hamamatsu")>=0

  def _start(self):

    FormatSMVADSC._start(self)
    from iotbx.detectors.hamamatsu import HamamatsuImage
    self.detectorbase = HamamatsuImage(self._image_file)
    self.detectorbase.readHeader()

if __name__ == '__main__':

  import sys

  for arg in sys.argv[1:]:
    print FormatSMVADSC.understand(arg)
  def _start(self):

    FormatSMVADSC._start(self)
Exemplo n.º 25
0
 def _start(self):
     # read the headers, then swap size1 and size2
     FormatSMVADSC._start(self)
     self._header_dictionary["SIZE1"] = "2527"
     self._header_dictionary["SIZE2"] = "2463"
Exemplo n.º 26
0
    def _start(self):

        FormatSMVADSC._start(self)
Exemplo n.º 27
0
 def _start(self):
   # read the headers, then swap size1 and size2
   FormatSMVADSC._start(self)
   self._header_dictionary['SIZE1'] = '2527'
   self._header_dictionary['SIZE2'] = '2463'
Exemplo n.º 28
0
    @staticmethod
    def understand(image_file):

        size, header = FormatSMVHamamatsu.get_smv_header(image_file)

        wanted_header_items = ['DETECTOR_NAME']

        for header_item in wanted_header_items:
            if not header_item in header:
                return 0

        return header["DETECTOR_NAME"].lower().find("hamamatsu") >= 0

    def _start(self):

        FormatSMVADSC._start(self)

    def detectorbase_start(self):
        from iotbx.detectors.hamamatsu import HamamatsuImage
        self.detectorbase = HamamatsuImage(self._image_file)
        self.detectorbase.open_file = self.open_file
        self.detectorbase.readHeader()


if __name__ == '__main__':

    import sys

    for arg in sys.argv[1:]:
        print FormatSMVADSC.understand(arg)