Beispiel #1
0
    def apply(self, data: np.ndarray, tile_slice: Slice):
        """
        Apply corrections in-place to `data`, cropping the
        correction data to the `tile_slice`.
        """
        dark_frame = self.get_dark_frame()
        gain_map = self.get_gain_map()

        if not self.have_corrections():
            return

        sig_slice = tile_slice.get(sig_only=True)

        if dark_frame is not None:
            dark_frame = dark_frame[sig_slice]
        if gain_map is not None:
            gain_map = gain_map[sig_slice]

        correct(buffer=data,
                dark_image=dark_frame,
                gain_map=gain_map,
                repair_descriptor=self.repair_descriptor(
                    tile_slice.discard_nav()),
                inplace=True,
                sig_shape=tuple(tile_slice.shape.sig),
                allow_empty=self._allow_empty)
Beispiel #2
0
 def get(self,
         key: Slice,
         dtype=None,
         sparse_backend=None,
         transpose=True,
         backend=None):
     if not isinstance(key, Slice):
         raise TypeError("MaskContainer.get() can only be called with "
                         "DataTile/Slice/Partition instances")
     return self._get(key.discard_nav(), dtype, sparse_backend, transpose,
                      backend)