Bug #2126
TypeError: in method 'GCTAOnOffObservation_likelihood', argument 5 of type 'double *'
Status: | Closed | Start date: | 06/16/2017 | |
---|---|---|---|---|
Priority: | Normal | Due 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.
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