Bug #1884

GModelSpatialComposite not working in binned mode

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

Status:ClosedStart date:11/24/2016
Priority:NormalDue date:
Assigned To:Tiziani Domenico% Done:

100%

Category:-
Target version:1.2.0
Duration:

Description

Hi,
I encountered the problem that for binned analysis, ctlike is not working when using a GModelSpatialComposite in the analysis.
Also, same problem when trying to run ctmodel in binned mode.
In both cases, error output is only:
Segmentation fault
Nothing more.
For unbinned analysis, it is working!
I don’t know the details, but there was also something changed for the IRFs for the implementation of the composite models.
Maybe there was something forgotten for the binned analysis mode?
The error should be easily produceable for everyone, I just took the model from the test-suite and tried to run an binned analysis.
I had a first quick look with Domenico, but so far we didn’t see where the problem is.

pipeline_unbinned_mem.py Magnifier (3.63 KB) Ziegler Alexander, 11/25/2016 07:30 AM

pipeline_stacked_mem.py Magnifier (5.74 KB) Ziegler Alexander, 11/25/2016 07:30 AM


Recurrence

No recurrence.

History

#1 Updated by Mayer Michael over 7 years ago

Could you post a short script or command sequence to reproduce this error, too?

#2 Updated by Ziegler Alexander over 7 years ago

The way I did it:
Take 4 test-runs (I took the four crab runs we always use for testing), command sequence:
csiactobs
ctselect
run unbinned analysis, works
ctbin
ctexpcube, ctpsfcube, ctbkgcube
run binned analysis: not working, seg-fault.
Also trying to run ctmodel with the cubes as input is not working, also seg-fault.
This should really be easy to reproduce. If you need more infos/cannot reproduce the problem I can give you more input (we need to continue this tomorrow, for today I’m out of time, sorry)...

#3 Updated by Ziegler Alexander over 7 years ago

Example scripts that show the problem:
I just copied the pipeline example scripts from the ctools example folder and exchanged the standard model (crab.xml) with the spatial composite model.
Same result: unbinned analysis works, stacked analysis crashes with seg-fault, not more error output.
Scripts can be found attached:
pipeline_unbinned_mem.py
pipeline_stacked_mem.py

#4 Updated by Tiziani Domenico over 7 years ago

Alexander and me located the bug. Its the srcsource typo in the GCTAResponseCube class.
I will post a pull request in a few minutes.

#5 Updated by Tiziani Domenico over 7 years ago

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

The fix is implemented in the branch 1884-bug-fix in my gammalib repo.

We think about making the scale attribute an actual parameter of the model. This way, it could be fitted, too. At the moment it is an attribute of the model, and can not be fitted.
Michael, do you see a problem here?
Just changing the array type to GModelPar of the scale array, and adding it to the m_pars array should do the job, and make the model much more flexibel.
Like this, the relative amplitudes of the model components is also fitted (Which should be the case).

#6 Updated by Mayer Michael over 7 years ago

Thanks for finding the bug:)
I see your point of making the scale parameter a parameter for the fit. However, I guess when fitting the spectrum of the source at the same time, you would have a strong degeneracy with the source flux, right? This could then very much complicate the fit procedure. Maybe I am mistaken and this isn’t an issue?

#7 Updated by Ziegler Alexander over 7 years ago

I’m not sure about that - the spatial model = spatial probability density function is normalized by the scale values. So there should not be a degeneracy to the total flux, it is just a question how the individual components contribute to the source flux, no?
So if a specific flux value is required, the question is just how to distribute this value among the different components appropriately.
And the fit will only give a reasonable results if you allow a different contribution to the total flux from the individual components, otherwise this is a strong constraint, no? - I think one can only get a rough guess on this parameter when being used as input, not fitted.

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

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

Tiziani Domenico wrote:

The fix is implemented in the branch 1884-bug-fix in my gammalib repo.

Merged into devel.

Also available in: Atom PDF