code: def _get_min_val(spaceshift, *params):
  r
      spacing, shift = spaceshift
      n, fI, fC, r, r_def, error, reim, cvar, verb, plot, log = params
      dlf = _calculate_filter(n, spacing, shift, fI, r_def, reim, 'filt')
      k = dlf.base/r[:, None]
      for i, f in enumerate(fC):
          lhs = f.lhs(k)
          if f.name == 'j2':
              rhs0 = np.dot(lhs[0], getattr(dlf, 'j0'))/r
              rhs1 = np.dot(lhs[1], getattr(dlf, 'j1'))/r**2
              rhs = rhs0 + rhs1
          else:
              rhs = np.dot(lhs, getattr(dlf, f.name))/r
          rel_error = np.abs((rhs - f.rhs)/f.rhs)
          imin0 = np.where(rel_error > error)[0]
          if np.all(rhs == 0) or np.all(np.isnan(rhs)):
              imin0 = 0
          elif imin0.size == 0:
              imin0 = rhs.size-1
              if verb > 0 and log['warn-r'] == 0:
                  print('* WARNING :: all data have error < ' + str(error) +
                        '; choose larger r or set error-level higher.')
                  log['warn-r'] = 1
          else:
              if imin0.size > 4:
                  imin0 = np.max([0, imin0[4]-5])
              else:
                  imin0 = np.max([0, imin0[0]-1])
          if cvar == 'amp':
              min_val0 = np.abs(rhs[imin0])
          else:
              min_val0 = 1/r[imin0]
          if i == 0:
              imin = dc(imin0)
              min_val = dc(min_val0)
          else:
              if min_val0 > min_val:
                  min_val = dc(min_val0)
                  imin = dc(imin0)
          if plot > 2:
              _plot_inversion(f, rhs, r, k, imin0, spacing, shift, cvar)
      if verb > 1:
          log = _print_count(log)
      return np.where(imin == 0, np.inf, min_val)