Bug #2262

ctpsfcube does not respect chatter=0

Added by Cardenzana Josh about 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:10/26/2017
Priority:NormalDue date:
Assigned To:Cardenzana Josh% Done:

100%

Category:-
Target version:1.5.0
Duration:

Description

I’ve nested several scripts that have to run many times, so setting the chatter=0 is useful to prevent flooding the screen with information. However, ctpsfcube does not appear to respect this mode. As an example, I would not expect the 'Skipping unbinned ...' lines to be included in the following output:

COMMAND:
$ ctpsfcube debug=yes inobs=myobs.xml outcube=psfcube.fits ebinalg=LOG emin=0.1 emax=100 enumbins=20 
nxpix=5 nypix=5 binsz=0.5 coordsys=GAL proj=CAR xref=358.30 yref=2.83 chatter=0

OUTPUT:

2017-10-26T13:12:43: Skipping unbinned CTA observation "GPS" (id=110323) since it does not overlap with the point spread function cube.
2017-10-26T13:12:43: Skipping unbinned CTA observation "GPS" (id=110324) since it does not overlap with the point spread function cube.
2017-10-26T13:12:43: Skipping unbinned CTA observation "GPS" (id=110325) since it does not overlap with the point spread function cube.
...
2017-10-26T13:12:43: Skipping unbinned CTA observation "GPS" (id=111232) since it does not overlap with the point spread function cube.
2017-10-26T13:12:43: Skipping unbinned CTA observation "GPS" (id=111233) since it does not overlap with the point spread function cube.
2017-10-26T13:12:43: Skipping unbinned CTA observation "GPS" (id=111234) since it does not overlap with the point spread function cube.
2017-10-26T13:12:44: 
2017-10-26T13:12:44: Application "ctpsfcube" terminated after 8 wall clock seconds, consuming 5.14838 seconds of CPU time.

The reason is pretty straight forward. These lines are printed by the 'GCTACubePsf::fill()' method, which takes a pointer to the log file. The output is then directly fed to the log file regardless of the chatter level of the calling tool. Instead, a similar approach should be used as ctbkgcube, where when the chatter is not NORMAL then NULL is passed instead of the log file which prevents any text being logged when looping through the observations:

    // Set pointer to logger dependent on chattiness
    GLog* logger = (logNormal()) ? &log : NULL;

    // Fill background cube from observations
    m_background.fill(m_obs, logger);

There are already protections in 'GCTACubePsf::fill()' to prevent printing when the logfile is NULL, so this is really just the addition of a single line in ctpsfcube.


Recurrence

No recurrence.

History

#1 Updated by Cardenzana Josh about 7 years ago

  • Status changed from New to Pull request
  • % Done changed from 0 to 90

The above has been implemented and works as expected. Text on whether an observation is included in the psfcube is only printed when chatter >= 2.

Pull Branch:
Josh Cardenzana / ctools: 2262-ctpsfcube_silent_chatter
https://cta-gitlab.irap.omp.eu/jcardenzana/ctools/tree/2262-ctpsfcube_silent_chatter

#2 Updated by Knödlseder Jürgen almost 7 years ago

  • Status changed from Pull request to Closed
  • Target version set to 1.5.0
  • % Done changed from 90 to 100

Merged into devel.

Also available in: Atom PDF