Commit d946c929ae007c0943251f61b4baf9c2cb937eab

Authored by knodlseder
1 parent cff1b706

use pointing as image centre if observations are provided

ChangeLog
  1 +2011-07-27 Juergen Knoedlseder <knodlseder@cesr.fr>
  2 +
  3 + * Version 0.2.5 released
  4 + ========================
  5 +
  6 + ctbin extracts the image centre from an observation if provided
  7 +
1 8 2011-07-20 Juergen Knoedlseder <knodlseder@cesr.fr>
2 9  
3 10 * Version 0.2.4 released
... ...
1   -New Features and Important Changes in ctatools 00-02-04
  1 +New Features and Important Changes in ctatools 00-02-05
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -July 20, 2011
  5 +July 27, 2011
6 6  
7 7  
8 8 1. Introduction
... ... @@ -12,15 +12,7 @@ This document briefly summarizes executable by executable the most important cha
12 12  
13 13 2. Configuration
14 14 -----------------
15   -The configuration script aborts now if no C++ compiler is found.
16   -
17   -Added ctatools-init.sh, ctatools-init.csh and ctatools-setup
18   -scripts. They needed to be called when ctatools is installed
19   -in a location that differs from GammaLib, so that the
20   -environment is set up correctly also for this case. If ctatools
21   -is in the same location as GammaLib, these scripts do not need
22   -to be used.
23   -
  15 +None
24 16  
25 17 3. Python interface
26 18 -------------------
... ... @@ -39,7 +31,11 @@ None
39 31  
40 32 6. ctbin - CTA event binning
41 33 ----------------------------
42   -None
  34 +If an observation container is passed to ctbin, the counts map reference
  35 +pixel is taken from the pointing of each observation and the xref and yref
  36 +parameters are ignored. This allows for pipeline processing of a list of
  37 +observations using ctbin. Note that this feature is only available if cabin
  38 +is used from Python.
43 39  
44 40  
45 41 7. ctlike - CTA maximum likelihood fitting
... ...
src/ctbin/ctbin.cpp
... ... @@ -368,6 +368,11 @@ void ctbin::get_parameters(void)
368 368  
369 369 // Append CTA observation to container
370 370 m_obs.append(obs);
  371 +
  372 + // Use the xref and yref parameters for binning (otherwise the
  373 + // pointing direction(s) is/are used)
  374 + m_xref = (*this)["xref"].real();
  375 + m_yref = (*this)["yref"].real();
371 376  
372 377 } // endif: there was no observation in the container
373 378  
... ... @@ -377,8 +382,6 @@ void ctbin::get_parameters(void)
377 382 m_enumbins = (*this)["enumbins"].integer();
378 383 m_proj = (*this)["proj"].string();
379 384 m_coordsys = (*this)["coordsys"].string();
380   - m_xref = (*this)["xref"].real();
381   - m_yref = (*this)["yref"].real();
382 385 m_binsz = (*this)["binsz"].real();
383 386 m_nxpix = (*this)["nxpix"].integer();
384 387 m_nypix = (*this)["nypix"].integer();
... ... @@ -395,6 +398,8 @@ void ctbin::get_parameters(void)
395 398 *
396 399 * @exception GException::no_list
397 400 * No event list found in observation.
  401 + * @exception GCTAException::no_pointing
  402 + * No valid CTA pointing found.
398 403 *
399 404 * This method bins the events found in a CTA events list into a counts map
400 405 * and replaces the event list by the counts map in the observation. The
... ... @@ -421,11 +426,38 @@ void ctbin::bin_events(GCTAObservation* obs)
421 426  
422 427 // Get Good Time intervals
423 428 GGti gti = obs->events()->gti();
  429 +
  430 + // Get map centre
  431 + double xref;
  432 + double yref;
  433 + if (m_xref != 9999.0 && m_yref != 9999.0) {
  434 + xref = m_xref;
  435 + yref = m_yref;
  436 + }
  437 + else {
  438 +
  439 + // Get pointer on CTA pointing
  440 + const GTime srcTime; // Dummy time
  441 + const GCTAPointing *pnt = obs->pointing(srcTime);
  442 + if (pnt == NULL)
  443 + throw GCTAException::no_pointing(G_BIN_EVENTS);
  444 +
  445 + // Set reference point to pointing
  446 + if (toupper(m_coordsys) == "GAL") {
  447 + xref = pnt->dir().l_deg();
  448 + yref = pnt->dir().b_deg();
  449 + }
  450 + else {
  451 + xref = pnt->dir().ra_deg();
  452 + yref = pnt->dir().dec_deg();
  453 + }
  454 +
  455 + } // endelse: map centre set to pointing
424 456  
425 457 // Create skymap
426 458 GSkymap map = GSkymap(m_proj, m_coordsys,
427   - m_xref, m_yref, m_binsz, m_binsz,
428   - m_nxpix, m_nypix, m_enumbins);
  459 + xref, yref, m_binsz, m_binsz,
  460 + m_nxpix, m_nypix, m_enumbins);
429 461  
430 462 // Initialise binning statistics
431 463 int num_outside_map = 0;
... ... @@ -515,8 +547,8 @@ void ctbin::init_members(void)
515 547 m_emin = 0.0;
516 548 m_emax = 0.0;
517 549 m_enumbins = 0;
518   - m_xref = 0.0;
519   - m_yref = 0.0;
  550 + m_xref = 9999.0; // Flags unset (use pointing direction)
  551 + m_yref = 9999.0; // Flags unset (use pointing direction)
520 552 m_binsz = 0.0;
521 553 m_nxpix = 0;
522 554 m_nypix = 0;
... ...