Feature #2714

Implement a convenient way to perform a joint binned analysis

Added by Tiziani Domenico about 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:11/05/2018
Priority:NormalDue date:
Assigned To:Tiziani Domenico% Done:

100%

Category:-
Target version:1.6.0
Duration:

Description

Right now there is no tool that enables the user to bin events of multiple observations into separate counts cubes to perform a joint analysis.
Also a corresponding observations XML file that references to different counts cubes can not be produced in an automatic may.


Recurrence

No recurrence.

History

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

Would it be sufficient to add a parameter stack to ctbin that by default is set to yes, so that running ctbin with stack=no would create a counts cube per observation, and would produce an XML file on output?

#2 Updated by Tiziani Domenico about 6 years ago

Yes, this should do it.

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

I would propose then to go this way. We should also add a prefix parameter, like in ctselect, to prefix the resulting counts cubes.

You may check commit #28b601b2 for ctbin where I removed the prefix parameter. The earlier commit #db226c73 still contains code to save individual cubes and to write out an XML file. You can probably port some of this code back into the code base.

#4 Updated by Tiziani Domenico about 6 years ago

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

A first working solution is implemented in https://cta-gitlab.irap.omp.eu/dtiziani/ctools/tree/2714-joint-binned

I use the value of the parameter outcube for the filename of the output observation definition XML file if stack=no.
Maybe this is misleading and the parameter name should be changed? Or should we introduce a new parameter for that?

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

  • Status changed from Pull request to Feedback
  • % Done changed from 80 to 100

I integrated your code and it’s now merged into the devel branch.

I changed the outcube parameter to outobs.

I also did some minor adaptions in the code. For example the presence of a cache for sky directions, which was added by Josh to speed-up computations, posed a problem in the modified code. The cache is now only used for stacking, while on-the-fly computation is used for multiple counts cubes. Also, each counts cube may have a different centre, which can be enabled by the usepnt=yes parameter. Typically you want to do this when you make a joint binned analysis. I modified the code so that this also works. Finally, I used slot 0 of the arrays to store the stacked counts cube, avoiding having separate data members for that case.

I also changed a bit the construction of the filename for multiple counts cubes. An identifier is only unique for a given instrument, but you could imagine having a H.E.S.S. and a CTA observation in the same observation definition file with the same identifier, hence I added the instrument name to the filename. I also converted all blanks into underscores, since it is allowed to have blanks in an identifier, but they may not work well on all filesystems.

I also added a cubes() method that returns the number of counts cubes that can be accessed through the cube() method. There is just a single cube() method now with a default argument of zero, hence it can be used like before, but also with an index.

You may check if everything works satisfactory on your side, so that we can close the issue at the end of the sprint.

#6 Updated by Tiziani Domenico about 6 years ago

When the resulting observation of ctbin called with stack=no is used as input to ctmodel, right now all binned observations are skipped.
Maybe we should give the user the choice if ctmodel should create one common model cube or one for each input observation.

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

Tiziani Domenico wrote:

When the resulting observation of ctbin called with stack=no is used as input to ctmodel, right now all binned observations are skipped.
Maybe we should give the user the choice if ctmodel should create one common model cube or one for each input observation.

We should make this a specific issue. If everything works for the ctbin tool I would propose to close this issue now.

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

  • Status changed from Feedback to Closed

Also available in: Atom PDF