Skip to main content
`Ctrl`+`K`

# SALib.util package

## Submodules

- SALib.util.problem module
  - `ProblemSpec`
    - `ProblemSpec.samples`
    - `ProblemSpec.results`
    - `ProblemSpec.analysis`
    - `ProblemSpec.analysis`
    - `ProblemSpec.analyze()`
    - `ProblemSpec.analyze_parallel()`
    - `ProblemSpec.evaluate()`
    - `ProblemSpec.evaluate_distributed()`
    - `ProblemSpec.evaluate_parallel()`
    - `ProblemSpec.heatmap()`
    - `ProblemSpec.plot()`
    - `ProblemSpec.results`
    - `ProblemSpec.sample()`
    - `ProblemSpec.samples`
    - `ProblemSpec.set_results()`
    - `ProblemSpec.set_samples()`
    - `ProblemSpec.to_df()`
- SALib.util.results module
  - `ResultDict`
    - `ResultDict.plot()`
    - `ResultDict.to_df()`
- SALib.util.util_funcs module
  - `avail_approaches()`
  - `handle_seed()`
  - `read_param_file()`

## Module contents

A set of utility functions

SALib.util.avail_approaches(pkg)

  Create list of available modules.

  Parameters:

    pkg (module) – module to inspect

  Returns:

    method – A list of available submodules

  Return type:

    list

SALib.util.handle_seed(seed: Generator | BitGenerator | SeedSequence | int | Sequence[int] | None) → Generator

  Set (or create) a random number generator.

SALib.util.read_param_file(filename, delimiter=None)

  Unpacks a parameter file into a dictionary

  Reads a parameter file of format:

      Param1,0,1,Group1,dist1
      Param2,0,1,Group2,dist2
      Param3,0,1,Group3,dist3

  (Group and Dist columns are optional)

  Returns a dictionary containing:

    - names - the names of the parameters

    - bounds - a list of lists of lower and upper bounds

    - num_vars - a scalar indicating the number of variables

        (the length of names)

    - groups - a list of group names (strings) for each variable

    - dists - a list of distributions for the problem,

        None if not specified or all uniform

  Parameters:

    - filename (str) – The path to the parameter file

    - delimiter (str, default=None) – The delimiter used in the file to distinguish between columns

SALib.util.scale_samples(params: ndarray, problem: Dict)

  Scale samples based on specified distribution (defaulting to uniform).

  Adds an entry to the problem specification to indicate samples have been scaled to maintain backwards compatibility (sample_scaled).

  Parameters:

    - params (np.ndarray,) – numpy array of dimensions num_params-by-\(N\), where \(N\) is the number of samples

    - problem (dictionary,) – SALib problem specification

  Return type:

    np.ndarray, scaled samples