{"id":14977812,"url":"https://github.com/salib/salib","last_synced_at":"2025-05-13T21:09:16.335Z","repository":{"id":650965,"uuid":"10383500","full_name":"SALib/SALib","owner":"SALib","description":"Sensitivity Analysis Library in Python. Contains Sobol, Morris, FAST, and other methods.","archived":false,"fork":false,"pushed_at":"2025-04-18T20:50:45.000Z","size":6287,"stargazers_count":920,"open_issues_count":60,"forks_count":248,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-28T14:03:53.111Z","etag":null,"topics":["global-sensitivity-analysis","joss","morris","numpy","python","salib","sensitivity-analysis","sensitivity-analysis-library","sobol","uncertainty","uncertainty-quantification"],"latest_commit_sha":null,"homepage":"http://SALib.github.io/SALib/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SALib.png","metadata":{"files":{"readme":"README-advanced.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":".zenodo.json"}},"created_at":"2013-05-30T13:38:10.000Z","updated_at":"2025-04-25T07:22:53.000Z","dependencies_parsed_at":"2024-12-03T09:07:31.596Z","dependency_job_id":"54c77068-f107-4d88-a9fc-61e036f998f9","html_url":"https://github.com/SALib/SALib","commit_stats":{"total_commits":1531,"total_committers":51,"mean_commits":"30.019607843137255","dds":0.559111691704768,"last_synced_commit":"942a2d4c40c73e868abe464d6b21763820c0dc9c"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SALib%2FSALib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SALib%2FSALib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SALib%2FSALib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SALib%2FSALib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SALib","download_url":"https://codeload.github.com/SALib/SALib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251326836,"owners_count":21571634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["global-sensitivity-analysis","joss","morris","numpy","python","salib","sensitivity-analysis","sensitivity-analysis-library","sobol","uncertainty","uncertainty-quantification"],"created_at":"2024-09-24T13:56:22.705Z","updated_at":"2025-04-28T14:05:03.945Z","avatar_url":"https://github.com/SALib.png","language":"Python","readme":"## SALib: Advanced options\n\n### Parameter files\n\nIn the parameter file, lines beginning with `#` will be treated as comments and ignored.\n```\n# name lower_bound upper_bound\nP1 0.0 1.0\nP2 0.0 5.0\nP3 0.0 5.0\n...etc.\n```\nParameter files can also be comma-delimited if your parameter names or group names contain spaces. This should be detected automatically.\n\n### Command-line interface\n\n**Generate samples** (the `-p` flag is the parameter file)\n```\nsalib sample saltelli \\\n     -n 1024 \\\n     -p ./src/SALib/test_functions/params/Ishigami.txt \\\n     -o model_input.txt\n```\n\n**Run the model** this will usually be a user-defined model, maybe even in another language. Just save the outputs.\n\n**Run the analysis**\n```\nsalib analyze sobol \\\n     -p ./src/SALib/test_functions/params/Ishigami.txt \\\n     -Y model_output.txt \\\n     -c 0\n```\n\nThis will print indices and confidence intervals to the command line. You can redirect to a file using the `\u003e` operator.\n\n### Parallel indices calculation (Sobol method only)\n```python\nSi = sobol.analyze(problem, Y, calc_second_order=True, conf_level=0.95,\n                   print_to_console=False, parallel=True, n_processors=4)\n```\n\nOther methods include Morris, FAST, Delta-MIM, and DGSM. For an explanation of all command line options for each method, [see the examples here](https://github.com/SALib/SALib/tree/main/examples).\n\n\n### Groups of variables (Sobol and Morris methods only)\nIt is sometimes useful to perform sensitivity analysis on groups of input variables to reduce the number of model runs required, when variables belong to the same component of a model, or there is some reason to believe that they should behave similarly.\n\nGroups can be specified in two ways for the Sobol and Morris methods. First, as a fourth column in the parameter file:\n```\n# name lower_bound upper_bound group_name\nP1 0.0 1.0 Group_1\nP2 0.0 5.0 Group_2\nP3 0.0 5.0 Group_2\n...etc.\n```\n\nOr in the `problem` dictionary:\n```python\nproblem = {\n  'groups': ['Group_1', 'Group_2', 'Group_2'],\n  'names': ['x1', 'x2', 'x3'],\n  'num_vars': 3,\n  'bounds': [[-3.14, 3.14], [-3.14, 3.14], [-3.14, 3.14]]\n}\n```\n\n`groups` is a list of strings specifying the group name to which each variable belongs. The rest of the code stays the same:\n\n```python\nparam_values = saltelli.sample(problem, 1024)\nY = Ishigami.evaluate(param_values)\nSi = sobol.analyze(problem, Y, print_to_console=True)\n```\n\nBut the output is printed by group:\n```\nGroup S1 S1_conf ST ST_conf\nGroup_1 0.307834 0.066424 0.559577 0.082978\nGroup_2 0.444052 0.080255 0.667258 0.060871\n\nGroup_1 Group_2 S2 S2_conf\nGroup_1 Group_2 0.242964 0.124229\n```\n\nThe output can then be converted to a Pandas DataFrame for further analysis.\n\n```python\ntotal_Si, first_Si, second_Si = Si.to_df()\n```\n\n\n### Generating alternate distributions\n\nIn the [Quick Start](https://github.com/SALib/SALib/tree/main/README.rst) we\ngenerate a uniform sample of parameter space.\n\n```python\nfrom SALib.sample import saltelli\nfrom SALib.analyze import sobol\nfrom SALib.test_functions import Ishigami\nimport numpy as np\n\nproblem = {\n     'num_vars': 3,\n     'names': ['x1', 'x2', 'x3'],\n     'bounds': [[-3.14159265359, 3.14159265359],\n               [-3.14159265359, 3.14159265359],\n               [-3.14159265359, 3.14159265359]]\n}\n\nparam_values = saltelli.sample(problem, 1024)\n```\n\nSALib is also capable of generating alternate sampling distributions by\nspecifying a `dist` entry in the `problem` specification.\n\nAs implied in the basic example, a uniform distribution is the default.\n\nWhen an entry for `dist` is not 'unif', the `bounds` entry does not indicate\nparameter bounds but sample-specific metadata.\n\n`bounds` definitions for available distributions:\n\n* unif: uniform distribution\n    e.g. :code:`[-np.pi, np.pi]` defines the lower and upper bounds\n* triang: triangular with lower and upper bounds, as well as\n     location of peak\n     The location of peak is in percentage of width\n     e.g. :code:`[1.0, 3.0, 0.5]` indicates 1.0 to 3.0 with a peak at 2.0\n\n     A soon-to-be deprecated two-value format assumes the lower bound to be 0\n     e.g. :code:`[3, 0.5]` assumes 0 to 3, with a peak at 1.5\n* norm: normal distribution with mean and standard deviation\n* lognorm: lognormal with ln-space mean and standard deviation\n\nAn example specification is shown below:\n\n```python\nproblem = {\n     'names': ['x1', 'x2', 'x3'],\n     'num_vars': 3,\n     'bounds': [[-np.pi, np.pi], [1.0, 0.2], [3, 0.5]],\n     'groups': ['G1', 'G2', 'G1'],\n     'dists': ['unif', 'lognorm', 'triang']\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalib%2Fsalib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalib%2Fsalib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalib%2Fsalib/lists"}