Commit 4e0f5a806a55cfc99d1b069513db5f2af6ac6777
1 parent
b017e547
added another ctprob test using XML obs file as input
Showing
2 changed files
with
23 additions
and
2 deletions
src/ctprob/ctprob.cpp
| @@ -223,7 +223,7 @@ void ctprob::run(void) | @@ -223,7 +223,7 @@ void ctprob::run(void) | ||
| 223 | log_observations(NORMAL, m_obs, "Input observation"); | 223 | log_observations(NORMAL, m_obs, "Input observation"); |
| 224 | 224 | ||
| 225 | // Write header into logger | 225 | // Write header into logger |
| 226 | - log_header1(TERSE, "Event selection"); | 226 | + log_header1(TERSE, "Event probability evaluation"); |
| 227 | 227 | ||
| 228 | // Initialise counters | 228 | // Initialise counters |
| 229 | int n_observations = 0; | 229 | int n_observations = 0; |
| @@ -280,7 +280,7 @@ void ctprob::run(void) | @@ -280,7 +280,7 @@ void ctprob::run(void) | ||
| 280 | // Fall through in case that the event file is empty | 280 | // Fall through in case that the event file is empty |
| 281 | if (obs->events()->size() == 0) { | 281 | if (obs->events()->size() == 0) { |
| 282 | log_string(NORMAL, " Warning: No events in event file \""+ | 282 | log_string(NORMAL, " Warning: No events in event file \""+ |
| 283 | - m_infiles[i]+"\". Event selection skipped."); | 283 | + m_infiles[i]+"\". Event probability evaluation skipped."); |
| 284 | continue; | 284 | continue; |
| 285 | } | 285 | } |
| 286 | 286 |
test/test_ctprob.py
| @@ -171,6 +171,27 @@ class Test(test): | @@ -171,6 +171,27 @@ class Test(test): | ||
| 171 | except ValueError: | 171 | except ValueError: |
| 172 | self.test_try_success() | 172 | self.test_try_success() |
| 173 | 173 | ||
| 174 | + | ||
| 175 | + # Setup ctprob with a list of observations and test prefix | ||
| 176 | + prob = ctools.ctprob() | ||
| 177 | + prob['inobs'] = self._datadir + '/obs_unbinned.xml' | ||
| 178 | + prob['prefix'] = 'ctprob_py3_' | ||
| 179 | + prob['outobs'] = 'ctprob_py3_obs.xml' | ||
| 180 | + prob['inmodel'] = self._model | ||
| 181 | + prob['caldb'] = self._caldb | ||
| 182 | + prob['irf'] = self._irf | ||
| 183 | + prob['edisp'] = True | ||
| 184 | + prob['logfile'] = 'ctprob_py3.log' | ||
| 185 | + prob['chatter'] = 3 | ||
| 186 | + | ||
| 187 | + # Run ctprob tool | ||
| 188 | + prob.logFileOpen() # Make sure we get a log file | ||
| 189 | + prob.run() | ||
| 190 | + prob.save() | ||
| 191 | + | ||
| 192 | + # Check result file | ||
| 193 | + self._check_result_file('ctprob_py3_crab_events.fits') | ||
| 194 | + | ||
| 174 | # Return | 195 | # Return |
| 175 | return | 196 | return |
| 176 | 197 |