From 45aa9be7a807201d8912e9d596db8d2adcd81dad Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Wed, 2 Mar 2016 15:55:47 +0100 Subject: [PATCH] Make GModelSpatialRadialProfile::eval() available in Python. --- pyext/GModelSpatialRadialProfile.i | 19 +++++++++++++++++++ pyext/GModelSpatialRadialProfileGauss.i | 15 +++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/pyext/GModelSpatialRadialProfile.i b/pyext/GModelSpatialRadialProfile.i index 5b148fd..198b40d 100644 --- a/pyext/GModelSpatialRadialProfile.i +++ b/pyext/GModelSpatialRadialProfile.i @@ -70,3 +70,22 @@ public: int num_nodes(void) const; void num_nodes(const int& number); }; + + +/***********************************************************************//** + * @brief GModelSpatialRadialProfile class extension + * + * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the + * extension to force swig to build also the interface for these methods that + * are implemented in the base class only. It's not clear to me why these + * methods are not inherited automatically. Maybe this could also be handled + * by a %typemap(typecheck) construct. + ***************************************************************************/ +%extend GModelSpatialRadialProfile { + double eval(const GPhoton& photon) const { + return self->GModelSpatialRadial::eval(photon); + } + double eval_gradients(const GPhoton& photon) const { + return self->GModelSpatialRadial::eval_gradients(photon); + } +}; diff --git a/pyext/GModelSpatialRadialProfileGauss.i b/pyext/GModelSpatialRadialProfileGauss.i index f74d61c..e3f4ba0 100644 --- a/pyext/GModelSpatialRadialProfileGauss.i +++ b/pyext/GModelSpatialRadialProfileGauss.i @@ -58,19 +58,10 @@ public: /***********************************************************************//** - * @brief GModelSpatialRadialGauss class extension - * - * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the - * extension to force swig to build also the interface for these methods that - * are implemented in the base class only. It's not clear to me why these - * methods are not inherited automatically. Maybe this could also be handled - * by a %typemap(typecheck) construct. + * @brief GModelSpatialRadialProfileGauss class extension ***************************************************************************/ %extend GModelSpatialRadialProfileGauss { - double eval(const GPhoton& photon) const { - return self->GModelSpatialRadial::eval(photon); - } - double eval_gradients(const GPhoton& photon) const { - return self->GModelSpatialRadial::eval_gradients(photon); + GModelSpatialRadialProfileGauss copy() { + return (*self); } }; -- libgit2 0.21.4