code: def scale_angles(gammas, scaler1=None, scaler2=None):
      """
      Scale all angles in which angles <= 90
      degree will be scaled within [0 - 54.7] and
      angles > 90 will be scaled within [90 - 126]
  
      Parameters
      ----------
      gammas : list, angles
      scaler1: obj (default=None), MinMaxScaler of Angles group 1
      scaler2: obj (default=None), MinMaxScaler of Angles group 2
  
      Returns
      -------
      scaled angles, scaler1, scaler2
      """
      first, second = [], []
      first_ind, second_ind = [], []
      q1 = np.pi / 2.0
      for i, g in enumerate(gammas):
          if g <= q1:
              first.append(g)
              first_ind.append(i)
          else:
              second.append(g)
              second_ind.append(i)
      if scaler1 is None:  # this indicates the `fit()`
          min_f, max_f = 0.001, 0.955
          scaler1 = MinMaxScaler(feature_range=(min_f, max_f))
          # min_f and max_f are required to be fit by scaler for consistency between train and test sets
          scaler1.fit(np.array(first + [min_f, max_f]).reshape(-1, 1))
          first = (
              scaler1.transform(np.array(first).reshape(-1, 1)).reshape(
                  -1
              )
              if first
              else []
          )
      else:
          first = (
              scaler1.transform(np.array(first).reshape(-1, 1)).reshape(
                  -1
              )
              if first
              else []
          )
      if scaler2 is None:  # this indicates the `fit()`
          min_s, max_s = q1 + 0.001, 2.186
          scaler2 = MinMaxScaler(feature_range=(min_s, max_s))
          # min_s and max_s are required to be fit by scaler for consistency between train and test sets
          scaler2.fit(np.array(second + [min_s, max_s]).reshape(-1, 1))
          second = (
              scaler2.transform(
                  np.array(second).reshape(-1, 1)
              ).reshape(-1)
              if second
              else []
          )
      else:
          second = (
              scaler2.transform(
                  np.array(second).reshape(-1, 1)
              ).reshape(-1)
              if second
              else []
          )
      # restore original order
      return (
          np.concatenate([first, second])[
              np.argsort(first_ind + second_ind)
          ],
          scaler1,
          scaler2,
      )
  
imports: from __future__ import division
  from __future__ import print_function
  import multiprocessing
  from itertools import combinations
  from multiprocessing import Pool
  import numba
  import numpy
  from sklearn.preprocessing import MinMaxScaler, RobustScaler
  from sklearn.utils import check_array
  from .base import BaseDetector
label_desc: Use image node_id 4 for calling a global function with example usage: scale_angles(gammas, scaler1, scaler2) and returns: np,  scaler1,  scaler2