Commit 16af5d95979147b3f0632032401994175939ca07

Authored by Jürgen Knödlseder
1 parent b33b0f65

Add Python typemaps for GObservation::likelihood() output argument (#2126)

ChangeLog
... ... @@ -7,6 +7,7 @@
7 7 Write response information into simulated observation definition file (#2170)
8 8 Normalise phase curves by default (#2154, #2172)
9 9 Support Python list slicing for container classes (#2128)
  10 + Add Python typemaps for GObservation::likelihood() output argument (#2126)
10 11 Add GSkyRegions::overlaps() and GSkyMap::overlaps() classes (#1980)
11 12  
12 13  
... ...
1 1 New Features and Important Changes in GammaLib 1.4.0
2 2  
3   -27 July 2017
  3 +28 July 2017
4 4  
5 5  
6 6 1. Introduction
... ...
doc/source/admin/release_history/1.4.rst
... ... @@ -16,6 +16,9 @@ In particular, this release provides:
16 16 Bug fixes
17 17 ---------
18 18  
  19 +* [`2126 <https://cta-redmine.irap.omp.eu/issues/2126>`_] -
  20 + Add Python typemaps for ``GObservation::likelihood()`` output argument
  21 +
19 22  
20 23 Improvements
21 24 ------------
... ... @@ -37,6 +40,5 @@ New features
37 40 Support Python list slicing for container classes
38 41  
39 42  
40   -
41 43 Clean up
42 44 --------
... ...
inst/cta/pyext/GCTAOnOffObservation.i
... ... @@ -53,6 +53,19 @@
53 53 }
54 54  
55 55  
  56 +/*
  57 + * Convert double output argument from and into a Python float object. This
  58 + * typemap is needed for the likelihood() method.
  59 + */
  60 +%typemap(in) double *npred (double temp) {
  61 + temp = PyFloat_AsDouble($input);
  62 + $1 = &temp;
  63 +}
  64 +%typemap(argout) double *npred {
  65 + $result = PyFloat_FromDouble(*$1);
  66 +}
  67 +
  68 +
56 69 /***********************************************************************//**
57 70 * @class GCTAOnOffObservation
58 71 *
... ...
pyext/GObservation.i
... ... @@ -32,6 +32,19 @@
32 32 #include "GTools.hpp"
33 33 %}
34 34  
  35 +/* __ Typemaps ___________________________________________________________ */
  36 +/*
  37 + * Convert double output argument from and into a Python float object. This
  38 + * typemap is needed for the likelihood() method.
  39 + */
  40 +%typemap(in) double *npred (double temp) {
  41 + temp = PyFloat_AsDouble($input);
  42 + $1 = &temp;
  43 +}
  44 +%typemap(argout) double *npred {
  45 + $result = PyFloat_FromDouble(*$1);
  46 +}
  47 +
35 48  
36 49 /***********************************************************************//**
37 50 * @class GObservation
... ...