Action #2456

make sure residual computation with SUBDIV method fails graciously for 0 counts

Added by Tibaldo Luigi over 6 years ago. Updated over 6 years ago.

Status:ClosedStart date:04/20/2018
Priority:HighDue date:
Assigned To:Tibaldo Luigi% Done:

100%

Category:-
Target version:1.6.0
Duration:

Description

Talvikki Hovatta reported failures of csrespec that seem to be related to bins with 0 counts. Make sure that in this case the tool fails graciously, i.e., still gives output with Nan in empty bins.


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen over 6 years ago

  • Assigned To set to Tibaldo Luigi
  • Priority changed from Normal to High
  • Target version set to 1.6.0

#2 Updated by Tibaldo Luigi over 6 years ago

  • Status changed from New to In Progress

Looking for a test case to reproduce the issue ...

#3 Updated by Tibaldo Luigi over 6 years ago

  • % Done changed from 0 to 10

In fact it’s not csresspec that fails, but just the example plotting script. This is more logical since the SUBDIV method divides by the model (which is never exactly zero).
Here’s the error message, need to look into it

$CTOOLS/share/examples/python/show_residuals.py specres_SUBDIV.fits
Traceback (most recent call last):
File "/usr/local/gamma/share/examples/python/show_residuals.py”, line 341, in <module>
show_residuals()
File "/usr/local/gamma/share/examples/python/show_residuals.py”, line 329, in show_residuals
plot_residuals(args0, plotfile, hdu)
File "/usr/local/gamma/share/examples/python/show_residuals.py”, line 211, in plot_residuals
algorithm)
File "/usr/local/gamma/share/examples/python/show_residuals.py”, line 117, in fill_cmr
e_resid.append(err / c_model.real(row))
ZeroDivisionError: float division by zero

#4 Updated by Tibaldo Luigi over 6 years ago

  • Status changed from In Progress to Pull request
  • % Done changed from 10 to 100

It does happen for WSTAT that the model is exactly 0 for the Off region.
The case is dealt with in obsutils.residuals, and therefore in csresspec, but it was not in the show_residuals example script when computing the residual error bars on the fly.
I modified it to set the error to 0 whenever the model is 0 for the SUBDIV and SUBDIVSQRT algorithms.

#5 Updated by Knödlseder Jürgen over 6 years ago

  • Status changed from Pull request to Closed

Merged into devel.

Also available in: Atom PDF