code: def _detect_core(self, series: TimeSeries) -> TimeSeries:
      raise_if_not(
          series.is_deterministic,
          "This detector only works on deterministic series.",
      )
  
      raise_if(
          len(self.low_threshold) > 1
          and len(self.low_threshold) != series.width,
          "The number of components of input must be equal to the number"
          + " of threshold values. Found number of "
          + f"components equal to {series.width} and expected {len(self.low_threshold)}.",
      )
  
      # if length is 1, tile it to series width:
      low_threshold = (
          self.low_threshold * series.width
          if len(self.low_threshold) == 1
          else self.low_threshold
      )
      high_threshold = (
          self.high_threshold * series.width
          if len(self.high_threshold) == 1
          else self.high_threshold
      )
  
      # (time, components)
      np_series = series.all_values(copy=False).squeeze(-1)
  
      def _detect_fn(x, lo, hi):
          # x of shape (time,) for 1 component
          return (x < (np.NINF if lo is None else lo)) | (
              x > (np.Inf if hi is None else hi)
          )
  
      detected = np.zeros_like(np_series, dtype=int)
  
      for component_idx in range(series.width):
          detected[:, component_idx] = _detect_fn(
              np_series[:, component_idx],
              low_threshold[component_idx],
              high_threshold[component_idx],
          )
  
      return TimeSeries.from_times_and_values(
          series.time_index, detected
      )
  
file_path: darts/darts/ad/detectors/threshold_detector.py
imports: from typing import Sequence, Union
  import numpy
  from darts.ad.detectors.detectors import Detector
  from darts.logging import raise_if, raise_if_not
  from darts.timeseries import TimeSeries
label_desc: Use image node_id 2 for calling the ThresholdDetector obj's underlying member method code with example usage: obj._detect_core(series) and returns: TimeSeries, unknown