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) FormatSMVADSCSN.__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.''' assert (self.understand(image_file)) FormatSMVADSCSN.__init__(self, image_file, **kwargs) return
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)) FormatSMVADSCSN.__init__(self, image_file) return
def get_raw_data(self): '''Get the pixel intensities (i.e. read the image and return as a flex array of integers.)''' from boost.python import streambuf from dxtbx import read_uint16, read_uint16_bs, is_big_endian from scitbx.array_family import flex assert(len(self.get_detector()) == 1) image_pedestal = int(self._header_dictionary['IMAGE_PEDESTAL']) panel = self.get_detector()[0] size = panel.get_image_size() f = FormatSMVADSCSN.open_file(self._image_file, 'rb') f.read(self._header_size) if self._header_dictionary['BYTE_ORDER'] == 'big_endian': big_endian = True else: big_endian = False if big_endian == is_big_endian(): raw_data = read_uint16(streambuf(f), int(size[0] * size[1])) else: raw_data = read_uint16_bs(streambuf(f), int(size[0] * size[1])) # apply image pedestal, will result in *negative pixel values* raw_data -= image_pedestal image_size = panel.get_image_size() raw_data.reshape(flex.grid(image_size[1], image_size[0])) return raw_data
def get_raw_data(self): '''Get the pixel intensities (i.e. read the image and return as a flex array of integers.)''' from boost.python import streambuf from dxtbx import read_uint16, read_uint16_bs, is_big_endian from scitbx.array_family import flex assert (len(self.get_detector()) == 1) image_pedestal = int(self._header_dictionary['IMAGE_PEDESTAL']) panel = self.get_detector()[0] size = panel.get_image_size() f = FormatSMVADSCSN.open_file(self._image_file, 'rb') f.read(self._header_size) if self._header_dictionary['BYTE_ORDER'] == 'big_endian': big_endian = True else: big_endian = False if big_endian == is_big_endian(): raw_data = read_uint16(streambuf(f), int(size[0] * size[1])) else: raw_data = read_uint16_bs(streambuf(f), int(size[0] * size[1])) # apply image pedestal, will result in *negative pixel values* raw_data -= image_pedestal image_size = panel.get_image_size() raw_data.reshape(flex.grid(image_size[1], image_size[0])) return raw_data
def understand(image_file): """Check to see if this is ADSC SN 920.""" # check this is detector serial number 920 size, header = FormatSMVADSCSN.get_smv_header(image_file) return int(header["DETECTOR_SN"]) == 920
def understand(image_file): '''Check to see if this is ADSC SN 928.''' # check this is detector serial number 928 size, header = FormatSMVADSCSN.get_smv_header(image_file) if int(header['DETECTOR_SN']) != 928: return False return True
def understand(image_file): '''Check to see if this is ADSC SN 458 or 914.''' # check this is detector serial number 458 or 914 size, header = FormatSMVADSCSN.get_smv_header(image_file) if int(header['DETECTOR_SN']) not in (458, 914): return False return True
def understand(image_file): """Check to see if this is ADSC SN 926.""" # check this is detector serial number 926 (or 907) size, header = FormatSMVADSCSN.get_smv_header(image_file) if int(header["DETECTOR_SN"]) not in [926, 907]: return False return True
def understand(image_file): """Check to see if this is ADSC SN 905.""" # check this is detector serial number 905 size, header = FormatSMVADSCSN.get_smv_header(image_file) if int(header["DETECTOR_SN"]) != 905: return False return True
def understand(image_file): """Check to see if this is ADSC SN 457.""" # check this is detector serial number 457 size, header = FormatSMVADSCSN.get_smv_header(image_file) if int(header["DETECTOR_SN"]) != 457: return False return True
'+x', '-y', (pixel_size, pixel_size), image_size, (underload, overload), []) def _goniometer(self): '''Return a model for a simple single-axis goniometer. This should probably be checked against the image header.''' return self._goniometer_factory.single_axis_reverse() def _scan(self): '''Return the scan information for this image. There may be no timestamps in there...''' format = self._scan_factory.format('SMV') exposure_time = float(self._header_dictionary['TIME']) epoch = 0 osc_start = float(self._header_dictionary['OSC_START']) osc_range = float(self._header_dictionary['OSC_RANGE']) return self._scan_factory.single(self._image_file, format, exposure_time, osc_start, osc_range, epoch) if __name__ == '__main__': import sys for arg in sys.argv[1:]: print FormatSMVADSCSN.understand(arg)
(beam_y, (image_size[1] * pixel_size) - beam_x), '+x', '-y', (pixel_size, pixel_size), image_size, (underload, overload), []) def _goniometer(self): '''Return a model for a simple single-axis goniometer. This should probably be checked against the image header.''' return self._goniometer_factory.single_axis_reverse() def _scan(self): '''Return the scan information for this image. There may be no timestamps in there...''' format = self._scan_factory.format('SMV') exposure_time = float(self._header_dictionary['TIME']) epoch = 0 osc_start = float(self._header_dictionary['OSC_START']) osc_range = float(self._header_dictionary['OSC_RANGE']) return self._scan_factory.single( self._image_file, format, exposure_time, osc_start, osc_range, epoch) if __name__ == '__main__': import sys for arg in sys.argv[1:]: print FormatSMVADSCSN.understand(arg)