class_docstr: Step sampler that does not require each step to be evaluated
class_docstr_tok: ["Step","sampler","that","does","not","require","each","step","to","be","evaluated"]
code: def bisect_at(
      self,
      lefti,
      leftx,
      leftv,
      midi,
      midx,
      midv,
      righti,
      rightx,
      rightv,
      sign,
      Llast,
  ):
      # Bisect to find first point outside
  
      # left is inside (i: index, x: coordinate, v: direction)
      # mid is the middle just evaluated (if not None)
      # right is outside
      if self.log:
          print("bisecting ...", lefti, midi, righti)
  
      if midi is None:
          # check if right is actually outside
          if Llast is None:
              # yes it is. continue below
              pass
          else:
              # right is actually inside
              # so we successfully jumped all the way successfully
              if self.log:
                  print("successfully went all the way in one jump!")
              self.contourpath.add(righti, rightx, rightv, Llast)
              Llast = None
              return
      else:
          # shrink interval based on previous evaluation point
          if Llast is not None:
              # print("   inside.  updating interval %d-%d" % (midi, righti))
              lefti, leftx, leftv = midi, midx, midv
              self.contourpath.add(midi, midx, midv, Llast)
              Llast = None
          else:
              # print("   outside. updating interval %d-%d" % (lefti, midi))
              righti, rightx, rightv = midi, midx, midv
  
      # we need to bisect. righti was outside
      midi = (righti + lefti) // 2
      if midi == lefti or midi == righti:
          # we are done bisecting. right is the first point outside
          if self.log:
              print(
                  "  bisecting gave reflection point",
                  righti,
                  rightx,
                  rightv,
              )
          if self.plot:
              plt.plot(rightx[0], rightx[1], "xr")
          # compute reflected direction
          vk = (
              self.reverse(rightx, rightv * sign, plot=self.plot) * sign
          )
          if self.log:
              print("  reversing there", rightv)
          # go from reflection point one step in that direction
          # that is our new point
          xk, vk = extrapolate_ahead(
              sign, rightx, vk, contourpath=self.contourpath
          )
          if self.log:
              print(
                  "  making one step from",
                  rightx,
                  rightv,
                  "-->",
                  xk,
                  vk,
              )
          self.nreflections += 1
          if self.log:
              print("  trying new point,", xk)
          self.goals.insert(0, ("reflect-at", righti, xk, vk, sign))
          return xk, False
      else:
          if self.log:
              print("  continue bisect at", midi)
          # we should evaluate the middle point
          midx, midv = extrapolate_ahead(
              midi - lefti, leftx, leftv, contourpath=self.contourpath
          )
          # continue bisecting
          self.goals.insert(
              0,
              (
                  "bisect",
                  lefti,
                  leftx,
                  leftv,
                  midi,
                  midx,
                  midv,
                  righti,
                  rightx,
                  rightv,
                  sign,
              ),
          )
          return midx, False
  
imports: import numpy
  from numpy.linalg import norm
  import matplotlib.pyplot
  from .samplingpath import angle, extrapolate_ahead
label_desc: Use image node_id 3 for calling the ClockedBisectSampler obj's underlying member method code with example usage: obj.bisect_at(lefti, leftx, leftv, midi, midx, midv, righti, rightx, rightv, sign, Llast) and returns: xk,  False, midx,  False