def slice_callback_with_high_performance_http_data(self):
     BYU = self.object.read()
     linearintdata = flex.int_from_byte_str(BYU)
     provisional_size = linearintdata.size()
     if provisional_size == 480285:
         linearintdata.reshape(flex.grid((195, 2463)))
     elif provisional_size == 6224001:
         linearintdata.reshape(flex.grid((2527, 2463)))
     else:
         raise ImageException("wrong number of pixels for Pilatus image")
     del self.object  #once the data are copied, close the stream
     return linearintdata
    def read(self, algorithm="buffer_based"):
        self.readHeader()
        if self.linearintdata != None and\
          self.linearintdata.size()==self.size1*self.size2:
            #data has already been read
            return
        if self.bin == 2:
            raise ImageException("2-by-2 binning not supported for miniCBF")
        try:
            from cbflib_adaptbx import cbf_binary_adaptor  # optional package
            self.adaptor = cbf_binary_adaptor(self.filename)

            # assert algorithm in ["cbflib","cbflib_optimized","buffer_based"]

            data = self.adaptor.uncompress_implementation(
                algorithm).uncompress_data(self.size1, self.size2)
            self.bin_safe_set_data(data)

        except Exception:
            raise ImageException(
                "unable to read miniCBF data; contact authors")
 def getEndian(self):
   raise ImageException("endian-ness not computed for miniCBF")
 def fileLength(self):
   raise ImageException("file length not computed for miniCBF")