TypeError: in method 'GCTAOnOffObservation_likelihood', argument 5 of type 'double *'
|Assigned To:||Knödlseder Jürgen||% Done:|
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.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!
#1 Updated by Knödlseder Jürgen over 5 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
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.likelihood(fit_models, gradient, curvature, npred) print(npred)