class_docstr: ## Piecewise schedule
docstr: ### Find `y` for given `x`
docstr_tok: ["#","#","#","Find","`","y","`","for","given","`","x","`"]
code: def __call__(self, x):
      """
      ### Find `y` for given `x`
      """
  
      # iterate through each segment
      for (x1, y1), (x2, y2) in zip(
          self._endpoints[:-1], self._endpoints[1:]
      ):
          # interpolate if `x` is within the segment
          if x1 <= x < x2:
              dx = float(x - x1) / (x2 - x1)
              return y1 + dx * (y2 - y1)
  
      # return outside value otherwise
      return self._outside_value
  
imports: from typing import Tuple, List
label_desc: Use image node_id 2 for calling the Piecewise obj's underlying member method code with example usage: obj.__call__(x) and returns: self, unknown