Bug #2126

TypeError: in method 'GCTAOnOffObservation_likelihood', argument 5 of type 'double *'

Added by Rodriguez Fernandez Gonzalo over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:06/16/2017
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.4.0
Duration:

Description

Dear all,

I am testing the ON & OFF CTA observation.
The fit goes well, but when I just try to obtain the likelihood value using:

fit_models = onoff_container.models()
gradient  = gammalib.GVector()
curvature = gammalib.GMatrixSparse()
npred = []
value = onoff_container[0].likelihood(fit_models, gradient, curvature, npred)

I get this error:
TypeError: in method 'GCTAOnOffObservation_likelihood’, argument 5 of type 'double *'

I have tried differents options to pass the npred variable, but I always get this error message.

I send you the python script with the xml files to reproduce the error msg.

Thanks in advanced!
Gonzalo.

sim_model.xml Magnifier (1.4 KB) Rodriguez Fernandez Gonzalo, 06/16/2017 10:53 AM

crab.xml Magnifier (1.13 KB) Rodriguez Fernandez Gonzalo, 06/16/2017 10:55 AM

sim_and_analisys.py Magnifier (2.22 KB) Rodriguez Fernandez Gonzalo, 06/16/2017 10:55 AM


Recurrence

No recurrence.

History

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

  • Status changed from New to Feedback
  • Assigned To set to Knödlseder Jürgen
  • Target version set to 1.4.0
  • % Done changed from 0 to 90

There was a Python typemap missing in the SWIG interface that prevented the acceptance of a Python float as an argument. I added the missing typemap and merged the change into the devel branch.

Note, however, that the method expects a single variable and not an array. Here is the code that works fine on my side:

    fit_models = onoff_container.models()
    gradient  = gammalib.GVector()
    curvature = gammalib.GMatrixSparse()
    npred = 0.0
    value = onoff_container[0].likelihood(fit_models, gradient, curvature, npred)
    print(npred)

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

  • Tracker changed from Support to Bug

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

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF