Commit de10a102b541058c53c981829974737d30708f17
1 parent
0eeff30e
Remove phase curve parameter for ctphase (#1982)
Showing
6 changed files
with
44 additions
and
29 deletions
AUTHORS
| 1 | Johan Bregeon (johan.bregeon@lupm.in2p3.fr) | 1 | Johan Bregeon (johan.bregeon@lupm.in2p3.fr) |
| 2 | Rolf Buehler (rolf.buehler@desy.de) | 2 | Rolf Buehler (rolf.buehler@desy.de) |
| 3 | +Joshua Cardenzana (jcardenzana@irap.omp.eu) | ||
| 3 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) | 4 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) |
| 4 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) | 5 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) |
| 5 | Leonardo Di Venere (leonardo.divenere@ba.infn.it) | 6 | Leonardo Di Venere (leonardo.divenere@ba.infn.it) |
ChangeLog
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | * Version 1.3.0 released | 3 | * Version 1.3.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Add ctphase tool (#1982) | ||
| 6 | Add ctprob tool (#1991) | 7 | Add ctprob tool (#1991) |
| 7 | ctlike stores covariance matrix in either CSV or FITS format (#1863) | 8 | ctlike stores covariance matrix in either CSV or FITS format (#1863) |
| 8 | Use correct ROOT histograms in csroot2caldb | 9 | Use correct ROOT histograms in csroot2caldb |
NEWS
| @@ -142,6 +142,13 @@ event list a column for each model component that will contain the probability | @@ -142,6 +142,13 @@ event list a column for each model component that will contain the probability | ||
| 142 | that the event originates from that component (#1991). | 142 | that the event originates from that component (#1991). |
| 143 | 143 | ||
| 144 | 144 | ||
| 145 | +ctphase - Event phase computation | ||
| 146 | +--------------------------------- | ||
| 147 | +The ctphase tool has been added that compute the phase for each event based on | ||
| 148 | +a temporal phase curve model. This allows for example to perform a pulsar or | ||
| 149 | +binary analysis (#1982). | ||
| 150 | + | ||
| 151 | + | ||
| 145 | cscripts | 152 | cscripts |
| 146 | -------- | 153 | -------- |
| 147 | The csebins script has been added that generates an energy boundaries | 154 | The csebins script has been added that generates an energy boundaries |
src/ctphase/ctphase.cpp
| @@ -463,19 +463,23 @@ void ctphase::get_parameters(void) | @@ -463,19 +463,23 @@ void ctphase::get_parameters(void) | ||
| 463 | else { | 463 | else { |
| 464 | 464 | ||
| 465 | // Read phase curve user parameters | 465 | // Read phase curve user parameters |
| 466 | - GFilename phasecurve = (*this)["phasecurve"].filename(); | ||
| 467 | - double mjd_value = (*this)["mjd"].real(); | ||
| 468 | - double phase = (*this)["phase"].real(); | ||
| 469 | - double f0 = (*this)["f0"].real(); | ||
| 470 | - double f1 = (*this)["f1"].real(); | ||
| 471 | - double f2 = (*this)["f2"].real(); | 466 | + double mjd_value = (*this)["mjd"].real(); |
| 467 | + double phase = (*this)["phase"].real(); | ||
| 468 | + double f0 = (*this)["f0"].real(); | ||
| 469 | + double f1 = (*this)["f1"].real(); | ||
| 470 | + double f2 = (*this)["f2"].real(); | ||
| 472 | 471 | ||
| 473 | // Set reference time | 472 | // Set reference time |
| 474 | GTime mjd; | 473 | GTime mjd; |
| 475 | mjd.mjd(mjd_value); | 474 | mjd.mjd(mjd_value); |
| 476 | 475 | ||
| 477 | // Set phase curve | 476 | // Set phase curve |
| 478 | - m_phase = GModelTemporalPhaseCurve(phasecurve, mjd, phase, f0, f1, f2); | 477 | + m_phase = GModelTemporalPhaseCurve(); |
| 478 | + m_phase.mjd(mjd); | ||
| 479 | + m_phase.phase(phase); | ||
| 480 | + m_phase.f0(f0); | ||
| 481 | + m_phase.f1(f1); | ||
| 482 | + m_phase.f2(f2); | ||
| 479 | 483 | ||
| 480 | } // endelse: read phase curve information from User parameters | 484 | } // endelse: read phase curve information from User parameters |
| 481 | 485 |
src/ctphase/ctphase.par
| @@ -25,12 +25,11 @@ source, s, a, "Crab",,, "Source in model file to use for phase information" | @@ -25,12 +25,11 @@ source, s, a, "Crab",,, "Source in model file to use for phase information" | ||
| 25 | # | 25 | # |
| 26 | # Phase information parameters | 26 | # Phase information parameters |
| 27 | #===================== | 27 | #===================== |
| 28 | -phasecurve, f, a, phase.fits,,, "Phase curve FITS file" | ||
| 29 | -mjd, r, a, 51544.5,,, "Reference MJD for phase information" | ||
| 30 | -phase, r, a, 0.0,0.0,1.0, "Phase at reference MJD" | ||
| 31 | -f0, r, a, 1.0,,, "Frequency at reference MJD (Hz)" | ||
| 32 | -f1, r, a, 0.1,,, "First freq. derivative at reference MJD (s^-1)" | ||
| 33 | -f2, r, a, 0.01,,, "Second freq. derivative at reference MJD (s^-2)" | 28 | +mjd, r, a, 51544.5,,, "Reference MJD for phase information" |
| 29 | +phase, r, a, 0.0,0.0,1.0, "Phase at reference MJD" | ||
| 30 | +f0, r, a, 1.0,,, "Frequency at reference MJD (Hz)" | ||
| 31 | +f1, r, a, 0.1,,, "First freq. derivative at reference MJD (s^-2)" | ||
| 32 | +f2, r, a, 0.01,,, "Second freq. derivative at reference MJD (s^-3)" | ||
| 34 | 33 | ||
| 35 | # | 34 | # |
| 36 | # Standard parameters | 35 | # Standard parameters |
test/test_ctphase.py
| @@ -41,7 +41,6 @@ class Test(test): | @@ -41,7 +41,6 @@ class Test(test): | ||
| 41 | 41 | ||
| 42 | # Set test data | 42 | # Set test data |
| 43 | self._model_file = self._datadir + '/model_temporal_phasecurve.xml' | 43 | self._model_file = self._datadir + '/model_temporal_phasecurve.xml' |
| 44 | - self._phase_file = self._datadir + '/model_temporal_phasecurve.fits' | ||
| 45 | self._invalid_events = self._datadir + '/invalid_event_list.fits' | 44 | self._invalid_events = self._datadir + '/invalid_event_list.fits' |
| 46 | 45 | ||
| 47 | # Return | 46 | # Return |
| @@ -153,17 +152,16 @@ class Test(test): | @@ -153,17 +152,16 @@ class Test(test): | ||
| 153 | self._check_result_file('ctphase_py1.fits') | 152 | self._check_result_file('ctphase_py1.fits') |
| 154 | 153 | ||
| 155 | # Now run ctphase tool without a model file | 154 | # Now run ctphase tool without a model file |
| 156 | - phase['inmodel'] = 'NONE' | ||
| 157 | - phase['source'] = 'NONE' | ||
| 158 | - phase['phasecurve'] = self._phase_file | ||
| 159 | - phase['mjd'] = 51544.5 | ||
| 160 | - phase['phase'] = 0.0 | ||
| 161 | - phase['f0'] = 1.0 | ||
| 162 | - phase['f1'] = 0.1 | ||
| 163 | - phase['f2'] = 0.01 | ||
| 164 | - phase['outobs'] = 'ctphase_py2.fits' | ||
| 165 | - phase['logfile'] = 'ctphase_py2.log' | ||
| 166 | - phase['chatter'] = 3 | 155 | + phase['inmodel'] = 'NONE' |
| 156 | + phase['source'] = 'NONE' | ||
| 157 | + phase['mjd'] = 51544.5 | ||
| 158 | + phase['phase'] = 0.0 | ||
| 159 | + phase['f0'] = 1.0 | ||
| 160 | + phase['f1'] = 0.1 | ||
| 161 | + phase['f2'] = 0.01 | ||
| 162 | + phase['outobs'] = 'ctphase_py2.fits' | ||
| 163 | + phase['logfile'] = 'ctphase_py2.log' | ||
| 164 | + phase['chatter'] = 3 | ||
| 167 | 165 | ||
| 168 | # Execute ctphase tool | 166 | # Execute ctphase tool |
| 169 | phase.logFileOpen() # Make sure we get a log file | 167 | phase.logFileOpen() # Make sure we get a log file |
| @@ -204,11 +202,16 @@ class Test(test): | @@ -204,11 +202,16 @@ class Test(test): | ||
| 204 | nevents : int, optional | 202 | nevents : int, optional |
| 205 | Expected number of events | 203 | Expected number of events |
| 206 | """ | 204 | """ |
| 207 | - # Open result file | ||
| 208 | - events = gammalib.GCTAEventList(filename) | 205 | + # Open event list |
| 206 | + events = gammalib.GCTAEventList(filename) | ||
| 207 | + | ||
| 208 | + # Check event list | ||
| 209 | + self.test_value(events.size(), nevents, 'Check number of events') | ||
| 210 | + | ||
| 211 | + # Check phases | ||
| 209 | phases = [events[i].phase() for i in range(events.size())] | 212 | phases = [events[i].phase() for i in range(events.size())] |
| 210 | - test_result = int(sum(phases)>0) | ||
| 211 | - self.test_value(test_result, 1, 'Check number of events') | 213 | + test_result = int(sum(phases) > 0) |
| 214 | + self.test_value(test_result, 1, 'Check whether phase information is set') | ||
| 212 | 215 | ||
| 213 | # Return | 216 | # Return |
| 214 | return | 217 | return |