code: def _extract_process_interval(
      plot_nodes,
      end_time,
      timestamps,
      intensities=None,
      intensity_times=None,
      t_min=None,
      t_max=None,
      max_jumps=None,
  ):
      t_min_is_specified = t_min is not None
      if not t_min_is_specified:
          t_min = 0
      t_max_is_specified = t_max is not None
      if not t_max_is_specified:
          t_max = end_time
  
      if t_min >= end_time:
          raise ValueError("`t_min` should be smaller than `end_time`")
      if t_max <= 0:
          raise ValueError("`t_max` should be positive")
  
      if max_jumps is not None:
          # if neither t_min or t_ax is given, we act as if t_min=0 was given
          if t_min_is_specified or not t_max_is_specified:
              for i in plot_nodes:
                  timestamps_i = timestamps[i]
                  i_t_min = np.searchsorted(
                      timestamps_i, t_min, side="left"
                  )
                  # This might happen if max_points = 0
                  last_index = i_t_min + max_jumps - 1
                  if last_index < 0:
                      t_max = 0
                  elif (
                      last_index < len(timestamps_i)
                      and timestamps_i[last_index] < t_max
                  ):
                      t_max = timestamps_i[last_index]
  
          elif t_max_is_specified:
              for i in plot_nodes:
                  timestamps_i = timestamps[i]
                  i_t_max = np.searchsorted(
                      timestamps_i, t_max, side="left"
                  )
                  # This might happen if max_points = 0
                  first_index = i_t_max - max_jumps
                  if first_index >= len(timestamps_i) - 1:
                      t_min = end_time
                  elif (
                      first_index >= 0
                      and timestamps_i[first_index] > t_min
                  ):
                      t_min = timestamps_i[first_index]
  
      extracted_timestamps = [
          timestamps_i[
              (timestamps_i >= t_min) & (timestamps_i <= t_max)
          ]
          for timestamps_i in timestamps
      ]
  
      if intensity_times is not None:
          intensity_extracted_points = (intensity_times >= t_min) & (
              intensity_times <= t_max
          )
          extracted_intensity_times = intensity_times[
              intensity_extracted_points
          ]
  
          extracted_intensity = [
              intensity[intensity_extracted_points]
              for intensity in intensities
          ]
      else:
          extracted_intensity_times, extracted_intensity = None, None
  
      return (
          extracted_timestamps,
          extracted_intensity_times,
          extracted_intensity,
      )
  
file_path: tick/tick/plot/plot_point_processes.py
imports: import matplotlib.pyplot
  import numpy
  from typing import Optional, List
  from tick.hawkes.simulation.base import SimuPointProcess
label_desc: Use image node_id 4 for calling a global function with example usage: _extract_process_interval(plot_nodes, end_time, timestamps, intensities, intensity_times, t_min, t_max, max_jumps) and returns: extracted_timestamps,  extracted_intensity_times,  extracted_intensity