code: def adaptive_parzen_normal(
      mus, prior_weight, prior_mu, prior_sigma, LF=DEFAULT_LF
  ):
      """
      mus - matrix (N, M) of M, N-dimensional component centers
      """
      mus = np.array(mus)
      assert str(mus.dtype) != "object"
  
      if mus.ndim != 1:
          raise TypeError("mus must be vector", mus)
      if len(mus) == 0:
          srtd_mus = np.asarray([prior_mu])
          sigma = np.asarray([prior_sigma])
          prior_pos = 0
      elif len(mus) == 1:
          if prior_mu < mus[0]:
              prior_pos = 0
              srtd_mus = np.asarray([prior_mu, mus[0]])
              sigma = np.asarray([prior_sigma, prior_sigma * 0.5])
          else:
              prior_pos = 1
              srtd_mus = np.asarray([mus[0], prior_mu])
              sigma = np.asarray([prior_sigma * 0.5, prior_sigma])
      elif len(mus) >= 2:
          # create new_mus, which is sorted, and in which
          # the prior has been inserted
          order = np.argsort(mus)
          prior_pos = np.searchsorted(mus[order], prior_mu)
          srtd_mus = np.zeros(len(mus) + 1)
          srtd_mus[:prior_pos] = mus[order[:prior_pos]]
          srtd_mus[prior_pos] = prior_mu
          srtd_mus[prior_pos + 1 :] = mus[order[prior_pos:]]
          sigma = np.zeros_like(srtd_mus)
          sigma[1:-1] = np.maximum(
              srtd_mus[1:-1] - srtd_mus[0:-2],
              srtd_mus[2:] - srtd_mus[1:-1],
          )
          lsigma = srtd_mus[1] - srtd_mus[0]
          usigma = srtd_mus[-1] - srtd_mus[-2]
          sigma[0] = lsigma
          sigma[-1] = usigma
  
      if LF and LF < len(mus):
          unsrtd_weights = linear_forgetting_weights(len(mus), LF)
          srtd_weights = np.zeros_like(srtd_mus)
          assert len(unsrtd_weights) + 1 == len(srtd_mus)
          srtd_weights[:prior_pos] = unsrtd_weights[order[:prior_pos]]
          srtd_weights[prior_pos] = prior_weight
          srtd_weights[prior_pos + 1 :] = unsrtd_weights[
              order[prior_pos:]
          ]
  
      else:
          srtd_weights = np.ones(len(srtd_mus))
          srtd_weights[prior_pos] = prior_weight
  
      # -- magic formula:
      maxsigma = old_div(prior_sigma, 1.0)
      minsigma = old_div(prior_sigma, min(100.0, (1.0 + len(srtd_mus))))
  
      sigma = np.clip(sigma, minsigma, maxsigma)
  
      sigma[prior_pos] = prior_sigma
      assert prior_sigma > 0
      assert maxsigma > 0
      assert minsigma > 0
      assert np.all(sigma > 0), (sigma.min(), minsigma, maxsigma)
  
      srtd_weights /= srtd_weights.sum()
      if 0:
          print("WEIGHTS", srtd_weights)
          print("MUS", srtd_mus)
          print("SIGMA", sigma)
  
      return srtd_weights, srtd_mus, sigma
  
imports: from __future__ import print_function
  from __future__ import absolute_import
  from __future__ import division
  from builtins import str
  from builtins import map
  from builtins import zip
  from builtins import range
  from past.utils import old_div
  import logging
  import time
  import numpy
  from scipy.special import erf
  from .None import pyll
  from .pyll import scope
  from .pyll.stochastic import implicit_stochastic
  from .base import miscs_to_idxs_vals
  from .base import miscs_update_idxs_vals
  from .None import rand
label_desc: Use image node_id 14 for calling a global function with example usage: adaptive_parzen_normal(mus, prior_weight, prior_mu, prior_sigma, LF) and returns: srtd_weights,  srtd_mus,  sigma