{"id":28061833,"url":"https://github.com/rupt/bailed-statistics","last_synced_at":"2025-05-12T10:29:57.535Z","repository":{"id":54576297,"uuid":"522507425","full_name":"Rupt/bailed-statistics","owner":"Rupt","description":"  Generate \"upper limit\" and \"discovery\" statistics without memory leaks --- let your system bail the leaks overboard --- for use with HistFitter. Clone from CERN GitLab for posterity..","archived":false,"fork":false,"pushed_at":"2022-08-08T10:48:32.000Z","size":90,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-04T15:02:54.781Z","etag":null,"topics":["memes","statistics"],"latest_commit_sha":null,"homepage":"https://gitlab.cern.ch/rtombs/bailed_statistics","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rupt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-08T10:43:59.000Z","updated_at":"2022-08-08T10:51:39.000Z","dependencies_parsed_at":"2022-08-13T20:20:12.392Z","dependency_job_id":null,"html_url":"https://github.com/Rupt/bailed-statistics","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rupt%2Fbailed-statistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rupt%2Fbailed-statistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rupt%2Fbailed-statistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rupt%2Fbailed-statistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rupt","download_url":"https://codeload.github.com/Rupt/bailed-statistics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253719626,"owners_count":21952851,"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":["memes","statistics"],"created_at":"2025-05-12T10:29:56.755Z","updated_at":"2025-05-12T10:29:57.524Z","avatar_url":"https://github.com/Rupt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Upper limits with limited memory\n\nFreely allocate memory, and let the operating system clean up.\n\nThis is an efficient design pattern for short-lived programs;\nto track and free memory oneself is duplication of effort.\n\nRooStats and its HistFitter extensions operate under this design,\nso we must ensure short lives to our programs using them.\n\nWe execute leaky code to simulate small batches of toys in a\npool of processes which frees resources after each batch.\n\nCare is taken to use unique random seeds so results combine accurately.\n\n\n## Usage\n\nSet up your normal HistFitter environment;\nmine uses `lsetup \"views LCG_99python2 x86_64-centos7-gcc8-opt\"`.\n\nPoint `upper_limit_results.py` to your discovery workspace.\n\nMake upper limit results with `invert` and discovery p-values with `test`.\n\nMake plots and tables with with `output` with results combined by `-load`.\n\n\n## Examples\n\n### Toys\n\nSimulate toys.\n\n```bash\n./upper_limit_results.py invert test dump \\\n    -filename results/disc1/Discovery_DRInt_combined_NormalMeasurement_model.root \\\n    -prefix results/disc1/example1 \\\n    -poi mu_Discovery \\\n    -points 0 30 6 \\\n    -ntoys 3000 \\\n    -nbatch 100 \\\n    -processes 16 \\\n    -seed 1\n\n```\n\nPlot and tabulate.\n\n```bash\n./upper_limit_results.py output \\\n    -load results/disc1/merged_dump.pickle \\\n    -prefix results/disc1/example \\\n    -poi mu_Discovery \\\n    -lumi 139 \\\n    -channel DR-Example\n\n```\n\nOptional: combine multiple output files.\n\n```bash\n./upper_limit_results.py dump \\\n    -load results/disc1/example*_dump.pickle \\\n    -prefix results/disc1/merged\n\n```\n\n\n### Asymptotics\n\n```bash\n./upper_limit_results.py invert test output \\\n    -filename results/disc1/Discovery_DRInt_combined_NormalMeasurement_model.root \\\n    -prefix results/disc1/example_asym \\\n    -poi mu_Discovery \\\n    -lumi 139 \\\n    -channel DRInt \\\n    -points 0 30 6 \\\n    -calculator asymptotic\n\n```\n\n### Find more in ./examples/\n\n## Help\n```\nusage: upper_limit_results.py [-h] [-lumi LUMI] [-prefix PREFIX]\n                              [-load [LOAD [LOAD ...]]] [-filename FILENAME]\n                              [-workspace WORKSPACE] [-poi POI]\n                              [-points START STOP COUNT] [-ntoys NTOYS]\n                              [-seed SEED] [-nbatch NBATCH]\n                              [-processes PROCESSES] [-calculator CALCULATOR]\n                              [-statistic STATISTIC] [-channel CHANNEL]\n                              [-cl CL] [-use_cls USE_CLS]\n                              operations [operations ...]\n\nMake plots and tables for discovery fit statistics.\n\npositional arguments:\n  operations            instructions from {invert test dump output}; `invert'\n                        scans for upper limits; `test' evaluates a discovery\n                        p-value; `dump' saves results to *_dump.pickle;\n                        `output' saves the plots and table\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -lumi LUMI            luminosity in inverse femtobarns\n  -prefix PREFIX        output file paths' prefix (default: upper_limit)\n  -load [LOAD [LOAD ...]]\n                        filenames of pickled results from previous runs to\n                        combine; for `dump' or `output' (default: [])\n  -filename FILENAME    workspace file path\n  -workspace WORKSPACE  workspace name in its file (default: combined)\n  -poi POI              parameter of interest name (default: mu_SIG)\n  -points START STOP COUNT\n                        inclusive linear spacing of poi points; for `invert'\n                        (default: [0.0, 40.0, 20])\n  -ntoys NTOYS          number of toys to simulate (default: 3000)\n  -seed SEED            random seed in [0, 2**16); make yours unique; if None,\n                        we use a mix of time and process id (default: None)\n  -nbatch NBATCH        size of batches which execute leaky code; reduce to\n                        cut memory usage (default: 100)\n  -processes PROCESSES  maximum number of processes for generating toys; also\n                        capped by your cpu count (default: 1)\n  -calculator CALCULATOR\n                        calculator type in {frequentist, hybrid, asymptotic,\n                        asimov}; see bailed_roostats.CalculatorType;\n                        frequentist is standard with toys; asymptotic is\n                        standard without toys (default: frequentist)\n  -statistic STATISTIC  test statistic type from bailed_roostats.TestStatistic\n                        (default: profile_likelihood_one_sided)\n  -channel CHANNEL      channel name for the `output' tex table (default: DR-\n                        WHO)\n  -cl CL                level for 'upper limits', in (0, 1) (default: 0.95)\n  -use_cls USE_CLS      use CLs for limits; else use CLs+b (default: True)\n\n```\n\n\n## Absolution\n\nHypotheses compare through the relative likelihoods they assign to data.\n\nA p-value is a cumulative distribution function evaluated at data; CLs is a\nratio of p-values.\n\nPlease present results of this software accurately and clearly.\nExamples of false or unclear presentations of a p-value or CLs include:\n\n - as a probability that an hypothesis is true or false,\n - as a probability of compatibility with an hypothesis,\n - as a probability that data occurred at random, by chance, or by\n   statistical fluctuation,\n - as a likelihood or importance of data,\n - as necessary for an optimal or rational decision rule.\n\nPlease also respect that the association of a p-value or CLs with the words\n'test', 'limit', 'confidence', 'significance', 'exclusion', 'evidence',\n'observation' or 'discovery' is nominal, and may not reflect the words' meanings\nin English.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupt%2Fbailed-statistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frupt%2Fbailed-statistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupt%2Fbailed-statistics/lists"}