Skip to content
Snippets Groups Projects
Commit 5247f02f authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Resolve "Installing Jppy does not work on my MacOS system"

parent 887de5fe
No related branches found
No related tags found
1 merge request!8Resolve "Installing Jppy does not work on my MacOS system"
#!/usr/bin/env bash
export URL="http://sftp.km3net.de/data/latest/"
export URL="https://sftp.km3net.de/data/v17.0.0/"
if [ ! -d "pdfs" ]; then
echo "Retrieving PDFs..."
mkdir pdfs
......
......@@ -8,22 +8,30 @@
* \author mdejong
*/
namespace std {
template<class JElement_t, class JAllocator_t> class vector;
template<class JElement_t, class JComparator_t, class JAllocator_t> class set;
template<class JElement_t, class JComparator_t, class JAllocator_t> class multiset;
template<class JFirst_t, class JSecond_t> class pair;
template<class JKey_t, class JValue_t, class JComparator_t, class JAllocator_t> class map;
template<class JKey_t, class JValue_t, class JComparator_t, class JAllocator_t> class multimap;
template<class Category, class T, class Distance, class Pointer, class Reference> struct iterator;
#ifdef _GLIBCXX_USE_CXX11_ABI
inline namespace __cxx11 {
template<class JElement_t, class JAllocator_t> class list;
}
#else
template<class JElement_t, class JAllocator_t> class list;
#endif
}
#include <vector>
#include <set>
#include <utility>
#include <map>
#include <list>
#include <iterator>
// TODO: this gives an ambigous error on macOS with std::pair
// namespace std {
// template<class JElement_t, class JAllocator_t> class vector;
// template<class JElement_t, class JComparator_t, class JAllocator_t> class set;
// template<class JElement_t, class JComparator_t, class JAllocator_t> class multiset;
// template<class JFirst_t, class JSecond_t> struct pair;
// template<class JKey_t, class JValue_t, class JComparator_t, class JAllocator_t> class map;
// template<class JKey_t, class JValue_t, class JComparator_t, class JAllocator_t> class multimap;
// template<class Category, class T, class Distance, class Pointer, class Reference> struct iterator;
// #ifdef _GLIBCXX_USE_CXX11_ABI
// inline namespace __cxx11 {
// template<class JElement_t, class JAllocator_t> class list;
// }
// #else
// template<class JElement_t, class JAllocator_t> class list;
// #endif
// }
#endif
......@@ -32,7 +32,7 @@ namespace JMATH {
/**
* Power \f$x^y\f$.
* Power \f$ x^{y} \f$.
*
* \param x value
* \param y power
......@@ -54,7 +54,7 @@ namespace JMATH {
private:
/**
* Power \f$x^y\f$.
* Power \f$ x^{y} \f$.
* This method corresponds to primitive data types.
*
* \param x value
......@@ -70,8 +70,8 @@ namespace JMATH {
/**
* Power \f$x^y\f$.
* Power.
* Power \f$ x^{y} \f$.
*
* This method corresponds to non-primitive data types.
*
* \param x value
......@@ -88,7 +88,7 @@ namespace JMATH {
/**
* Power \f$x^y\f$.
* Power \f$ x^{y} \f$.
*
* \param x value
* \param y power
......@@ -296,7 +296,7 @@ namespace JMATH {
*/
friend T& operator*=(T& first, const T& second)
{
return first.mul(second);
return static_cast<JMath<T>&>(first).mul(second);
}
......@@ -483,7 +483,7 @@ namespace JMATH {
* Template definition so that compiler error is generated if implementation is missing (see JEigen3D.hh).
*/
template<>
class JAverage<JGEOMETRY3D::JQuaternion3D>;
struct JAverage<JGEOMETRY3D::JQuaternion3D>;
/**
......
......@@ -7,16 +7,16 @@ class TestMuonPDF(unittest.TestCase):
def test_pdf(self):
muon_pdf = jppy.pdf.JMuonPDF(PDFS, 0)
result = muon_pdf.calculate(10, 5, 0, 0, 23)
self.assertAlmostEqual(0.001545692, result.f)
self.assertAlmostEqual(-1.220889709e-05, result.fp)
self.assertAlmostEqual(0.022764524, result.v)
self.assertAlmostEqual(0.115814468, result.V)
self.assertAlmostEqual(0.00067762789, result.f)
self.assertAlmostEqual(-1.9661888268460384e-05, result.fp)
self.assertAlmostEqual(0.01374949305, result.v)
self.assertAlmostEqual(0.053314508, result.V)
class TestShowerPDF(unittest.TestCase):
def test_pdf(self):
shower_pdf = jppy.pdf.JShowerPDF(PDFS, 0)
result = shower_pdf.calculate(100, 10, 0.1, 0.2, 0.3, 6)
self.assertAlmostEqual(0.001383343, result.f)
self.assertAlmostEqual(5.091930537e-05, result.fp)
self.assertAlmostEqual(0.010475308, result.v)
self.assertAlmostEqual(0.149635554, result.V)
self.assertAlmostEqual(0.0013937540, result.f)
self.assertAlmostEqual(5.1614638414144165e-05, result.fp)
self.assertAlmostEqual(0.01054815545, result.v)
self.assertAlmostEqual(0.150554603, result.V)
......@@ -8,20 +8,17 @@ class TestMuonPDFEvaluator(unittest.TestCase):
E, t0, t_obs, D, cd, theta, phi = [1e3, 56, 292, 50, 0.7, 1.57, 3.14]
muon_pdf = jppy.pdf_evaluator.MuonPDF(PDFS, E, t0)
result = muon_pdf.evaluate(D, cd, theta, phi, t_obs)
self.assertAlmostEqual( 0.003644475, result.f)
self.assertAlmostEqual(-0.000715558, result.fp)
self.assertAlmostEqual( 0.033748905, result.v)
self.assertAlmostEqual( 0.097171157, result.V)
self.assertAlmostEqual( 0.00388579021, result.f)
self.assertAlmostEqual(-0.000739757, result.fp)
self.assertAlmostEqual(0.035047945, result.v)
self.assertAlmostEqual(0.09606971431, result.V)
class TestShowerPDFEvaluator(unittest.TestCase):
def test_pdf_evaluator(self):
E, t0, t_obs, D, cd, theta, phi = [50, 198, 226, 5, 0.6, 0.5, 0.4]
shower_pdf = jppy.pdf_evaluator.ShowerPDF(PDFS, E, t0)
result = shower_pdf.evaluate(D, cd, theta, phi, t_obs)
self.assertAlmostEqual(0.006204617, result.f)
self.assertAlmostEqual(0.000641669, result.fp)
self.assertAlmostEqual(0.013960066, result.v)
self.assertAlmostEqual(0.296589983, result.V)
self.assertAlmostEqual(0.006247665, result.f)
self.assertAlmostEqual(0.0006429129, result.fp)
self.assertAlmostEqual(0.01406847423, result.v)
self.assertAlmostEqual(0.297769976, result.V)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment