Commit de10a102b541058c53c981829974737d30708f17
1 parent
0eeff30e
Remove phase curve parameter for ctphase (#1982)
Showing
6 changed files
with
44 additions
and
29 deletions
AUTHORS
| 1 | 1 | Johan Bregeon (johan.bregeon@lupm.in2p3.fr) |
| 2 | 2 | Rolf Buehler (rolf.buehler@desy.de) |
| 3 | +Joshua Cardenzana (jcardenzana@irap.omp.eu) | |
| 3 | 4 | Jean-Baptiste Cayrou (cayrou@etud.insa-toulouse.fr) |
| 4 | 5 | Christoph Deil (Christoph.Deil@mpi-hd.mpg.de) |
| 5 | 6 | Leonardo Di Venere (leonardo.divenere@ba.infn.it) | ... | ... |
ChangeLog
NEWS
| ... | ... | @@ -142,6 +142,13 @@ event list a column for each model component that will contain the probability |
| 142 | 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 | 152 | cscripts |
| 146 | 153 | -------- |
| 147 | 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 | 463 | else { |
| 464 | 464 | |
| 465 | 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 | 472 | // Set reference time |
| 474 | 473 | GTime mjd; |
| 475 | 474 | mjd.mjd(mjd_value); |
| 476 | 475 | |
| 477 | 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 | 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 | 25 | # |
| 26 | 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 | 35 | # Standard parameters | ... | ... |
test/test_ctphase.py
| ... | ... | @@ -41,7 +41,6 @@ class Test(test): |
| 41 | 41 | |
| 42 | 42 | # Set test data |
| 43 | 43 | self._model_file = self._datadir + '/model_temporal_phasecurve.xml' |
| 44 | - self._phase_file = self._datadir + '/model_temporal_phasecurve.fits' | |
| 45 | 44 | self._invalid_events = self._datadir + '/invalid_event_list.fits' |
| 46 | 45 | |
| 47 | 46 | # Return |
| ... | ... | @@ -153,17 +152,16 @@ class Test(test): |
| 153 | 152 | self._check_result_file('ctphase_py1.fits') |
| 154 | 153 | |
| 155 | 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 | 166 | # Execute ctphase tool |
| 169 | 167 | phase.logFileOpen() # Make sure we get a log file |
| ... | ... | @@ -204,11 +202,16 @@ class Test(test): |
| 204 | 202 | nevents : int, optional |
| 205 | 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 | 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 | 216 | # Return |
| 214 | 217 | return | ... | ... |