Action #1862

Improve ctbutterfly

Added by Ziegler Alexander about 8 years ago. Updated over 7 years ago.

Status:ClosedStart date:10/04/2016
Priority:NormalDue date:
Assigned To:Ziegler Alexander% Done:

100%

Category:-
Target version:1.3.0
Duration:

Description

At the moment ctbutterfly only supports pure power law model.
Aim is to make it available for arbitrary spectral model types.

comp.png (35.8 KB) Ziegler Alexander, 04/04/2017 06:29 PM

diff.png (30.4 KB) Ziegler Alexander, 04/04/2017 06:30 PM

Slide1.png (148 KB) Ziegler Alexander, 04/05/2017 02:49 PM

ecpl_logp.png (93.2 KB) Ziegler Alexander, 04/05/2017 03:41 PM

Comp Diff Slide1 Ecpl_logp

Recurrence

No recurrence.

History

#1 Updated by Ziegler Alexander over 7 years ago

  • % Done changed from 0 to 60

As discussed at the coding sprint, I started to implement as alternative mode to use gaussian error propagation for calculating the butterfly.
Now, there is a flag to switch to this alternative calculation scheme: ctbutterfly debug=yes gepmode=yes (gepmode = gaussian error propagation mode).
Default value is gepmode=no and will not be updated.
First comparison to the already implemented method (take envelope of the error ellipse for power law) yields only very small differences at a level of about 1 percent, simulating with the model $CTOOLS/../ctools/models/crab.xml, using observation time of 1800 seconds.
Needs a few more checks and documentation.

#2 Updated by Ziegler Alexander over 7 years ago

Here are the plots from the first check (red and green: the different computation methods, bottom plot shows the relative difference of the butterfly boundaries)

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

Ziegler Alexander wrote:

As discussed at the coding sprint, I started to implement as alternative mode to use gaussian error propagation for calculating the butterfly.
Now, there is a flag to switch to this alternative calculation scheme: ctbutterfly debug=yes gepmode=yes (gepmode = gaussian error propagation mode).
Default value is gepmode=no and will not be updated.

I was wondering whether we should not invert the logic, since the Gaussian error propagation is more general, though eventually less accurate. Default would be Gaussian error propagation, and only if a user specifies the “envelope” method the code would switch to the error ellipse envelope method.

To take provision for further evolution, we could have a method string parameter instead of the a bit cryptic gepmode parameter, which by default would be GAUSSIAN and alternatively could be ENVELOPE. This would allow for implementing different methods in the futur. The parameter description would then be

method, s, h, GAUSSIAN, GAUSSIAN|ENVELOPE,,"Butterfly computation method" 

First comparison to the already implemented method (take envelope of the error ellipse for power law) yields only very small differences at a level of about 1 percent, simulating with the model $CTOOLS/../ctools/models/crab.xml, using observation time of 1800 seconds.
Needs a few more checks and documentation.

Great ! If the changes are so small it’s a further argument for using that method as default.

#4 Updated by Ziegler Alexander over 7 years ago

  • File overview.pdf added
  • % Done changed from 60 to 80

Update:

  • method, s, h, GAUSSIAN, GAUSSIAN|ENVELOPE,,"Butterfly computation method"
    → implemented, however internally it just steers the flag m_gepmode, which is evaluates to true if method string = Gaussian. Thus the default mode is gaussian error propagation now.
  • changed the computation of scaling factor for the ENVELOPE method. Now its calculated from a Chi2 distribution with 2dof. This should be the appropriate way to calculate it for the ellipse, and yield constant results with gep mode.
  • new comparison plots for different confidence levels, shown below. Differences are small (after all the updates).

To do:
- update debug output
- update docu
- check get mode to work for other models than pure power laws

#5 Updated by Ziegler Alexander over 7 years ago

  • File deleted (overview.pdf)

#6 Updated by Ziegler Alexander over 7 years ago

Now the new plots should be visible (68, 95, 99 conf. level comparisons)...

#7 Updated by Ziegler Alexander over 7 years ago

Progress:
- updated log output, exception message for check_model method
- test log parabola and cutoff power law butterfly computation in gep mode, check plots see below (green=68% c.l., red=99% c.l.)

#8 Updated by Tiziani Domenico over 7 years ago

  • Status changed from New to Pull request

Documentation is now also updated.
All checks we did are shown above.
The changes are implemented in aziegler/ctools 1862_butterfly.

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

  • Status changed from Pull request to Closed
  • Target version set to 1.3.0
  • % Done changed from 90 to 100
  • Remaining (hours) set to 0.0

Merged into devel.

Also available in: Atom PDF