Skip to content

Unexpected behavior from custom function SpecFromDat #363

@ckarwin

Description

@ckarwin

I am analyzing the Crab from DC3 using the SpecFromDat custom function and noticed some odd behavior, as summarized below.

In the doc string, the normalization parameter K specifies: transformation : log10. This transformation leads to some odd behavior. First, when minimizing the likelihood, the normalization is taking negative values. The min value in the doc string is 1e-30, and so it appears as though negative numbers would not be allowed, but because of the log transformation, any input <1 maps to a negative value, which of course is non-physical. The other issue with the log transformation is that it's not clear for the user to know that this is happening, specifically when passing initial values for K. To fix this my suggestion is to simply remove the log transformation. I would also adjust the other parameters a bit: min, max, and delta.

The other issue with this function is that the normalization in the doc string is ph/cm2/s, however, the actual normalization that comes from the code is ph/cm2/s/keV. The former makes sense, since the spectrum is normalized, and K gives the integrated flux over the entire energy range. I think this can be fixed by simply removing lines 138-139 (and changing set_units to the correct units):

if self._x_unit != None:
.

I think @krishnatejavedula worked on this function most recently. What do you think about these proposed changes? Do you think they make sense, or is there something else I'm not considering here?

Metadata

Metadata

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions