Ejemplo n.º 1
0
 def set_mask(self, mask):
     with self._sem:
         self._mask = mask
         if mask is not None:
             self._mask_crc = crc32(mask)
         else:
             self._mask_crc = None
Ejemplo n.º 2
0
 def set_mask(self, mask):
     with self._sem:
         self._mask = mask
         if mask is not None:
             self._mask_crc = crc32(mask)
         else:
             self._mask_crc = None
Ejemplo n.º 3
0
 def get_mask(self):
     if self._mask is False:
         with self._sem:
             if self._mask is False:
                 self._mask = self.calc_mask()  # gets None in worse cases
                 if self._mask is not None:
                     self._mask_crc = crc32(self._mask)
     return self._mask
Ejemplo n.º 4
0
 def get_mask(self):
     if self._mask is False:
         with self._sem:
             if self._mask is False:
                 self._mask = self.calc_mask()  # gets None in worse cases
                 if self._mask is not None:
                     self._mask_crc = crc32(self._mask)
     return self._mask
Ejemplo n.º 5
0
 def set_maskfile(self, maskfile):
     if fabio:
         with self._sem:
             self._mask = numpy.ascontiguousarray(fabio.open(maskfile).data,
                                                  dtype=numpy.int8)
             self._mask_crc = crc32(self._mask)
             self._maskfile = maskfile
     else:
         logger.error("FabIO is not available, unable to load the image to set the mask.")
Ejemplo n.º 6
0
 def set_maskfile(self, maskfile):
     try:
         import fabio
     except:
         ImportError("Please install fabio to load images")
     with self._sem:
         self._mask = numpy.ascontiguousarray(fabio.open(maskfile).data, dtype=numpy.int8)
         self._mask_crc = crc32(self._mask)
         self._maskfile = maskfile
Ejemplo n.º 7
0
 def set_maskfile(self, maskfile):
     if fabio:
         with self._sem:
             self._mask = numpy.ascontiguousarray(fabio.open(maskfile).data,
                                                  dtype=numpy.int8)
             self._mask_crc = crc32(self._mask)
             self._maskfile = maskfile
     else:
         logger.error("FabIO is not available, unable to load the image to set the mask.")
Ejemplo n.º 8
0
 def setFlatfieldFile(self, imagefile):
     """
     @param imagefile: filename with the path to the flatfield image
     """
     with self._sem:
         if imagefile:
             self.flatfile = imagefile
             try:
                 self.flatfield = numpy.ascontiguousarray(fabio.open(imagefile).data, numpy.float32)
             except Exception as error:
                 logger.warning("setFlatfieldFile: Unable to read file %s: %s" % (imagefile, error))
             else:
                 self.flatfield_crc = crc32(self.flatfield)
                 self.header["flatfield"] = imagefile
         else:
             self.flatfile = self.flatfield = self.flatfield_crc = None
             self.header["flatfield"] = "None"
Ejemplo n.º 9
0
 def setDarkcurrentFile(self, imagefile):
     """
     @param imagefile: filename with the path to the dark image
     """
     with self._sem:
         if imagefile:
             self.darkfile = imagefile
             try:
                 self.darkcurrent = numpy.ascontiguousarray(fabio.open(imagefile).data, numpy.float32)
             except Exception as error:
                 logger.warning("setDarkcurrentFile: Unable to read file %s: %s" % (imagefile, error))
             else:
                 self.darkcurrent_crc = crc32(self.darkcurrent)
                 self.header["darkcurrent"] = imagefile
         else:
             self.darkfile = self.darkcurrent = self.darkcurrent_crc = None
             self.header["darkcurrent"] = "None"
Ejemplo n.º 10
0
 def setFlatfieldFile(self, imagefile):
     """
     :param imagefile: filename with the path to the flatfield image
     """
     with self._sem:
         if imagefile:
             self.flatfile = imagefile
             try:
                 self.flatfield = numpy.ascontiguousarray(
                     fabio.open(imagefile).data, numpy.float32)
             except Exception as error:
                 logger.warning(
                     "setFlatfieldFile: Unable to read file %s: %s",
                     imagefile, error)
             else:
                 self.flatfield_crc = crc32(self.flatfield)
                 self.header["flatfield"] = imagefile
         else:
             self.flatfile = self.flatfield = self.flatfield_crc = None
             self.header["flatfield"] = "None"
Ejemplo n.º 11
0
 def setDarkcurrentFile(self, imagefile):
     """
     :param imagefile: filename with the path to the dark image
     """
     with self._sem:
         if imagefile:
             self.darkfile = imagefile
             try:
                 self.darkcurrent = numpy.ascontiguousarray(
                     fabio.open(imagefile).data, numpy.float32)
             except Exception as error:
                 logger.warning(
                     "setDarkcurrentFile: Unable to read file %s: %s",
                     imagefile, error)
             else:
                 self.darkcurrent_crc = crc32(self.darkcurrent)
                 self.header["darkcurrent"] = imagefile
         else:
             self.darkfile = self.darkcurrent = self.darkcurrent_crc = None
             self.header["darkcurrent"] = "None"
Ejemplo n.º 12
0
 def set_mask(self, mask):
     with self._sem:
         self._mask = mask
         self._mask_crc = crc32(mask)