class_docstr: Find a new point with a series of small steps
class_docstr_tok: ["Find","a","new","point","with","a","series","of","small","steps"]
code: def expand_to(self, i):
      if i > 0 and self.contourpath.samplingpath.fwd_possible:
          starti, startx, startv, _ = max(self.points)
          if i > starti:
              if self.log:
                  print("going forward...", i, starti)
              j = starti + 1
              xj, v = self.contourpath.extrapolate(j)
              if j != i:  # ultimate goal not reached yet
                  self.goals.insert(0, ("expand-to", i))
              self.goals.insert(0, ("eval-at", j, xj, v, +1))
              return xj, False
          else:
              if self.log:
                  print("already done...", i, starti)
              # we are already done
              pass
      elif i < 0 and self.contourpath.samplingpath.rwd_possible:
          starti, startx, startv, _ = min(self.points)
          if i < starti:
              if self.log:
                  print("going backwards...", i, starti)
              j = starti - 1
              xj, v = self.contourpath.extrapolate(j)
              if j != i:  # ultimate goal not reached yet
                  self.goals.insert(0, ("expand-to", i))
              self.goals.insert(0, ("eval-at", j, xj, v, -1))
              return xj, False
          else:
              if self.log:
                  print("already done...", i, starti)
              # we are already done
              pass
      else:
          # we are trying to go somewhere we cannot.
          # skip to other goals
          pass
  
imports: import numpy
  from numpy.linalg import norm
  import matplotlib.pyplot
  from .samplingpath import angle, extrapolate_ahead
label_desc: Use image node_id 2 for calling the ClockedStepSampler obj's underlying member method code with example usage: obj.expand_to(i) and returns: xj,  False, xj,  False