code: def test_adaptive_parzen_normal_estimator_sigma_clip():
      """Test that the magic clip of sigmas for parzen estimator"""
      low = -1
      high = 5
  
      obs_mus = numpy.linspace(-1, 5, num=8, endpoint=False)
      mus, sigmas, weights = adaptive_parzen_estimator(
          obs_mus,
          low,
          high,
          prior_weight=1.0,
          equal_weight=False,
          flat_num=25,
      )
      assert len(mus) == len(sigmas) == len(weights) == 8 + 1
      assert numpy.all(weights == 1 / 9)
      assert numpy.all(sigmas == 6 / 8)
  
      obs_mus = numpy.random.uniform(-1, 5, 30)
      mus, sigmas, weights = adaptive_parzen_estimator(
          obs_mus,
          low,
          high,
          prior_weight=1.0,
          equal_weight=False,
          flat_num=25,
      )
  
      assert len(mus) == len(sigmas) == len(weights) == 30 + 1
      assert numpy.all(weights[-25:] == weights[-1])
      assert numpy.all(sigmas <= 6) and numpy.all(sigmas >= 6 / 10)
  
      obs_mus = numpy.random.uniform(-1, 5, 400)
      mus, sigmas, weights = adaptive_parzen_estimator(
          obs_mus,
          low,
          high,
          prior_weight=1.0,
          equal_weight=False,
          flat_num=25,
      )
  
      assert len(mus) == len(sigmas) == len(weights) == 400 + 1
      assert numpy.all(weights[-25:] == weights[-1])
      assert numpy.all(sigmas <= 6) and numpy.all(sigmas >= 6 / 20)
  
      obs_mus = numpy.random.uniform(-1, 5, 10000)
      mus, sigmas, weights = adaptive_parzen_estimator(
          obs_mus,
          low,
          high,
          prior_weight=1.0,
          equal_weight=False,
          flat_num=25,
      )
  
      assert len(mus) == len(sigmas) == len(weights) == 10000 + 1
      assert numpy.all(weights[-25:] == weights[-1])
      assert numpy.all(sigmas <= 6) and numpy.all(sigmas >= 6 / 100)
  
imports: from __future__ import annotations
  import copy
  import itertools
  import timeit
  from typing import ClassVar
  import numpy
  import numpy
  import pytest
  from scipy.stats import norm
  from orion.algo.space import Categorical, Fidelity, Integer, Real, Space
  from orion.algo.tpe import TPE, CategoricalSampler, GMMSampler, adaptive_parzen_estimator, compute_max_ei_point, ramp_up_weights
  from orion.core.utils import backward, format_trials
  from orion.core.worker.algo_wrappers.space_transform import SpaceTransform
  from orion.core.worker.primary_algo import create_algo
  from orion.core.worker.transformer import build_required_space
  from orion.core.worker.trial import Trial
  from orion.testing.algo import BaseAlgoTests, TestPhase, first_phase_only
label_desc: Use image node_id 7 for calling a global function with example usage: test_adaptive_parzen_normal_estimator_sigma_clip() without return types