def get_raw_data(self): """Get the pixel intensities""" from boost.python import streambuf try: from dxtbx.ext import read_uint16_bs except ImportError: from dxtbx import read_uint16_bs from scitbx.array_family import flex f = FormatTimepixRaw512x512.open_file(self._image_file, "rb") f.read(self._header_size) raw_data = read_uint16_bs(streambuf(f), 512 * 512) image_size = (512, 512) raw_data.reshape(flex.grid(image_size[1], image_size[0])) self._raw_data = [] d = self.get_detector() for panel in d: xmin, ymin, xmax, ymax = self.coords[panel.get_name()] self._raw_data.append(raw_data[ymin:ymax, xmin:xmax]) return tuple(self._raw_data)
def _get_endianic_raw_data(self, size): big_endian = self._header_dictionary["BYTE_ORDER"] == "big_endian" with self.open_file(self._image_file, "rb") as fh: fh.seek(self._header_size) if big_endian == is_big_endian(): raw_data = read_uint16(streambuf(fh), int(size[0] * size[1])) else: raw_data = read_uint16_bs(streambuf(fh), int(size[0] * size[1])) # note that x and y are reversed here raw_data.reshape(flex.grid(size[1], size[0])) return raw_data