Commit 9b04f03d812344eb5243b0c17db56eeb170bb291
1 parent
d95a71b5
Adapt scripts to example folder
Showing
4 changed files
with
23 additions
and
16 deletions
examples/Makefile.am
| ... | ... | @@ -3,8 +3,10 @@ |
| 3 | 3 | # Scripts to be distributed |
| 4 | 4 | scripts = README \ |
| 5 | 5 | benchmark_cta_analysis.py \ |
| 6 | + check_models.py \ | |
| 6 | 7 | make_pull_at_sensitivity_limit.py \ |
| 7 | 8 | make_spectrum.py \ |
| 9 | + make_survey.py \ | |
| 8 | 10 | make_ts_distributions.py \ |
| 9 | 11 | pipeline_binned_disk.py \ |
| 10 | 12 | pipeline_binned_mem.py \ | ... | ... |
examples/README
| ... | ... | @@ -6,6 +6,9 @@ benchmark_cta_analysis.py |
| 6 | 6 | (unbinned, binned, stacked), and if matplotlib is installed, creates |
| 7 | 7 | a plot of the benchmark results. |
| 8 | 8 | |
| 9 | +check_models.py | |
| 10 | + Checks a variety of models using an unbinned analysis. | |
| 11 | + | |
| 9 | 12 | make_pull_at_sensitivity_limit.py |
| 10 | 13 | This script creates pull distributions as function of energy |
| 11 | 14 | for a test source that is at the 5 sigma sensitivity limit for |
| ... | ... | @@ -17,6 +20,9 @@ make_pull_at_sensitivity_limit.py |
| 17 | 20 | make_spectrum.py |
| 18 | 21 | This script shows how to make a spectrum using obsutils. |
| 19 | 22 | |
| 23 | +make_survey.py | |
| 24 | + This script simulates a CTA galactic plane survey. | |
| 25 | + | |
| 20 | 26 | make_ts_distributions.py |
| 21 | 27 | This script creates TS distributions as function of energy for |
| 22 | 28 | an off observation of 50h effective observing time. | ... | ... |
examples/check_models.py
| ... | ... | @@ -3,6 +3,11 @@ |
| 3 | 3 | # This script performs an unbinned maximum likelihood analysis for a |
| 4 | 4 | # variety of models. This allows checking the models. |
| 5 | 5 | # |
| 6 | +# Usage: | |
| 7 | +# ./check_models.py | |
| 8 | +# | |
| 9 | +# ========================================================================== | |
| 10 | +# | |
| 6 | 11 | # Copyright (C) 2011-2015 Juergen Knoedlseder |
| 7 | 12 | # |
| 8 | 13 | # This program is free software: you can redistribute it and/or modify |
| ... | ... | @@ -96,38 +101,28 @@ def pipeline(model_name): |
| 96 | 101 | if __name__ == '__main__': |
| 97 | 102 | """ |
| 98 | 103 | Perform unbinned analyses for various models. |
| 99 | - | |
| 100 | - This script implements the analysis steps to perform an unbinned analysis. | |
| 101 | - The steps include: | |
| 102 | - - Event simulation | |
| 103 | - - Event selection | |
| 104 | - - Binned maximum likelihood fitting | |
| 105 | 104 | """ |
| 106 | 105 | # Initialise flags |
| 107 | 106 | need_help = False |
| 108 | - show_data = True | |
| 109 | 107 | |
| 110 | 108 | # Test for command line arguments |
| 111 | 109 | print(sys.argv[0]) |
| 112 | 110 | if (len(sys.argv) > 1): |
| 113 | 111 | if sys.argv[1] == "-h": |
| 114 | 112 | need_help = True |
| 115 | - elif sys.argv[1] == "-noshow": | |
| 116 | - show_data = False | |
| 117 | 113 | else: |
| 118 | 114 | need_help = True |
| 119 | 115 | |
| 120 | 116 | # Print help if needed and exit |
| 121 | 117 | if need_help: |
| 122 | - print("Usage: example_models.py [OPTIONS]") | |
| 118 | + print("Usage: check_models.py [OPTIONS]") | |
| 123 | 119 | print(" -h Display this usage message") |
| 124 | - print(" -noshow Do not show data using matplotlib") | |
| 125 | 120 | sys.exit() |
| 126 | 121 | |
| 127 | 122 | # Dump header |
| 128 | - print("********************************") | |
| 129 | - print("* CTA unbinned analysis script *") | |
| 130 | - print("********************************") | |
| 123 | + print("*******************************************") | |
| 124 | + print("* Check models using an unbinned analysis *") | |
| 125 | + print("*******************************************") | |
| 131 | 126 | |
| 132 | 127 | # Perform analysis for Crab model |
| 133 | 128 | pipeline("data/crab.xml") | ... | ... |
examples/make_survey.py
| 1 | 1 | #! /usr/bin/env python |
| 2 | 2 | # ========================================================================== |
| 3 | -# This script simulates CTA surveys. It can be considered as the master | |
| 4 | -# script for CTA science simulations. Please modify as needed. | |
| 3 | +# This script simulates a galactic plane survey of CTA. | |
| 4 | +# | |
| 5 | +# Usage: | |
| 6 | +# ./make_survey.py | |
| 7 | +# | |
| 8 | +# ========================================================================== | |
| 5 | 9 | # |
| 6 | 10 | # Copyright (C) 2011-2015 Juergen Knoedlseder |
| 7 | 11 | # | ... | ... |