docs: def rectify(self, slitlet2d, resampling, transformation, inverse=False):
          """Rectify slitlet using computed transformation.
  
          Parameters
          ----------
          slitlet2d : numpy array
              Image containing the 2d slitlet image.
          resampling : int
              1: nearest neighbour, 2: flux preserving interpolation.
          transformation : int
              1: initial, 2: modeled
          inverse : bool
              If true, the inverse rectification transformation is
              employed.
  
          Returns
          -------
          slitlet2d_rect : numpy array
              Rectified slitlet image.
  
          """
  
          if resampling not in [1, 2]:
              raise ValueError("Unexpected resampling value=" + str(resampling))
  
          if transformation not in [1, 2]:
              raise ValueError("Unexpected transformation value=" +
                               str(transformation))
  
          # verify image dimension
          naxis2, naxis1 = slitlet2d.shape
          if naxis1 != self.bb_nc2_orig - self.bb_nc1_orig + 1:
              raise ValueError("Unexpected slitlet2d_rect naxis1")
          if naxis2 != self.bb_ns2_orig - self.bb_ns1_orig + 1:
              raise ValueError("Unexpected slitlet2d_rect naxis2")
  
          # transformation to be employed (and direction)
          if transformation == 1:
              if inverse:
                  aij = self.tti_aij
                  bij = self.tti_bij
              else:
                  aij = self.ttd_aij
                  bij = self.ttd_bij
          else:
              if inverse:
                  aij = self.tti_aij_longslit_model
                  bij = self.tti_bij_longslit_model
              else:
                  aij = self.ttd_aij_longslit_model
                  bij = self.ttd_bij_longslit_model
  
          # rectify image
          slitlet2d_rect = rectify2d(
              image2d=slitlet2d,
              aij=aij,
              bij=bij,
              resampling=resampling
          )
  
          if abs(self.debugplot % 10) != 0:
              title = "Slitlet#" + str(self.islitlet) + " (rectify)"
              ax = ximshow(slitlet2d_rect, title=title,
                           first_pixel=(self.bb_nc1_orig, self.bb_ns1_orig),
                           show=False)
              if self.list_arc_lines is not None:
                  # intersection points
                  ax.plot(self.x_inter_rect, self.y_inter_rect, 'bo')
              # grid with fitted transformation: spectrum trails
              xx = np.arange(0, self.bb_nc2_orig - self.bb_nc1_orig + 1,
                             dtype=np.float)
              for spectrail in self.list_spectrails:
                  yy0 = self.corr_yrect_a + \
                        self.corr_yrect_b * spectrail.y_rectified
                  yy = np.tile([yy0 - self.bb_ns1_orig], xx.size)
                  ax.plot(xx + self.bb_nc1_orig, yy + self.bb_ns1_orig, "b")
              for spectrail in self.list_frontiers:
                  yy0 = self.corr_yrect_a + \
                        self.corr_yrect_b * spectrail.y_rectified
                  yy = np.tile([yy0 - self.bb_ns1_orig], xx.size)
                  ax.plot(xx + self.bb_nc1_orig, yy + self.bb_ns1_orig, "b:")
              # grid with fitted transformation: arc lines
              ylower_line = \
                  self.list_spectrails[self.i_lower_spectrail].y_rectified
              ylower_line = self.corr_yrect_a + self.corr_yrect_b * ylower_line
              yupper_line = \
                  self.list_spectrails[self.i_upper_spectrail].y_rectified
              yupper_line = self.corr_yrect_a + self.corr_yrect_b * yupper_line
              n_points = int(yupper_line - ylower_line + 0.5) + 1
              yy = np.linspace(ylower_line - self.bb_ns1_orig,
                               yupper_line - self.bb_ns1_orig,
                               num=n_points,
                               dtype=np.float)
              if self.list_arc_lines is not None:
                  for arc_line in self.list_arc_lines:
                      xline = arc_line.x_rectified - self.bb_nc1_orig
                      xx = np.array([xline] * n_points)
                      ax.plot(xx + self.bb_nc1_orig, yy + self.bb_ns1_orig, "b")
              # show plot
              pause_debugplot(self.debugplot, pltshow=True)
  
          return slitlet2d_rect