def _goniometer(self):
    '''Return a model for a simple single-axis goniometer. This should
    probably be checked against the image header.'''

    from dxtbx.format.FormatCBFMiniPilatusHelpers import get_pilatus_timestamp
    timestamp = get_pilatus_timestamp(
        self._cif_header_dictionary['timestamp'])
    # Goniometer changed from reverse phi to conventional rotation direction
    # on this date:
    # calendar.timegm(time.strptime('2016-04-01T00:00:00', '%Y-%m-%dT%H:%M:%S'))
    if timestamp < 1459468800:
      return self._goniometer_factory.single_axis_reverse()

    alpha = 50.0
    if 'Phi' in self._cif_header_dictionary:
      phi_value = float(self._cif_header_dictionary['Phi'].split()[0])
    else:
      phi_value = 0.0

    if 'Kappa' in self._cif_header_dictionary:
      kappa_value = float(self._cif_header_dictionary['Kappa'].split()[0])
    else:
      kappa_value = 0.0

    if 'Omega' in self._cif_header_dictionary:
      omega_value = float(self._cif_header_dictionary['Omega'].split()[0])
    else:
      omega_value = 0.0

    return self._goniometer_factory.make_kappa_goniometer(
      alpha, omega_value, kappa_value, phi_value, '-y', 'omega')
Esempio n. 2
0
    def _goniometer(self):
        '''Return a model for a simple single-axis goniometer. This should
    probably be checked against the image header.'''

        from dxtbx.format.FormatCBFMiniPilatusHelpers import get_pilatus_timestamp
        timestamp = get_pilatus_timestamp(
            self._cif_header_dictionary['timestamp'])
        # Goniometer changed from reverse phi to conventional rotation direction
        # on this date:
        # calendar.timegm(time.strptime('2016-04-01T00:00:00', '%Y-%m-%dT%H:%M:%S'))
        if timestamp < 1459468800:
            return self._goniometer_factory.single_axis_reverse()

        alpha = 50.0
        if 'Phi' in self._cif_header_dictionary:
            phi_value = float(self._cif_header_dictionary['Phi'].split()[0])
        else:
            phi_value = 0.0

        if 'Kappa' in self._cif_header_dictionary:
            kappa_value = float(
                self._cif_header_dictionary['Kappa'].split()[0])
        else:
            kappa_value = 0.0

        if 'Omega' in self._cif_header_dictionary:
            omega_value = float(
                self._cif_header_dictionary['Omega'].split()[0])
        else:
            omega_value = 0.0

        return self._goniometer_factory.make_kappa_goniometer(
            alpha, omega_value, kappa_value, phi_value, '-y', 'omega')
    def _goniometer(self):
        """Return a model for a simple single-axis goniometer. This should
        probably be checked against the image header."""

        timestamp = get_pilatus_timestamp(
            self._cif_header_dictionary["timestamp"])
        # Goniometer changed from reverse phi to conventional rotation direction
        # on this date:
        # calendar.timegm(time.strptime('2016-04-01T00:00:00', '%Y-%m-%dT%H:%M:%S'))
        if timestamp < 1459468800:
            return self._goniometer_factory.single_axis_reverse()

        alpha = 50.0
        if "Phi" in self._cif_header_dictionary:
            phi_value = float(self._cif_header_dictionary["Phi"].split()[0])
        else:
            phi_value = 0.0

        if "Kappa" in self._cif_header_dictionary:
            kappa_value = float(
                self._cif_header_dictionary["Kappa"].split()[0])
        else:
            kappa_value = 0.0

        if "Omega" in self._cif_header_dictionary:
            omega_value = float(
                self._cif_header_dictionary["Omega"].split()[0])
        else:
            omega_value = 0.0

        return self._goniometer_factory.make_kappa_goniometer(
            alpha, omega_value, kappa_value, phi_value, "-y", "omega")
    def _mask_bad_modules(self, detector):
        # Mask out known bad modules
        timestamp = get_pilatus_timestamp(
            self._cif_header_dictionary["timestamp"])
        # https://photon-science.desy.de/research/technical_groups/detectors/e190302/e199162/CharacterizationandCalibrationofPilatus.pdf
        nx = 487  # module pixels x
        ny = 195  # module pixels y
        cx = 60  # chip pixels x
        cy = 97  # chip pixels y
        dx = 7  # module gap size

        if timestamp > calendar.timegm((2020, 9, 8, 0, 0, 0)):
            # 2020 run 4
            # Detector serviced by Dectris, no bad modules
            pass
        elif timestamp > calendar.timegm((2020, 2, 21, 0, 0, 0)):
            # 2020 run 1
            # module @ row 1 column 4
            # blank chip @ row 15 column 4 (chip row 0, column 1)
            # module @ row 17 column 0
            # module @ row 17 column 4
            if self._multi_panel:
                detector[5 * 1 + 4].add_mask(0, 0, nx, ny)
                detector[5 * 17].add_mask(0, 0, nx, ny)
                detector[5 * 17 + 4].add_mask(0, 0, nx, ny)
                detector[5 * 15 + 4].add_mask(cx, 0, cx * 2, cy)
            else:
                detector[1].add_mask((nx + dx) * 4, 0, (nx + dx) * 4 + nx, ny)
                detector[17].add_mask(0, 0, nx, ny)
                detector[17].add_mask((nx + dx) * 4, 0, (nx + dx) * 4 + nx, ny)
                detector[15].add_mask((nx + dx) * 4 + cx, 0,
                                      (nx + dx) * 4 + cx * 2, cy)
        elif timestamp > calendar.timegm((2019, 11, 26, 0, 0, 0)):
            # 2019 run 5
            # module @ row 17 column 0
            # module @ row 17 column 4
            if self._multi_panel:
                detector[5 * 17].add_mask(0, 0, nx, ny)
                detector[5 * 17 + 4].add_mask(0, 0, nx, ny)
            else:
                detector[17].add_mask(0, 0, nx, ny)
                detector[17].add_mask((nx + dx) * 4, 0, (nx + dx) * 4 + nx, ny)
        elif timestamp > calendar.timegm((2019, 9, 3, 0, 0, 0)):
            # 2019 run 4
            # module @ row 15 column 2
            # module @ row 17 column 0
            if self._multi_panel:
                detector[5 * 15 + 2].add_mask(0, 0, nx, ny)
                detector[5 * 17].add_mask(0, 0, nx, ny)
            else:
                detector[15].add_mask((nx + dx) * 2, 0, (nx + dx) * 2 + nx, ny)
                detector[17].add_mask(0, 0, nx, ny)

        return detector
  def _goniometer(self):
    '''Return a model for a simple single-axis goniometer. This should
    probably be checked against the image header.'''

    from dxtbx.format.FormatCBFMiniPilatusHelpers import get_pilatus_timestamp
    timestamp = get_pilatus_timestamp(
        self._cif_header_dictionary['timestamp'])
    # Goniometer changed from reverse phi to conventional rotation direction
    # on this date:
    # calendar.timegm(time.strptime('2016-04-01T00:00:00', '%Y-%m-%dT%H:%M:%S'))
    if timestamp < 1459468800:
      return self._goniometer_factory.single_axis_reverse()
    return self._goniometer_factory.single_axis()
Esempio n. 6
0
    def _scan(self):
        exposure_time = float(self._cif_header_dictionary["Exposure_period"].split()[0])
        osc_start = float(self._cif_header_dictionary["Start_angle"].split()[0])
        osc_range = float(self._cif_header_dictionary["Angle_increment"].split()[0])

        if "timestamp" in self._cif_header_dictionary:
            timestamp = get_pilatus_timestamp(self._cif_header_dictionary["timestamp"])
        else:
            timestamp = 0.0

        return self._scan_factory.single_file(
            self._image_file, exposure_time, osc_start, osc_range, timestamp
        )
Esempio n. 7
0
    def _scan(self):
        """Return the scan information for this image."""

        format = self._scan_factory.format("CBF")

        exposure_time = float(self._cif_header_dictionary["Exposure_period"].split()[0])

        osc_start = float(self._cif_header_dictionary["Start_angle"].split()[0])
        osc_range = float(self._cif_header_dictionary["Angle_increment"].split()[0])

        timestamp = get_pilatus_timestamp(self._cif_header_dictionary["timestamp"])

        return self._scan_factory.single(
            self._image_file, format, exposure_time, osc_start, osc_range, timestamp
        )
  def _scan(self):
    format = self._scan_factory.format('CBF')

    exposure_time = float(
        self._cif_header_dictionary['Exposure_period'].split()[0])
    osc_start = float(
        self._cif_header_dictionary['Start_angle'].split()[0])
    osc_range = float(
        self._cif_header_dictionary['Angle_increment'].split()[0])

    timestamp = get_pilatus_timestamp(
        self._cif_header_dictionary['timestamp'])

    return self._scan_factory.single(
        self._image_file, format, exposure_time,
        osc_start, osc_range, timestamp)
Esempio n. 9
0
  def _scan(self):
    format = self._scan_factory.format('CBF')

    exposure_time = float(
        self._cif_header_dictionary['Exposure_period'].split()[0])
    osc_start = float(
        self._cif_header_dictionary['Start_angle'].split()[0])
    osc_range = float(
        self._cif_header_dictionary['Angle_increment'].split()[0])

    timestamp = get_pilatus_timestamp(
        self._cif_header_dictionary['timestamp'])

    return self._scan_factory.single(
        self._image_file, format, exposure_time,
        osc_start, osc_range, timestamp)
Esempio n. 10
0
  def _scan(self):
    '''Return the scan information for this image.'''

    format = self._scan_factory.format('CBF')

    exposure_time = float(
        self._cif_header_dictionary['Exposure_period'].split()[0])

    osc_start = float(
        self._cif_header_dictionary['Start_angle'].split()[0])
    osc_range = float(
        self._cif_header_dictionary['Angle_increment'].split()[0])

    if "timestamp" in self._cif_header_dictionary:
      timestamp = get_pilatus_timestamp(
      self._cif_header_dictionary['timestamp'])
    else:
      timestamp = 0.0
    return self._scan_factory.single(
        self._image_file, format, exposure_time,
        osc_start, osc_range, timestamp)