code: def _nonuniform_scale_samples(params, bounds, dists):
      """Rescale samples in 0-to-1 range to other distributions
  
      Parameters
      ----------
      params : numpy.ndarray
          numpy array of dimensions num_params-by-N,
          where N is the number of samples
      dists : list
          list of distributions, one for each parameter
              unif: uniform with lower and upper bounds
              logunif: logarithmic uniform with lower and upper bounds
              triang: triangular with lower and upper bounds, as well as
                      location of peak
                      The location of peak is in percentage of width
                      e.g. :code:`[1.0, 3.0, 0.5]` indicates 1.0 to 3.0 with a
                      peak at 2.0
  
                      A soon-to-be deprecated two-value format assumes the lower
                      bound to be 0
                      e.g. :code:`[3, 0.5]` assumes 0 to 3, with a peak at 1.5
              norm: normal distribution with mean and standard deviation
              truncnorm: truncated normal distribution with upper and lower
                      bounds, mean and standard deviation
              lognorm: lognormal with ln-space mean and standard deviation
      """
      b = np.array(bounds, dtype=object)
  
      # initializing matrix for converted values
      conv_params = np.empty_like(params)
  
      # loop over the parameters
      for i in range(conv_params.shape[1]):
          # setting first and second arguments for distributions
          b1 = b[i][0]  # ending
          b2 = b[i][1]  # 0-1
  
          if dists[i] == "triang":
              if len(b[i]) == 3:
                  loc_start = b[i][0]  # loc start
                  b1 = b[i][1]  # triangular distribution end
                  b2 = b[i][2]  # 0-1 aka c (the peak)
              elif len(b[i]) == 2:
                  msg = (
                      "Two-value format for triangular distributions detected.\n"
                      "To remove this message, specify the distribution start, "
                      "end, and peak (three values) "
                      "instead of the current two-value format "
                      "(distribution end and peak, with start assumed to be 0)\n"
                      "The two-value format will be deprecated in SALib v1.5"
                  )
                  warnings.warn(msg, DeprecationWarning, stacklevel=2)
  
                  loc_start = 0
                  b1 = b[i][0]
                  b2 = b[i][1]
              else:
                  raise ValueError(
                      "Unknown triangular distribution specification. Check"
                      " problem specification."
                  )
  
              # checking for correct parameters
              if b1 < 0 or b2 < 0 or b2 >= 1 or loc_start > b1:
                  raise ValueError(
                      """Triangular distribution bound error: Scale must be
                      greater than zero; peak on interval [0,1], triangular
                      start value must be smaller than end value"""
                  )
              else:
                  conv_params[:, i] = sp.stats.triang.ppf(
                      params[:, i],
                      c=b2,
                      scale=b1 - loc_start,
                      loc=loc_start,
                  )
  
          elif dists[i] == "unif":
              if b1 >= b2:
                  raise ValueError(
                      """Uniform distribution: lower bound
                      must be less than upper bound"""
                  )
              else:
                  conv_params[:, i] = params[:, i] * (b2 - b1) + b1
  
          elif dists[i] == "logunif":
              conv_params[:, i] = sp.stats.loguniform.ppf(
                  params[:, i], a=b1, b=b2
              )
  
          elif dists[i] == "norm":
              if b2 <= 0:
                  raise ValueError(
                      """Normal distribution: stdev must be > 0"""
                  )
              else:
                  conv_params[:, i] = sp.stats.norm.ppf(
                      params[:, i], loc=b1, scale=b2
                  )
  
          # Truncated normal distribution
          # parameters are lower bound and upper bound, mean and stdev
          elif dists[i] == "truncnorm":
              b3 = b[i][2]
              b4 = b[i][3]
              if b4 <= 0:
                  raise ValueError(
                      """Truncated normal distribution: stdev must
                      be > 0"""
                  )
              if b1 >= b2:
                  raise ValueError(
                      """Truncated normal distribution: lower bound
                      must be less than upper bound"""
                  )
              else:
                  conv_params[:, i] = sp.stats.truncnorm.ppf(
                      params[:, i],
                      (b1 - b3) / b4,
                      (b2 - b3) / b4,
                      loc=b3,
                      scale=b4,
                  )
  
          # lognormal distribution (ln-space, not base-10)
          # parameters are ln-space mean and standard deviation
          elif dists[i] == "lognorm":
              # checking for valid parameters
              if b2 <= 0:
                  raise ValueError(
                      """Lognormal distribution: stdev must be > 0"""
                  )
              else:
                  conv_params[:, i] = np.exp(
                      sp.stats.norm.ppf(params[:, i], loc=b1, scale=b2)
                  )
  
          else:
              valid_dists = [
                  "unif",
                  "triang",
                  "norm",
                  "truncnorm",
                  "lognorm",
              ]
              raise ValueError(
                  "Distributions: choose one of %s"
                  % ", ".join(valid_dists)
              )
  
      return conv_params
  
file_path: SALib/src/SALib/util/__init__.py
imports: from collections import OrderedDict
  from typing import Dict, Tuple
  import warnings
  import numpy
  import scipy
  from typing import List
  from .util_funcs import avail_approaches, read_param_file, _check_bounds, _check_groups
  from .problem import ProblemSpec
  from .results import ResultDict
label_desc: Use image node_id 4 for calling a global function with example usage: _nonuniform_scale_samples(params, bounds, dists) and returns: conv_params