Commit b6c8980013661a010ab324e50370df8680f3a6c4
1 parent
16f51af6
Rename cstssplit to cstsmapsplit
Showing
8 changed files
with
146 additions
and
145 deletions
cscripts/Makefile.am
| ... | ... | @@ -16,13 +16,13 @@ pythonscripts = __init__.py \ |
| 16 | 16 | cssens.py \ |
| 17 | 17 | csspec.py \ |
| 18 | 18 | cstsdist.py \ |
| 19 | + cstsmapsplit.py \ | |
| 19 | 20 | cstsmapmerge.py \ |
| 20 | 21 | csworkflow.py \ |
| 21 | 22 | csfindobs.py \ |
| 22 | 23 | csiactcopy.py \ |
| 23 | 24 | csiactdata.py \ |
| 24 | 25 | csiactobs.py \ |
| 25 | - cstssplit.py \ | |
| 26 | 26 | obsutils.py |
| 27 | 27 | |
| 28 | 28 | # Parfiles to be distributed in $(prefix)/syspfiles |
| ... | ... | @@ -39,12 +39,12 @@ parfiles = cscaldb.par \ |
| 39 | 39 | cssens.par \ |
| 40 | 40 | csspec.par \ |
| 41 | 41 | cstsdist.par \ |
| 42 | + cstsmapsplit.par \ | |
| 42 | 43 | cstsmapmerge.par \ |
| 43 | 44 | csworkflow.par \ |
| 44 | 45 | csfindobs.par \ |
| 45 | 46 | csiactcopy.par \ |
| 46 | 47 | csiactdata.par \ |
| 47 | - cstssplit.par \ | |
| 48 | 48 | csiactobs.par |
| 49 | 49 | |
| 50 | 50 | # Scripts for which symbolic links will be created in bindir |
| ... | ... | @@ -62,12 +62,12 @@ linkscripts = cscaldb \ |
| 62 | 62 | cssens \ |
| 63 | 63 | csspec \ |
| 64 | 64 | cstsdist \ |
| 65 | + cstsmapsplit \ | |
| 65 | 66 | cstsmapmerge \ |
| 66 | 67 | csworkflow \ |
| 67 | 68 | csfindobs \ |
| 68 | 69 | csiactcopy \ |
| 69 | 70 | csiactdata \ |
| 70 | - cstssplit \ | |
| 71 | 71 | csiactobs |
| 72 | 72 | |
| 73 | 73 | # Test scripts to be distributed in $(pyexecdir)/cscripts/tests |
| ... | ... | @@ -86,12 +86,12 @@ testscripts = tests/__init__.py \ |
| 86 | 86 | ../test/test_cssens.py \ |
| 87 | 87 | ../test/test_csspec.py \ |
| 88 | 88 | ../test/test_cstsdist.py \ |
| 89 | + ../test/test_cstsmapsplit.py \ | |
| 89 | 90 | ../test/test_cstsmapmerge.py \ |
| 90 | 91 | ../test/test_csworkflow.py \ |
| 91 | 92 | ../test/test_csfindobs.py \ |
| 92 | 93 | ../test/test_csiactcopy.py \ |
| 93 | 94 | ../test/test_csiactdata.py \ |
| 94 | - ../test/test_cstssplit.py \ | |
| 95 | 95 | ../test/test_csiactobs.py |
| 96 | 96 | |
| 97 | 97 | # Test data to be distributed in $(pyexecdir)/cscripts/tests/data | ... | ... |
cscripts/__init__.py.in
| ... | ... | @@ -38,9 +38,9 @@ __all__ = [ |
| 38 | 38 | "cssens", |
| 39 | 39 | "csspec", |
| 40 | 40 | "cstsdist", |
| 41 | + "cstsmapsplit", | |
| 41 | 42 | "cstsmapmerge", |
| 42 | 43 | "csworkflow", |
| 43 | - "cstssplit", | |
| 44 | 44 | "obsutils" |
| 45 | 45 | ] |
| 46 | 46 | if cur_version > req_version: |
| ... | ... | @@ -64,9 +64,9 @@ from cscripts.csroot2caldb import csroot2caldb |
| 64 | 64 | from cscripts.cssens import cssens |
| 65 | 65 | from cscripts.csspec import csspec |
| 66 | 66 | from cscripts.cstsdist import cstsdist |
| 67 | +from cscripts.cstsmapsplit import cstsmapsplit | |
| 67 | 68 | from cscripts.cstsmapmerge import cstsmapmerge |
| 68 | 69 | from cscripts.csworkflow import csworkflow |
| 69 | -from cscripts.cstssplit import cstssplit | |
| 70 | 70 | from cscripts import obsutils |
| 71 | 71 | if cur_version > req_version: |
| 72 | 72 | from cscripts.csfindobs import csfindobs | ... | ... |
cscripts/cstssplit.par renamed to cscripts/cstsmapsplit.par
| ... | ... | @@ -4,33 +4,33 @@ |
| 4 | 4 | # # |
| 5 | 5 | # ------------------------------------------------------------------------- # |
| 6 | 6 | # # |
| 7 | -# File: cstssplit.par # | |
| 7 | +# File: cstsmapsplit.par # | |
| 8 | 8 | # Version: 1.1.0 # |
| 9 | 9 | # # |
| 10 | 10 | # Author: Michael Mayer # |
| 11 | 11 | # michael.mayer@physik.hu-berlin.de # |
| 12 | 12 | # HU Berlin # |
| 13 | 13 | # # |
| 14 | -# Purpose: Parameter file for the cttsmap application # | |
| 14 | +# Purpose: Parameter file for the cstsmapsplit application # | |
| 15 | 15 | # # |
| 16 | 16 | ############################################################################# |
| 17 | 17 | # |
| 18 | 18 | # General parameters |
| 19 | 19 | #=================== |
| 20 | -inobs, f, a, "events.fits",,, "Input event list, counts cube or observation definition XML file" | |
| 21 | -inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file" | |
| 22 | -srcname, s, a, "Crab",,, "Test source name" | |
| 23 | -expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)" | |
| 24 | -psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)" | |
| 25 | -edispcube, f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)" | |
| 26 | -bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)" | |
| 27 | -caldb, s, a, "prod2",,, "Calibration database" | |
| 28 | -irf, s, a, "South_0.5h",,, "Instrument response function" | |
| 20 | +inobs, f, a, events.fits,,, "Input event list, counts cube or observation definition XML file" | |
| 21 | +inmodel, f, a, $CTOOLS/share/models/crab.xml,,, "Input model XML file" | |
| 22 | +srcname, s, a, Crab,,, "Test source name" | |
| 23 | +expcube, f, a, NONE,,, "Input exposure cube file (only needed for stacked analysis)" | |
| 24 | +psfcube, f, a, NONE,,, "Input PSF cube file (only needed for stacked analysis)" | |
| 25 | +edispcube, f, a, NONE,,, "Input energy dispersion cube file (only needed for stacked analysis)" | |
| 26 | +bkgcube, f, a, NONE,,, "Input background cube file (only needed for stacked analysis)" | |
| 27 | +caldb, s, a, prod2,,, "Calibration database" | |
| 28 | +irf, s, a, South_0.5h,,, "Instrument response function" | |
| 29 | 29 | edisp, b, h, no,,, "Apply energy dispersion?" |
| 30 | -outmap, f, a, "tsmap.fits",,, "Output Test Statistic map file" | |
| 30 | +outmap, f, a, tsmap.fits,,, "Output Test Statistic map file" | |
| 31 | 31 | bins_per_job, i, a, 5,,, "Number of TS map bins per running job" |
| 32 | 32 | compute_null, b, a, yes,,,"Compute null hypothesis first?" |
| 33 | -outfile, f, a, "commands.txt",,, "ASCII file containing all commands" | |
| 33 | +outfile, f, a, commands.txt,,, "ASCII file containing all commands" | |
| 34 | 34 | |
| 35 | 35 | # |
| 36 | 36 | # Spatial binning parameters |
| ... | ... | @@ -39,10 +39,10 @@ usepnt, b, h, no,,, "Use pointing instead of xref/yref parameters?" |
| 39 | 39 | nxpix, i, a, 200,,, "Size of the X axis in pixels" |
| 40 | 40 | nypix, i, a, 200,,, "Size of the Y axis in pixels" |
| 41 | 41 | binsz, r, a, 0.02,,, "Image scale (in degrees/pixel)" |
| 42 | -coordsys, s, a, "CEL", CEL|GAL,,"Coordinate system (CEL - celestial, GAL - galactic)" | |
| 42 | +coordsys, s, a, CEL, CEL|GAL,,"Coordinate system (CEL - celestial, GAL - galactic)" | |
| 43 | 43 | xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)" |
| 44 | 44 | yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DEC or galactic b)" |
| 45 | -proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" | |
| 45 | +proj, s, a, CAR, AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" | |
| 46 | 46 | |
| 47 | 47 | # |
| 48 | 48 | # Standard parameters |
| ... | ... | @@ -52,4 +52,4 @@ chatter, i, h, 2,0,4, "Chattiness of output" |
| 52 | 52 | clobber, b, h, yes,,, "Overwrite existing output files with new output files?" |
| 53 | 53 | debug, b, h, no,,, "Debugging mode activated" |
| 54 | 54 | mode, s, h, "ql",,, "Mode of automatic parameters" |
| 55 | -logfile, f, h, "cstssplit.log",,, "Log filename" | |
| 55 | +logfile, f, h, cstsmapsplit.log,,, "Log filename" | ... | ... |
cscripts/cstssplit.py renamed to cscripts/cstsmapsplit.py
| ... | ... | @@ -25,10 +25,10 @@ import gammalib |
| 25 | 25 | import ctools |
| 26 | 26 | |
| 27 | 27 | |
| 28 | -# ============== # | |
| 29 | -# cstssplit class # | |
| 30 | -# ============== # | |
| 31 | -class cstssplit(ctools.cscript): | |
| 28 | +# ================== # | |
| 29 | +# cstsmapsplit class # | |
| 30 | +# ================== # | |
| 31 | +class cstsmapsplit(ctools.cscript): | |
| 32 | 32 | """ |
| 33 | 33 | Generates commands to split TS map computation |
| 34 | 34 | |
| ... | ... | @@ -42,18 +42,20 @@ class cstssplit(ctools.cscript): |
| 42 | 42 | # Consructor |
| 43 | 43 | def __init__(self, *argv): |
| 44 | 44 | """ |
| 45 | - Constructor. | |
| 45 | + Constructor | |
| 46 | 46 | """ |
| 47 | 47 | |
| 48 | - # Set name | |
| 49 | - self._name = 'cstssplit' | |
| 48 | + # Set name and version | |
| 49 | + self._name = 'cstsmapsplit' | |
| 50 | 50 | self._version = '1.1.0' |
| 51 | - self._outmap = gammalib.GFilename() | |
| 51 | + | |
| 52 | + # Set data members | |
| 53 | + self._outmap = gammalib.GFilename() | |
| 52 | 54 | self._bins_per_job = 0 |
| 53 | 55 | self._compute_null = False |
| 54 | - self._outfile = gammalib.GFilename() | |
| 55 | - self._map = gammalib.GSkyMap() | |
| 56 | - self._cmd = [] | |
| 56 | + self._outfile = gammalib.GFilename() | |
| 57 | + self._map = gammalib.GSkyMap() | |
| 58 | + self._cmd = [] | |
| 57 | 59 | |
| 58 | 60 | # Initialise observation container from constructor arguments. |
| 59 | 61 | self._obs, argv = self._set_input_obs(argv) |
| ... | ... | @@ -69,7 +71,7 @@ class cstssplit(ctools.cscript): |
| 69 | 71 | # Private methods |
| 70 | 72 | def _get_parameters(self): |
| 71 | 73 | """ |
| 72 | - Get parameters from parfile and setup the observation. | |
| 74 | + Get parameters from parfile and setup the observation | |
| 73 | 75 | """ |
| 74 | 76 | |
| 75 | 77 | # If there are no observations in container then get some ... |
| ... | ... | @@ -103,7 +105,9 @@ class cstssplit(ctools.cscript): |
| 103 | 105 | """ |
| 104 | 106 | Compute null hypothesis |
| 105 | 107 | |
| 106 | - Returns: | |
| 108 | + Returns | |
| 109 | + ------- | |
| 110 | + logl : float | |
| 107 | 111 | Log-likelihood of null hypothesis |
| 108 | 112 | """ |
| 109 | 113 | |
| ... | ... | @@ -134,7 +138,7 @@ class cstssplit(ctools.cscript): |
| 134 | 138 | |
| 135 | 139 | def run(self): |
| 136 | 140 | """ |
| 137 | - Run the script. | |
| 141 | + Run the script | |
| 138 | 142 | """ |
| 139 | 143 | |
| 140 | 144 | # Switch screen logging on in debug mode |
| ... | ... | @@ -238,9 +242,10 @@ class cstssplit(ctools.cscript): |
| 238 | 242 | if binmax > nbins: |
| 239 | 243 | binmax = nbins |
| 240 | 244 | |
| 241 | - # Complete command by binning parameters | |
| 242 | - sliced_command = base_command + ' binmin='+str(binmin)+' binmax='+str(binmax) | |
| 243 | - sliced_command += ' outmap='+outmap + ' logfile='+outmap.replace('.fits','.log') | |
| 245 | + # Setup sliced command | |
| 246 | + sliced_command = '%s binmin=%s binmax=%s outmap=%s logfile=%s' % \ | |
| 247 | + (base_command, str(binmin), str(binmax), | |
| 248 | + outmap, outmap.replace('.fits','.log')) | |
| 244 | 249 | |
| 245 | 250 | # Append command to list of commands |
| 246 | 251 | self._cmd.append(sliced_command) |
| ... | ... | @@ -260,7 +265,7 @@ class cstssplit(ctools.cscript): |
| 260 | 265 | |
| 261 | 266 | def execute(self): |
| 262 | 267 | """ |
| 263 | - Execute the script. | |
| 268 | + Execute the script | |
| 264 | 269 | """ |
| 265 | 270 | |
| 266 | 271 | # Run the script |
| ... | ... | @@ -290,18 +295,15 @@ class cstssplit(ctools.cscript): |
| 290 | 295 | |
| 291 | 296 | # Return |
| 292 | 297 | return |
| 298 | + | |
| 299 | + | |
| 293 | 300 | # ======================== # |
| 294 | 301 | # Main routine entry point # |
| 295 | 302 | # ======================== # |
| 296 | 303 | if __name__ == '__main__': |
| 297 | - """ | |
| 298 | - Generates splitted TS map commands | |
| 299 | - """ | |
| 300 | 304 | |
| 301 | 305 | # Create instance of application |
| 302 | - app = cstssplit(sys.argv) | |
| 306 | + app = cstsmapsplit(sys.argv) | |
| 303 | 307 | |
| 304 | 308 | # Execute application |
| 305 | 309 | app.execute() |
| 306 | - | |
| 307 | -# | ... | ... |
doc/source/users/reference_manual/cstssplit.rst renamed to doc/source/users/reference_manual/cstsmapsplit.rst
| 1 | -.. _cstssplit: | |
| 1 | +.. _cstsmapsplit: | |
| 2 | 2 | |
| 3 | -cstssplit | |
| 4 | -======= | |
| 3 | +cstsmapsplit | |
| 4 | +============ | |
| 5 | 5 | |
| 6 | -Generate commands to split TS map computation | |
| 6 | +Generate commands to split the Test Statistic map computation | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | Synopsis |
| 10 | 10 | -------- |
| 11 | 11 | |
| 12 | -This tool allows to generate a command sequence in order to compute a | |
| 13 | -Test Statistic (TS) map using e.g. several machines. The command sequence | |
| 14 | -is stored in an ASCII file. Each line contains an individual command. | |
| 15 | -Each command will call the tool :ref:`cttsmap` with the appropriate parameters. | |
| 16 | -To split the computation, each TS map that is computed has a suffix to the filename | |
| 17 | -according to the number of the command. The resulting individual TS maps can then be | |
| 18 | -merged via :ref:`cstsmapmerge`. | |
| 12 | +This script generates a sequence of commands to split the Test Statistic (TS) | |
| 13 | +map computation into a distinct number of :ref:`cttsmap` computations. The | |
| 14 | +sequence of commands is written into an ASCII file, where each line in the | |
| 15 | +file corresponds to the command for an individual :ref:`cttsmap` run. Each TS | |
| 16 | +map computed in that way will be suffixed with the command number, and the | |
| 17 | +map can be combined into a single TS map using the :ref:`cstsmapmerge` script. | |
| 19 | 18 | |
| 20 | 19 | |
| 21 | 20 | General parameters |
| ... | ... | @@ -50,7 +49,18 @@ General parameters |
| 50 | 49 | |
| 51 | 50 | ``outmap [file]`` |
| 52 | 51 | Output Test Statistic map file. |
| 53 | - | |
| 52 | + | |
| 53 | +``bins_per_job [integer]`` | |
| 54 | + Number of bins of the TS map that should be computed within one command | |
| 55 | + | |
| 56 | +``compute_null [boolean]`` | |
| 57 | + Pre-computes the null hypothesis globally and passes the value to the | |
| 58 | + individual commands. If the parameter is set to ``no``, the null | |
| 59 | + hypothesis will be computed in each run of :ref:`cttsmap` individually. | |
| 60 | + | |
| 61 | +``outfile [file]`` | |
| 62 | + Output ASCII file name where the commands are written to. | |
| 63 | + | |
| 54 | 64 | ``(usepnt = no) [boolean]`` |
| 55 | 65 | Use CTA pointing direction for map centre instead of xref/yref parameters? |
| 56 | 66 | |
| ... | ... | @@ -75,16 +85,7 @@ General parameters |
| 75 | 85 | ``proj <AIT|AZP|CAR|MER|MOL|STG|TAN> [string]`` |
| 76 | 86 | Projection method. |
| 77 | 87 | |
| 78 | -``bins_per_job [integer]`` | |
| 79 | - Number of bins of the TS map that should be computed within one command | |
| 80 | 88 | |
| 81 | -``compute_null [boolean]`` | |
| 82 | - Pre-computes the null hypothesis globally and passes the value to the individual commands | |
| 83 | - If 'false', the null hypothesis will be computed in each run of :ref:`cttsmap` individually. | |
| 84 | - | |
| 85 | -``outfile [file]`` | |
| 86 | - Output ASCII file name where the commands are written to. | |
| 87 | - | |
| 88 | 89 | |
| 89 | 90 | Standard parameters |
| 90 | 91 | ------------------- |
| ... | ... | @@ -108,12 +109,13 @@ Standard parameters |
| 108 | 109 | Specifies whether an existing output TS map file should be overwritten. |
| 109 | 110 | |
| 110 | 111 | ``(debug = no) [boolean]`` |
| 111 | - Enables debug mode. In debug mode the executable will dump any log file output to the console. | |
| 112 | + Enables debug mode. In debug mode the executable will dump any log file | |
| 113 | + output to the console. | |
| 112 | 114 | |
| 113 | 115 | ``(mode = ql) [string]`` |
| 114 | 116 | Mode of automatic parameters (default is "ql", i.e. "query and learn"). |
| 115 | 117 | |
| 116 | -``(logfile = cttsmap.log) [string]`` | |
| 118 | +``(logfile = cstsmapsplit.log) [string]`` | |
| 117 | 119 | Name of log file. |
| 118 | 120 | |
| 119 | 121 | |
| ... | ... | @@ -123,4 +125,3 @@ Related tools or scripts |
| 123 | 125 | :ref:`cttsmap` |
| 124 | 126 | :ref:`cstsmapmerge` |
| 125 | 127 | |
| 126 | - | ... | ... |
doc/source/users/reference_manual/index.rst
| ... | ... | @@ -49,9 +49,9 @@ cscripts |
| 49 | 49 | csresmap --- Generates residual map <csresmap> |
| 50 | 50 | cssens --- Computes CTA sensitivity <cssens> |
| 51 | 51 | csspec --- Computes spectral points <csspec> |
| 52 | - cstsdist --- Generates TS distribution <cstsdist> | |
| 53 | - cstssplit --- Creates commands to slice the ts map computations <cstssplit> | |
| 54 | - cstsmapmerge --- Merges slices from ts map computations <cstsmapmerge> | |
| 52 | + cstsdist --- Generates Test Statistic distribution <cstsdist> | |
| 53 | + cstsmapsplit --- Creates commands to split the Test Statistic map computations <cstsmapsplit> | |
| 54 | + cstsmapmerge --- Merges slices from Test Statistic map computations <cstsmapmerge> | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | ... | ... |
test/test_cstssplit.py renamed to test/test_cstsmapsplit.py
| 1 | 1 | #! /usr/bin/env python |
| 2 | 2 | # ========================================================================== |
| 3 | -# This scripts performs unit tests for the cstssplit script. | |
| 3 | +# This scripts performs unit tests for the cstsmapsplit script. | |
| 4 | 4 | # |
| 5 | 5 | # Copyright (C) 2016 Michael Mayer |
| 6 | 6 | # |
| ... | ... | @@ -28,7 +28,7 @@ import cscripts |
| 28 | 28 | # =============================== # |
| 29 | 29 | class Test(gammalib.GPythonTestSuite): |
| 30 | 30 | """ |
| 31 | - Test class for cstssplit script. | |
| 31 | + Test class for cstssplit script | |
| 32 | 32 | |
| 33 | 33 | This test class makes unit tests for the csstsplit script by using it |
| 34 | 34 | from the command line and from Python. |
| ... | ... | @@ -37,7 +37,7 @@ class Test(gammalib.GPythonTestSuite): |
| 37 | 37 | # Constructor |
| 38 | 38 | def __init__(self): |
| 39 | 39 | """ |
| 40 | - Constructor. | |
| 40 | + Constructor | |
| 41 | 41 | """ |
| 42 | 42 | # Call base class constructor |
| 43 | 43 | gammalib.GPythonTestSuite.__init__(self) |
| ... | ... | @@ -48,46 +48,46 @@ class Test(gammalib.GPythonTestSuite): |
| 48 | 48 | # Set test functions |
| 49 | 49 | def set(self): |
| 50 | 50 | """ |
| 51 | - Set all test functions. | |
| 51 | + Set all test functions | |
| 52 | 52 | """ |
| 53 | 53 | # Set test name |
| 54 | - self.name('cstssplit') | |
| 54 | + self.name('cstsmapsplit') | |
| 55 | 55 | |
| 56 | 56 | # Append tests |
| 57 | - self.append(self._test_cmd, "Test cstssplit on command line") | |
| 58 | - #self.append(self._test_python, "Test cstssplit from Python") | |
| 57 | + self.append(self._test_cmd, 'Test cstsmapsplit on command line') | |
| 58 | + #self.append(self._test_python, 'Test cstsmapsplit from Python') | |
| 59 | 59 | |
| 60 | 60 | # Return |
| 61 | 61 | return |
| 62 | 62 | |
| 63 | - # Test cstssplit on command line | |
| 63 | + # Test cstsmapsplit on command line | |
| 64 | 64 | def _test_cmd(self): |
| 65 | 65 | """ |
| 66 | - Test cstssplit on the command line. | |
| 66 | + Test cstsmapsplit on the command line. | |
| 67 | 67 | """ |
| 68 | 68 | # Kluge to set the command (installed version has no README file) |
| 69 | 69 | if os.path.isfile("README.md"): |
| 70 | - cstssplit = "../cscripts/cstssplit.py" | |
| 70 | + cstsmapsplit = "../cscripts/cstsmapsplit.py" | |
| 71 | 71 | else: |
| 72 | - cstssplit = "cstssplit" | |
| 73 | - | |
| 74 | - # Setup cstssplit command | |
| 75 | - cmd = cstssplit+' inobs="selected_events.fits"'+ \ | |
| 76 | - ' inmodel="data/crab.xml"'+ \ | |
| 77 | - ' srcname="Crab"'+ \ | |
| 78 | - ' caldb="irf"'+ \ | |
| 79 | - ' irf="cta_dummy_irf"'+ \ | |
| 80 | - ' outmap="tsmap.fits"'+ \ | |
| 81 | - ' nxpix=5'+ \ | |
| 82 | - ' nypix=5'+ \ | |
| 83 | - ' binsz=0.05'+ \ | |
| 84 | - ' coordsys="CEL"'+ \ | |
| 85 | - ' xref=83.63'+ \ | |
| 86 | - ' yref=22.01'+ \ | |
| 87 | - ' proj="CAR"'+ \ | |
| 88 | - ' compute_null=yes'+ \ | |
| 89 | - ' bins_per_job=5'+ \ | |
| 90 | - ' outfile="tsmap_cmds1.txt"' | |
| 72 | + cstsmapsplit = "cstsmapsplit" | |
| 73 | + | |
| 74 | + # Setup cstsmapsplit command | |
| 75 | + cmd = cstsmapsplit+' inobs="selected_events.fits"'+ \ | |
| 76 | + ' inmodel="data/crab.xml"'+ \ | |
| 77 | + ' srcname="Crab"'+ \ | |
| 78 | + ' caldb="prod2"'+ \ | |
| 79 | + ' irf="South_0.5h"'+ \ | |
| 80 | + ' outmap="tsmap.fits"'+ \ | |
| 81 | + ' nxpix=5'+ \ | |
| 82 | + ' nypix=5'+ \ | |
| 83 | + ' binsz=0.05'+ \ | |
| 84 | + ' coordsys="CEL"'+ \ | |
| 85 | + ' xref=83.63'+ \ | |
| 86 | + ' yref=22.01'+ \ | |
| 87 | + ' proj="CAR"'+ \ | |
| 88 | + ' compute_null=yes'+ \ | |
| 89 | + ' bins_per_job=5'+ \ | |
| 90 | + ' outfile="tsmap_cmds1.txt"' | |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | # Execute cstssplit, make sure we catch any exception |
| ... | ... | @@ -103,23 +103,23 @@ class Test(gammalib.GPythonTestSuite): |
| 103 | 103 | # Check observation definition XML file |
| 104 | 104 | self._check_cmdfile('tsmap_cmds1.txt') |
| 105 | 105 | |
| 106 | - # Setup cstssplit command | |
| 107 | - cmd = cstssplit+' inobs="selected_events.fits"'+ \ | |
| 108 | - ' inmodel="data/crab.xml"'+ \ | |
| 109 | - ' srcname="Does_not_exist"'+ \ | |
| 110 | - ' caldb="irf"'+ \ | |
| 111 | - ' irf="cta_dummy_irf"'+ \ | |
| 112 | - ' outmap="tsmap.fits"'+ \ | |
| 113 | - ' nxpix=5'+ \ | |
| 114 | - ' nypix=5'+ \ | |
| 115 | - ' binsz=0.05'+ \ | |
| 116 | - ' coordsys="CEL"'+ \ | |
| 117 | - ' xref=83.63'+ \ | |
| 118 | - ' yref=22.01'+ \ | |
| 119 | - ' proj="CAR"'+ \ | |
| 120 | - ' compute_null=yes'+ \ | |
| 121 | - ' bins_per_job=5'+ \ | |
| 122 | - ' outfile="tsmap_cmds2.txt"' | |
| 106 | + # Setup cstsmapsplit command | |
| 107 | + cmd = cstsmapsplit+' inobs="selected_events.fits"'+ \ | |
| 108 | + ' inmodel="data/crab.xml"'+ \ | |
| 109 | + ' srcname="Does_not_exist"'+ \ | |
| 110 | + ' caldb="prod2"'+ \ | |
| 111 | + ' irf="South_0.5h"'+ \ | |
| 112 | + ' outmap="tsmap.fits"'+ \ | |
| 113 | + ' nxpix=5'+ \ | |
| 114 | + ' nypix=5'+ \ | |
| 115 | + ' binsz=0.05'+ \ | |
| 116 | + ' coordsys="CEL"'+ \ | |
| 117 | + ' xref=83.63'+ \ | |
| 118 | + ' yref=22.01'+ \ | |
| 119 | + ' proj="CAR"'+ \ | |
| 120 | + ' compute_null=yes'+ \ | |
| 121 | + ' bins_per_job=5'+ \ | |
| 122 | + ' outfile="tsmap_cmds2.txt"' | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | # Execute cstssplit, make sure we catch any exception |
| ... | ... | @@ -135,31 +135,30 @@ class Test(gammalib.GPythonTestSuite): |
| 135 | 135 | # Return |
| 136 | 136 | return |
| 137 | 137 | |
| 138 | - # Test cstssplit from Python | |
| 138 | + # Test cstsmapsplit from Python | |
| 139 | 139 | def _test_python(self): |
| 140 | 140 | """ |
| 141 | - Test cstssplit from Python. | |
| 141 | + Test cstsmapsplit from Python. | |
| 142 | 142 | """ |
| 143 | - # Set-up cstssplit | |
| 144 | - tssplit = cscripts.cstssplit() | |
| 145 | - tssplit['inobs'] = 'obs_selected.xml' | |
| 146 | - tssplit['inmodel'] = 'data/crab.xml' | |
| 147 | - tssplit['xref'] = 83.6331 | |
| 148 | - tssplit['yref'] = 22.01 | |
| 149 | - tssplit['coordsys'] = 'CEL' | |
| 150 | - tssplit['proj'] = 'CAR' | |
| 151 | - tssplit['binsz'] = 0.05 | |
| 152 | - tssplit['nxpix'] = 5 | |
| 153 | - tssplit['nypix'] = 5 | |
| 154 | - tssplit['compute_null'] = False | |
| 155 | - tssplit['bins_per_job'] = 5 | |
| 156 | - tssplit['outfile'] = 'tsmap_cmd_py1.txt' | |
| 157 | - | |
| 143 | + # Set-up cstsmapsplit | |
| 144 | + tsmapsplit = cscripts.cstsmapsplit() | |
| 145 | + tsmapsplit['inobs'] = 'obs_selected.xml' | |
| 146 | + tsmapsplit['inmodel'] = 'data/crab.xml' | |
| 147 | + tsmapsplit['xref'] = 83.6331 | |
| 148 | + tsmapsplit['yref'] = 22.01 | |
| 149 | + tsmapsplit['coordsys'] = 'CEL' | |
| 150 | + tsmapsplit['proj'] = 'CAR' | |
| 151 | + tsmapsplit['binsz'] = 0.05 | |
| 152 | + tsmapsplit['nxpix'] = 5 | |
| 153 | + tsmapsplit['nypix'] = 5 | |
| 154 | + tsmapsplit['compute_null'] = False | |
| 155 | + tsmapsplit['bins_per_job'] = 5 | |
| 156 | + tsmapsplit['outfile'] = 'tsmap_cmd_py1.txt' | |
| 158 | 157 | |
| 159 | 158 | # Run cstssplit script and save run list |
| 160 | - tssplit.logFileOpen() # Make sure we get a log file | |
| 161 | - tssplit.run() | |
| 162 | - tssplit.save() | |
| 159 | + tsmapsplit.logFileOpen() # Make sure we get a log file | |
| 160 | + tsmapsplit.run() | |
| 161 | + tsmapsplit.save() | |
| 163 | 162 | |
| 164 | 163 | # Check observation definition XML file |
| 165 | 164 | self._check_cmdfile('tsmap_cmd_py1.txt') |
| ... | ... | @@ -177,8 +176,7 @@ class Test(gammalib.GPythonTestSuite): |
| 177 | 176 | fname = gammalib.GFilename(filename) |
| 178 | 177 | |
| 179 | 178 | # Check if execution was successful |
| 180 | - self.test_assert(fname.exists(), | |
| 181 | - "Output of cstssplit exists") | |
| 179 | + self.test_assert(fname.exists(), 'Check of output filename exists') | |
| 182 | 180 | |
| 183 | 181 | # Return |
| 184 | 182 | return | ... | ... |
test/test_python_cscripts.py
| ... | ... | @@ -37,12 +37,12 @@ import test_csroot2caldb |
| 37 | 37 | import test_cssens |
| 38 | 38 | import test_csspec |
| 39 | 39 | import test_cstsdist |
| 40 | +import test_cstsmapsplit | |
| 40 | 41 | import test_cstsmapmerge |
| 41 | 42 | import test_csworkflow |
| 42 | 43 | import test_csiactcopy |
| 43 | 44 | import test_csiactdata |
| 44 | 45 | import test_csiactobs |
| 45 | -import test_cstssplit | |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | # ================== # |
| ... | ... | @@ -112,9 +112,9 @@ def test(installed=False, debug=False): |
| 112 | 112 | suite_cssens = test_cssens.Test() |
| 113 | 113 | suite_csspec = test_csspec.Test() |
| 114 | 114 | suite_cstsdist = test_cstsdist.Test() |
| 115 | + suite_cstsmapsplit = test_cstsmapsplit.Test() | |
| 115 | 116 | suite_cstsmapmerge = test_cstsmapmerge.Test() |
| 116 | 117 | suite_csworkflow = test_csworkflow.Test() |
| 117 | - suite_cstssplit = test_cstssplit.Test() | |
| 118 | 118 | |
| 119 | 119 | # Setup unit tests |
| 120 | 120 | suite_cscaldb.set() |
| ... | ... | @@ -130,9 +130,9 @@ def test(installed=False, debug=False): |
| 130 | 130 | suite_cssens.set() |
| 131 | 131 | suite_csspec.set() |
| 132 | 132 | suite_cstsdist.set() |
| 133 | + suite_cstsmapsplit.set() | |
| 133 | 134 | suite_cstsmapmerge.set() |
| 134 | 135 | suite_csworkflow.set() |
| 135 | - suite_cstssplit.set() | |
| 136 | 136 | |
| 137 | 137 | # Append tests to container |
| 138 | 138 | suites.append(suite_cscaldb) |
| ... | ... | @@ -148,9 +148,9 @@ def test(installed=False, debug=False): |
| 148 | 148 | suites.append(suite_cssens) |
| 149 | 149 | suites.append(suite_csspec) |
| 150 | 150 | suites.append(suite_cstsdist) |
| 151 | + suites.append(suite_cstsmapsplit) | |
| 151 | 152 | suites.append(suite_cstsmapmerge) |
| 152 | 153 | suites.append(suite_csworkflow) |
| 153 | - suites.append(suite_cstssplit) | |
| 154 | 154 | |
| 155 | 155 | # Append tests for Python 2.6+ (the IACT cscripts depend on the json |
| 156 | 156 | # module which is only available since Python 2.6+ | ... | ... |