docstr: Get the start & end indices of the high-frequency data.
docstr_tok: ["Get","the","start","&","end","indices","of","the","high-frequency","data","."]
code: def get_start_end_indices(
      hf_trace_data, axis_type, start, end
  ) -> Tuple[int, int]:
      """Get the start & end indices of the high-frequency data."""
      # Base case: no hf data, or both start & end are None
      if not len(hf_trace_data["x"]):
          return 0, 0
      elif start is None and end is None:
          return 0, len(hf_trace_data["x"])
  
      # NOTE: as we use bisect right for the end index, we do not need to add a
      #      small epsilon to the end value
      start = hf_trace_data["x"][0] if start is None else start
      end = hf_trace_data["x"][-1] if end is None else end
  
      # NOTE: we must verify this before check if the x is a range-index
      if axis_type == "log":
          start, end = 10**start, 10**end
  
      # We can compute the start & end indices directly when it is a RangeIndex
      if isinstance(hf_trace_data["x"], pd.RangeIndex):
          x_start = hf_trace_data["x"].start
          x_step = hf_trace_data["x"].step
          start_idx = int(max((start - x_start) // x_step, 0))
          end_idx = int((end - x_start) // x_step)
          return start_idx, end_idx
      # TODO: this can be performed as-well for a fixed frequency range-index w/ freq
  
      if axis_type == "date":
          start, end = pd.to_datetime(start), pd.to_datetime(end)
          # convert start & end to the same timezone
          if isinstance(hf_trace_data["x"], pd.DatetimeIndex):
              tz = hf_trace_data["x"].tz
              assert start.tz == end.tz
              start = PlotlyAggregatorParser.to_same_tz(start, tz)
              end = PlotlyAggregatorParser.to_same_tz(end, tz)
  
      # Search the index-positions
      start_idx = bisect.bisect_left(hf_trace_data["x"], start)
      end_idx = bisect.bisect_right(hf_trace_data["x"], end)
      return start_idx, end_idx
  
file_path: plotly-resampler/plotly_resampler/aggregation/plotly_aggregator_parser.py
imports: from __future__ import annotations
  import bisect
  from typing import Tuple, Union
  import numpy
  import pandas
  import pytz
  from .aggregation_interface import DataAggregator, DataPointSelector
  from .gap_handler_interface import AbstractGapHandler
  from .gap_handlers import NoGapHandler
label_desc: Use image node_id 3 for calling the PlotlyAggregatorParser obj's underlying member method code with example usage: obj.get_start_end_indices(hf_trace_data, axis_type, start, end) and returns: start_idx,  end_idx, int,  int, start_idx,  end_idx, int,  len