Commit 45aa9be7a807201d8912e9d596db8d2adcd81dad

Authored by Jürgen Knödlseder
1 parent 045c40f4

Make GModelSpatialRadialProfile::eval() available in Python.

pyext/GModelSpatialRadialProfile.i
... ... @@ -70,3 +70,22 @@ public:
70 70 int num_nodes(void) const;
71 71 void num_nodes(const int& number);
72 72 };
  73 +
  74 +
  75 +/***********************************************************************//**
  76 + * @brief GModelSpatialRadialProfile class extension
  77 + *
  78 + * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the
  79 + * extension to force swig to build also the interface for these methods that
  80 + * are implemented in the base class only. It's not clear to me why these
  81 + * methods are not inherited automatically. Maybe this could also be handled
  82 + * by a %typemap(typecheck) construct.
  83 + ***************************************************************************/
  84 +%extend GModelSpatialRadialProfile {
  85 + double eval(const GPhoton& photon) const {
  86 + return self->GModelSpatialRadial::eval(photon);
  87 + }
  88 + double eval_gradients(const GPhoton& photon) const {
  89 + return self->GModelSpatialRadial::eval_gradients(photon);
  90 + }
  91 +};
... ...
pyext/GModelSpatialRadialProfileGauss.i
... ... @@ -58,19 +58,10 @@ public:
58 58  
59 59  
60 60 /***********************************************************************//**
61   - * @brief GModelSpatialRadialGauss class extension
62   - *
63   - * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the
64   - * extension to force swig to build also the interface for these methods that
65   - * are implemented in the base class only. It's not clear to me why these
66   - * methods are not inherited automatically. Maybe this could also be handled
67   - * by a %typemap(typecheck) construct.
  61 + * @brief GModelSpatialRadialProfileGauss class extension
68 62 ***************************************************************************/
69 63 %extend GModelSpatialRadialProfileGauss {
70   - double eval(const GPhoton& photon) const {
71   - return self->GModelSpatialRadial::eval(photon);
72   - }
73   - double eval_gradients(const GPhoton& photon) const {
74   - return self->GModelSpatialRadial::eval_gradients(photon);
  64 + GModelSpatialRadialProfileGauss copy() {
  65 + return (*self);
75 66 }
76 67 };
... ...