code: def dichotomic_value(
      t, t_values, y_values, inter_mode=TimeFunction.InterLinear
  ):
      """Returns value of the TimeFunction obtained by dichotomic search
  
      Parameters
      ----------
      t : `np.ndarray`
          Times at which we compute f(t)
  
      t_values : `np.ndarray`, shape=(n_points,)
          A sorted array given the time considered
  
      y_values : `np.ndarray`, shape=(n_points,)
          Array giving the values of the previous t_array
  
      inter_mode : `TimeFunction.Intermode`
          Selected inter mode
  
      Returns
      -------
      output : `np.ndarray`
          Interpolated values of f(t) given t_values and y_values
      """
      f_t = np.ones_like(t)
  
      before_first_time = t < t_values[0]
      after_last_time = t > t_values[-1]
  
      f_t[before_first_time] = 0
      f_t[after_last_time] = 0
  
      inside_time = np.invert(before_first_time) & np.invert(
          after_last_time
      )
  
      if inter_mode == TimeFunction.InterLinear:
          f_t[inside_time] = np.interp(
              t[inside_time], t_values, y_values
          )
  
      elif inter_mode == TimeFunction.InterConstLeft:
          index_right = np.searchsorted(t_values, t, side="left")
          f_t[inside_time] = y_values[index_right[inside_time]]
  
      elif inter_mode == TimeFunction.InterConstRight:
          index_left = np.searchsorted(t_values, t, side="right") - 1
          f_t[inside_time] = y_values[index_left[inside_time]]
  
      return f_t
  
file_path: tick/tick/base/tests/time_func_test.py
imports: import unittest
  import itertools
  import numpy
  from tick.base import TimeFunction
label_desc: Use image node_id 1 for calling a global function with example usage: dichotomic_value(t, t_values, y_values, inter_mode) and returns: f_t