Feature #1498

ctbutterfly should consider correlations with all model instances

Added by Mayer Michael over 9 years ago. Updated about 9 years ago.

Status:ClosedStart date:07/01/2015
Priority:NormalDue date:
Assigned To:Mayer Michael% Done:

100%

Category:-Estimated time:2.00 hours
Target version:1.0.0
Duration:

Description

Up to now ctbutterfly only considered correlations with other sky models and no background models. This should be changed.

butterfly.png (45.6 KB) Knödlseder Jürgen, 07/02/2015 06:04 PM

butterfly.png (43.8 KB) Mayer Michael, 07/03/2015 01:08 PM

Butterfly Butterfly

Recurrence

No recurrence.


Related issues

Related to ctools - Feature #1051: create ctbutterfly or allow a access the covariance matri... Closed 01/03/2014

History

#1 Updated by Mayer Michael over 9 years ago

  • Status changed from New to Pull request
  • Target version set to 1.0.0
  • % Done changed from 0 to 100
  • Estimated time set to 2.00

on branch 1498-ctbutterfly-should-consider-all-correlations

#2 Updated by Knödlseder Jürgen over 9 years ago

This butterfly looks strange (generated using the standard Crab model):

I don’t merge this in for the moment.

I did some minor modifications to the 1498-ctbutterfly-should-consider-all-correlations, so do a pull before investigating.

#3 Updated by Knödlseder Jürgen over 9 years ago

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

#4 Updated by Mayer Michael over 9 years ago

The problem might be related to the fact that an inappropriate input model was used.
In case I use ctlike to optimise the model first and pass it then to ctbutterfly, the output looks better. Nevertheless, the question if the output is reasonable does still stand.
I am still not sure about the absolute scales of the parameters (e.g. SkyModel vs Background model). I am happy for any idea how to handle the difference in absolute flux scales.

#5 Updated by Knödlseder Jürgen about 9 years ago

Is there any news on this issue?

#6 Updated by Mayer Michael about 9 years ago

Actually no. I tried out a few things here and there but I wasn’t able to improve the tool. What do you think, can we leave it as it was before for 1.0?

#7 Updated by Knödlseder Jürgen about 9 years ago

I discovered that the error changes little with energy. It looks like that not all model components are evaluated at the right energy, but just the source model. Specifically the background model gradients are always the same.

Can you point me to some literature that describes how the butterfly should be done?

#8 Updated by Knödlseder Jürgen about 9 years ago

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

I changed the way how butterfly diagrams are computed. I followed here some work of Stephan Fegan done in the context of Fermi/LAT.

First, the current algorithm only covers power law models (and specifically the PowerLaw model, although the code could be easily adapted for the PowerLaw2 model). I recognized that Stephan’s method is not limited to power laws, but for more than 2 parameters the computation of the error ellipsoid becomes more complex.

The code now computes the envelope all power laws that are compatible with parameters that fall within the error ellipse. For this it is sufficient to walk around the circumference of the error ellipse for a given confidence limit. For each energy, the code computes then the minimum and maximum intensity encountered.

The output file has now 4 columns, as the errors are not necessarily symmetric. ctbutterfly now dumps the minimum and maximum intensity in the 3rd and 4th column.

#9 Updated by Knödlseder Jürgen about 9 years ago

  • Status changed from Pull request to Closed

Merged into devel.

#10 Updated by Mayer Michael about 9 years ago

Ok that was fast :)
I was just using Gaussian error propagation, i.e. using the covariance matrix and the vectors of parameter gradients. The product of gradient * Cov * gradient should give the square of the symmetric error. This method would work independent of the spectral model.
But since the scales of the gradients are different for background and sky models, I ran into problems during the multiplications.

#11 Updated by Knödlseder Jürgen about 9 years ago

Mayer Michael wrote:

Ok that was fast :)
I was just using Gaussian error propagation, i.e. using the covariance matrix and the vectors of parameter gradients. The product of gradient * Cov * gradient should give the square of the symmetric error. This method would work independent of the spectral model.
But since the scales of the gradients are different for background and sky models, I ran into problems during the multiplications.

I could not find any note on a generalization of the method. I’m not sure that gradient * Cov * gradient is an energy dependent thing (the cov that is computed is the overall covariance). Maybe the problem comes from there? But if you can point me to some literature that describes the reasoning behind using gradient * Cov * gradient for a butterfly I could get convinced that it’s feasible ;)

#12 Updated by Mayer Michael about 9 years ago

Ok thanks for clarifying. I guess you are right regarding the energy dependence. I will check how this is done in HESS and try to find a general method to derive the butterfly with that approach.

Also available in: Atom PDF