From 1cd2b065ceb63f35ee3fe7cdfaa62156ce210406 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 23 Jun 2016 16:41:21 +0200 Subject: [PATCH] Remove old example folders --- examples/cpp/createfits/Makefile.am | 13 ------------- examples/cpp/createfits/createfits.cpp | 74 -------------------------------------------------------------------------- examples/cpp/createskymap/createskymap.cpp | 69 --------------------------------------------------------------------- examples/cpp/createxml/Makefile | 7 ------- examples/cpp/createxml/createxml.cpp | 81 --------------------------------------------------------------------------------- examples/cpp/interpolate/Makefile | 7 ------- examples/cpp/interpolate/interpolate.cpp | 55 ------------------------------------------------------- examples/cpp/numerics/Makefile | 7 ------- examples/cpp/numerics/numerics.cpp | 79 ------------------------------------------------------------------------------- examples/cpp/optimize/Makefile | 7 ------- examples/cpp/optimize/optimize.cpp | 91 ------------------------------------------------------------------------------------------- examples/cpp/readmodel/Makefile | 7 ------- examples/cpp/readmodel/readmodel.cpp | 40 ---------------------------------------- examples/cpp/readmodel/source.xml | 14 -------------- 14 files changed, 0 insertions(+), 551 deletions(-) delete mode 100644 examples/cpp/createfits/Makefile.am delete mode 100644 examples/cpp/createfits/createfits.cpp delete mode 100644 examples/cpp/createskymap/createskymap.cpp delete mode 100644 examples/cpp/createxml/Makefile delete mode 100644 examples/cpp/createxml/createxml.cpp delete mode 100644 examples/cpp/interpolate/Makefile delete mode 100644 examples/cpp/interpolate/interpolate.cpp delete mode 100644 examples/cpp/numerics/Makefile delete mode 100644 examples/cpp/numerics/numerics.cpp delete mode 100644 examples/cpp/optimize/Makefile delete mode 100644 examples/cpp/optimize/optimize.cpp delete mode 100644 examples/cpp/readmodel/Makefile delete mode 100644 examples/cpp/readmodel/readmodel.cpp delete mode 100644 examples/cpp/readmodel/source.xml diff --git a/examples/cpp/createfits/Makefile.am b/examples/cpp/createfits/Makefile.am deleted file mode 100644 index e93fd4d..0000000 --- a/examples/cpp/createfits/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this file with automake to produce Makefile.in - -INCLUDES = -I$(top_srcdir)/include - -# Program name -bin_PROGRAMS = createfits - -# Program definition -createfits_SOURCES = createfits.cpp -createfits_LDFLAGS = @LDFLAGS@ -createfits_CPPFLAGS = @CPPFLAGS@ -createfits_LDADD = $(top_srcdir)/src/libgamma.la - diff --git a/examples/cpp/createfits/createfits.cpp b/examples/cpp/createfits/createfits.cpp deleted file mode 100644 index 92a2c54..0000000 --- a/examples/cpp/createfits/createfits.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * createfits.cpp - Create FITS file * - * ----------------------------------------------------------------------- * - * copyright (C) 2013 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file createfits.cpp - * @brief Create FITS file - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Create FITS file - * - * This code illustrates the creation of a FITS file. - ***************************************************************************/ -int main(void) { - - // Allocate FITS object - GFits fits; - - // Create FITS image - GFitsImageDouble image(20,10); - for (int x = 0; x < 20; ++x) { - for (int y = 0; y < 10; ++y) { - image(x,y) = x+100.0*y; - } - } - - // Append image to FITS object - fits.append(image); - - // Create binary table - GFitsBinTable table; - GFitsTableDoubleCol column("ENERGY", 10, 3); - for (int row = 0; row < 10; ++row) { - for (int index = 0; index < 3; ++index) { - column(row, index) = row*100.0+index; - } - } - table.append(column); - - // Append table to FITS object - fits.append(table); - - // Save file to disk - fits.saveto("my_fits_file.fits", true); - - // Close FITS object - fits.close(); - - // Exit - return 0; -} - diff --git a/examples/cpp/createskymap/createskymap.cpp b/examples/cpp/createskymap/createskymap.cpp deleted file mode 100644 index 90a25be..0000000 --- a/examples/cpp/createskymap/createskymap.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * createskymap.cpp - Create sky map * - * ----------------------------------------------------------------------- * - * copyright (C) 2013-2015 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file createskymap.cpp - * @brief Create sky map - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Create sky map - * - * This code illustrates the creation of a sky map. - ***************************************************************************/ -int main(void) { - - // Create a SNR shell model. The shell is centred on RA=0.3 deg and - // Dec=0.1 deg. The shell has an inner radius of 0.5 deg and a width - // of 0.1 deg. - GSkyDir centre; - centre.radec_deg(0.3, 0.1); - GModelSpatialRadialShell model(centre, 0.5, 0.1); - - // Create an empty sky map in celestial coordinates using a cartesian - // projection. The image is centred on RA=Dec=0, has a bin size of - // 0.01 degrees and 300 pixels in RA and Dec - double ra(0.0); - double dec(0.0); - double binsz(0.01); - int npix(300); - GSkyMap image("CAR", "CEL", ra, dec, -binsz, binsz, npix, npix, 1); - - // Fill the sky map with the model image - GEnergy energy; // Dummy (not relevant as model is not energy dependent) - GTime time; // Dummy (not relevant as model is not time dependent) - for (int index = 0; index < image.npix(); ++index) { - GSkyDir dir = image.inx2dir(index); // sky coordinate of pixel - double theta = centre.dist(dir); // distance in radians - image(index) = model.eval(theta, energy, time); - } - - // Save the image to a FITS file - image.save("my_sky_map.fits", true); - - // Exit - return 0; -} - diff --git a/examples/cpp/createxml/Makefile b/examples/cpp/createxml/Makefile deleted file mode 100644 index 578c75a..0000000 --- a/examples/cpp/createxml/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM=createxml -OBJ=createxml.cpp -CFLAGS=`pkg-config --cflags gammalib` -LDFLAGS=`pkg-config --libs gammalib` - -$(PROGRAM): $(OBJ) - $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/examples/cpp/createxml/createxml.cpp b/examples/cpp/createxml/createxml.cpp deleted file mode 100644 index b360b33..0000000 --- a/examples/cpp/createxml/createxml.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * createxml.cpp - Create XML file * - * ----------------------------------------------------------------------- * - * copyright (C) 2013 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file createxml.cpp - * @brief Create XML file - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Create XML file - * - * This code illustrates the creation of a XML file. - ***************************************************************************/ -int main(void) { - - // Allocate XML object - GXml xml; - - // Create base elements - GXmlComment comment("Now 2 nodes with spatial and spectral info"); - GXmlElement spatial("spatial type=\"Position\""); - GXmlElement spectral("spectrum type=\"PowerLaw\""); - GXmlElement text("text"); - GXmlPI pi(""); - - // Append spatial parameters - spatial.append(GXmlElement("parameter ra=\"83.0\"")); - spatial.append(GXmlElement("parameter dec=\"22.0\"")); - - // Append spectral parameters - spectral.append(GXmlElement("parameter prefactor=\"1e-7\"")); - spectral.append(GXmlElement("parameter index=\"-2.1\"")); - - // Append text - text.append(GXmlText("Finish with text")); - - // Append elements - xml.append(comment); - xml.append(spatial); - xml.append(spectral); - xml.append(text); - xml.append(pi); - - // Manipulate source element - xml.element("spatial", 0)->append(GXmlElement("parameter ra=\"83.0\"")); - xml.element("spatial", 0)->append(GXmlElement("parameter dec=\"22.0\"")); - - // Show alternative access - GXmlNode* node = xml.append(spatial); - node->append(GXmlElement("parameter ra=\"83.0\"")); - node->append(GXmlElement("parameter dec=\"22.0\"")); - - // Save XML document to file - xml.save("my_xml_file.xml"); - - // Exit - return 0; -} - diff --git a/examples/cpp/interpolate/Makefile b/examples/cpp/interpolate/Makefile deleted file mode 100644 index ae2f12a..0000000 --- a/examples/cpp/interpolate/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM=interpolate -OBJ=interpolate.cpp -CFLAGS=`pkg-config --cflags gammalib` -LDFLAGS=`pkg-config --libs gammalib` - -$(PROGRAM): $(OBJ) - $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/examples/cpp/interpolate/interpolate.cpp b/examples/cpp/interpolate/interpolate.cpp deleted file mode 100644 index ce6a176..0000000 --- a/examples/cpp/interpolate/interpolate.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * interpolate.cpp - Illustrates interpolation * - * ----------------------------------------------------------------------- * - * copyright (C) 2013 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file interpolate.cpp - * @brief Illustrates interpolation - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Interpolation between nodes - * - * This code illustrates the interpolation between nodes. - ***************************************************************************/ -int main(void) { - - // Create some nodes - double x_i[] = {1.0, 4.0, 6.0}; - double y_i[] = {8.0, 7.0, 2.0}; - - // Create node array from x_i values - GNodeArray nodes(3, x_i); - - // Get interpolated values - for (double x = 0; x < 10.0; x += 0.5) { - nodes.set_value(x); - double y = y_i[nodes.inx_left()] * nodes.wgt_left() + - y_i[nodes.inx_right()] * nodes.wgt_right(); - std::cout << "x=" << x << " : y=" << y << std::endl; - } - - // Exit - return 0; -} diff --git a/examples/cpp/numerics/Makefile b/examples/cpp/numerics/Makefile deleted file mode 100644 index 0867770..0000000 --- a/examples/cpp/numerics/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM=numerics -OBJ=numerics.cpp -CFLAGS=`pkg-config --cflags gammalib` -LDFLAGS=`pkg-config --libs gammalib` - -$(PROGRAM): $(OBJ) - $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/examples/cpp/numerics/numerics.cpp b/examples/cpp/numerics/numerics.cpp deleted file mode 100644 index d5df00f..0000000 --- a/examples/cpp/numerics/numerics.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * numerics.cpp - Illustrates numerical class usage * - * ----------------------------------------------------------------------- * - * copyright (C) 2013-2014 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file numerics.cpp - * @brief Illustrates numerical class usage - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Gaussian function - * - * This code illustrates the definition of a Gaussian function. - ***************************************************************************/ -class function : public GFunction { -public: - function(const double& sigma) : m_a(1.0/(sigma*std::sqrt(gammalib::twopi))), - m_sigma(sigma) {} - double eval(const double& x) { return m_a*std::exp(-0.5*x*x/(m_sigma*m_sigma)); } -protected: - double m_a; //!< Amplitude parameter - double m_sigma; //!< Width parameter -}; - - -/***********************************************************************//** - * @brief Integrate function - * - * This code illustrates the integration of a function. - ***************************************************************************/ -int main(void) { - - // Create instance of function - function fct(3.0); - - // Create an integral object based on the function - GIntegral integral(&fct); - - // Set relative integration precision - integral.eps(1.0e-8); - - // Integrate over the interval [-10,10] - double result = integral.romberg(-15.0, +15.0); - - // Print result (should be basically 1) - std::cout << "Integral: " << result << std::endl; - - // Create a derivative object based on the function - GDerivative derivative(&fct); - - // Print derivatives - std::cout << "Derivative(0): " << derivative.value(0.0) << std::endl; - std::cout << "Derivative(3): " << derivative.value(3.0) << std::endl; - std::cout << "Derivative(-3): " << derivative.value(-3.0) << std::endl; - - // Exit - return 0; -} diff --git a/examples/cpp/optimize/Makefile b/examples/cpp/optimize/Makefile deleted file mode 100644 index 4e99ccc..0000000 --- a/examples/cpp/optimize/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM=optimize -OBJ=optimize.cpp -CFLAGS=`pkg-config --cflags gammalib` -LDFLAGS=`pkg-config --libs gammalib` - -$(PROGRAM): $(OBJ) - $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/examples/cpp/optimize/optimize.cpp b/examples/cpp/optimize/optimize.cpp deleted file mode 100644 index 7a432a9..0000000 --- a/examples/cpp/optimize/optimize.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * optimize.cpp - Illustrates optimizer class usage * - * ----------------------------------------------------------------------- * - * copyright (C) 2013-2014 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file optimize.cpp - * @brief Illustrates optimizer class usage - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Parabola function - * - * This code illustrates the definition of a parabola function. - ***************************************************************************/ -class parabola : public GOptimizerFunction { -public: - parabola(void) : m_value(0), m_gradient(1), m_curvature(1,1) {} - void eval(const GOptimizerPars& pars); - double value(void) const { return m_value; } - GVector* gradient(void) { return &m_gradient; } - GMatrixSparse* curvature(void) { return &m_curvature; } -protected: - double m_value; //!< Function value - GVector m_gradient; //!< Function gradient vector - GMatrixSparse m_curvature; //!< Curvature matrix -}; -void parabola::eval(const GOptimizerPars& pars) -{ - const double a = 2.0; - const double b = -4.0; - const double c = 2.0; - double x = pars[0]->value(); - m_value = a*x*x + b*x + c; - m_gradient[0] = 2.0*a*x + b; - m_curvature(0,0) = m_gradient[0] * m_gradient[0]; -}; - - -/***********************************************************************//** - * @brief Optimize function - * - * This code illustrates the optimization of a function. - ***************************************************************************/ -int main(void) { - - // Allocate logger - GLog log; - log.cout(true); - - // Allocate optimizer - //GOptimizerLM opt(log); - GOptimizerLM opt; - - // Allocate function - parabola fct; - - // Allocate parameters and set initial value - GOptimizerPars pars(1); - pars[0]->value(1.5); - - // Optimize parameters - opt.optimize(fct, pars); - - // Print derivatives - std::cout << "Function value .....: " << fct.value() << std::endl; - std::cout << "Parameter value ....: " << pars[0]->value() << std::endl; - - // Exit - return 0; -} diff --git a/examples/cpp/readmodel/Makefile b/examples/cpp/readmodel/Makefile deleted file mode 100644 index 29aa702..0000000 --- a/examples/cpp/readmodel/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -PROGRAM=readmodel -OBJ=readmodel.cpp -CFLAGS=`pkg-config --cflags gammalib` -LDFLAGS=`pkg-config --libs gammalib` - -$(PROGRAM): $(OBJ) - $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS) \ No newline at end of file diff --git a/examples/cpp/readmodel/readmodel.cpp b/examples/cpp/readmodel/readmodel.cpp deleted file mode 100644 index 98d6fbe..0000000 --- a/examples/cpp/readmodel/readmodel.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * readmodel.cpp - Illustrates how to read a model * - * ----------------------------------------------------------------------- * - * copyright (C) 2013 by Juergen Knoedlseder * - * ----------------------------------------------------------------------- * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - * * - ***************************************************************************/ -/** - * @file readmodel.cpp - * @brief Illustrates how to read a model - * @author Juergen Knoedlseder - */ - -/* __ Includes ___________________________________________________________ */ -#include -#include "GammaLib.hpp" - - -/***********************************************************************//** - * @brief Dummy read model test - ***************************************************************************/ -int main(void) { - GModels models("source.xml"); - std::cout << models << std::endl; - return 0; -} - diff --git a/examples/cpp/readmodel/source.xml b/examples/cpp/readmodel/source.xml deleted file mode 100644 index 1b2e7a3..0000000 --- a/examples/cpp/readmodel/source.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - -- libgit2 0.21.4