Action #3536

Check performance of csresmap and csrespec

Added by Tibaldo Luigi almost 2 years ago. Updated 8 months ago.

Status:In ProgressStart date:02/04/2021
Priority:NormalDue date:
Assigned To:Tibaldo Luigi% Done:


Target version:-


These tools have become really slow: calculating residuals takes much longer than performing likelihood fits in some cases. We should check where the bottlenecks are, whether they can be sped up etc


No recurrence.


#1 Updated by Knödlseder Jürgen almost 2 years ago

Can you generate some test cases that we can use as a reference for the speed-up? It is not clear what could have made these tools slower, or is it the likelihood fits that became faster?

#2 Updated by Tibaldo Luigi almost 2 years ago

  • Status changed from New to In Progress

I investigated a bit the issue, and I think I understood what was happening in the cases that were reported.
This happens for unbinned analyses. It it actually the binning of the events and computation of the binned model (with evaluation of stacked response on the fly) in csresmap and csrespec that makes it more time-consuming that the unbinned fit (especially for few events).
I guess that for a one-shot usage this is just unavoidable. However, it’s annoying for someone that does iterative model adjustment and residual check because at every iteration you spend time redoing over and over the binning and stacked model response calculation.
We could modify the tools so that internally the count cubes and stacked response are kept in memory and not recalculated each time the tool is run. Another simpler approach would be to add warnings/examples to the documentation in the two cscripts reference manuals, in the basic tutorials, and in the tutorial on advanced model manipulation and fitting (where it is actually done in the suboptimal way that makes you recalculate binned events and response each time)

#3 Updated by Tibaldo Luigi almost 2 years ago

  • Assigned To set to Tibaldo Luigi

Second solution (update documentation) preferred also because it will fix the issue also for people using the tools from the command line.

#4 Updated by Knödlseder Jürgen 8 months ago

  • Target version deleted (2.0.0)

Also available in: Atom PDF