From 633de0f2432c72f6e45d405a4e1a028831739cee Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Wed, 6 Aug 2014 11:11:14 +0200
Subject: [PATCH] New methods in IAxis to get bin centers and boundaries.

---
 Core/PythonAPI/src/AngleBinAxis.pypp.cpp      | 46 +++++++++++++++++++
 Core/PythonAPI/src/AxisBin.pypp.cpp           | 46 +++++++++++++++++++
 Core/PythonAPI/src/AxisDouble.pypp.cpp        | 46 +++++++++++++++++++
 Core/PythonAPI/src/FixedBinAxis.pypp.cpp      | 46 +++++++++++++++++++
 Core/PythonAPI/src/IAxis.pypp.cpp             | 46 +++++++++++++++++++
 Core/PythonAPI/src/VariableBinAxis.pypp.cpp   | 46 +++++++++++++++++++
 Core/Tools/inc/FixedBinAxis.h                 |  4 ++
 Core/Tools/inc/IAxis.h                        | 18 ++++++--
 Core/Tools/src/FixedBinAxis.cpp               | 21 +++++++++
 Tests/FunctionalTests/TestPyCore/axes.py      | 23 +++++++++-
 .../TestPyCore/intensitydata_io.py            | 39 ++++++++++++----
 Tests/UnitTests/TestCore/FixedBinAxisTest.h   | 21 +++++++++
 12 files changed, 389 insertions(+), 13 deletions(-)

diff --git a/Core/PythonAPI/src/AngleBinAxis.pypp.cpp b/Core/PythonAPI/src/AngleBinAxis.pypp.cpp
index 252792a7960..844e9bc83b0 100644
--- a/Core/PythonAPI/src/AngleBinAxis.pypp.cpp
+++ b/Core/PythonAPI/src/AngleBinAxis.pypp.cpp
@@ -126,6 +126,30 @@ struct AngleBinAxis_wrapper : AngleBinAxis, bp::wrapper< AngleBinAxis > {
         return IAxis::createDoubleBinSize( );
     }
 
+    virtual ::std::vector< double > getBinBoundaries(  ) const  {
+        if( bp::override func_getBinBoundaries = this->get_override( "getBinBoundaries" ) )
+            return func_getBinBoundaries(  );
+        else
+            return this->IAxis::getBinBoundaries(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinBoundaries(  ) const  {
+        return IAxis::getBinBoundaries( );
+    }
+
+    virtual ::std::vector< double > getBinCenters(  ) const  {
+        if( bp::override func_getBinCenters = this->get_override( "getBinCenters" ) )
+            return func_getBinCenters(  );
+        else
+            return this->IAxis::getBinCenters(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinCenters(  ) const  {
+        return IAxis::getBinCenters( );
+    }
+
 };
 
 void register_AngleBinAxis_class(){
@@ -237,6 +261,28 @@ void register_AngleBinAxis_class(){
                 , default_createDoubleBinSize_function_type(&AngleBinAxis_wrapper::default_createDoubleBinSize)
                 , bp::return_value_policy< bp::manage_new_object >() );
         
+        }
+        { //::IAxis::getBinBoundaries
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinBoundaries_function_type )(  ) const;
+            typedef ::std::vector< double > ( AngleBinAxis_wrapper::*default_getBinBoundaries_function_type )(  ) const;
+            
+            AngleBinAxis_exposer.def( 
+                "getBinBoundaries"
+                , getBinBoundaries_function_type(&::IAxis::getBinBoundaries)
+                , default_getBinBoundaries_function_type(&AngleBinAxis_wrapper::default_getBinBoundaries) );
+        
+        }
+        { //::IAxis::getBinCenters
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinCenters_function_type )(  ) const;
+            typedef ::std::vector< double > ( AngleBinAxis_wrapper::*default_getBinCenters_function_type )(  ) const;
+            
+            AngleBinAxis_exposer.def( 
+                "getBinCenters"
+                , getBinCenters_function_type(&::IAxis::getBinCenters)
+                , default_getBinCenters_function_type(&AngleBinAxis_wrapper::default_getBinCenters) );
+        
         }
         AngleBinAxis_exposer.staticmethod( "createIsGISAXSAxis" );
     }
diff --git a/Core/PythonAPI/src/AxisBin.pypp.cpp b/Core/PythonAPI/src/AxisBin.pypp.cpp
index 780a911ab80..152215ec41a 100644
--- a/Core/PythonAPI/src/AxisBin.pypp.cpp
+++ b/Core/PythonAPI/src/AxisBin.pypp.cpp
@@ -133,6 +133,30 @@ struct AxisBin_wrapper : AxisBin, bp::wrapper< AxisBin > {
         return AxisBin::operator[]( index );
     }
 
+    virtual ::std::vector< double > getBinBoundaries(  ) const  {
+        if( bp::override func_getBinBoundaries = this->get_override( "getBinBoundaries" ) )
+            return func_getBinBoundaries(  );
+        else
+            return this->IAxis::getBinBoundaries(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinBoundaries(  ) const  {
+        return IAxis::getBinBoundaries( );
+    }
+
+    virtual ::std::vector< double > getBinCenters(  ) const  {
+        if( bp::override func_getBinCenters = this->get_override( "getBinCenters" ) )
+            return func_getBinCenters(  );
+        else
+            return this->IAxis::getBinCenters(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinCenters(  ) const  {
+        return IAxis::getBinCenters( );
+    }
+
 };
 
 void register_AxisBin_class(){
@@ -264,6 +288,28 @@ void register_AxisBin_class(){
                 , ( bp::arg("limit") ) );
         
         }
+        { //::IAxis::getBinBoundaries
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinBoundaries_function_type )(  ) const;
+            typedef ::std::vector< double > ( AxisBin_wrapper::*default_getBinBoundaries_function_type )(  ) const;
+            
+            AxisBin_exposer.def( 
+                "getBinBoundaries"
+                , getBinBoundaries_function_type(&::IAxis::getBinBoundaries)
+                , default_getBinBoundaries_function_type(&AxisBin_wrapper::default_getBinBoundaries) );
+        
+        }
+        { //::IAxis::getBinCenters
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinCenters_function_type )(  ) const;
+            typedef ::std::vector< double > ( AxisBin_wrapper::*default_getBinCenters_function_type )(  ) const;
+            
+            AxisBin_exposer.def( 
+                "getBinCenters"
+                , getBinCenters_function_type(&::IAxis::getBinCenters)
+                , default_getBinCenters_function_type(&AxisBin_wrapper::default_getBinCenters) );
+        
+        }
     }
 
 }
diff --git a/Core/PythonAPI/src/AxisDouble.pypp.cpp b/Core/PythonAPI/src/AxisDouble.pypp.cpp
index 372db840f11..831cd972a9d 100644
--- a/Core/PythonAPI/src/AxisDouble.pypp.cpp
+++ b/Core/PythonAPI/src/AxisDouble.pypp.cpp
@@ -116,6 +116,30 @@ struct AxisDouble_wrapper : AxisDouble, bp::wrapper< AxisDouble > {
         return AxisDouble::operator[]( index );
     }
 
+    virtual ::std::vector< double > getBinBoundaries(  ) const  {
+        if( bp::override func_getBinBoundaries = this->get_override( "getBinBoundaries" ) )
+            return func_getBinBoundaries(  );
+        else
+            return this->IAxis::getBinBoundaries(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinBoundaries(  ) const  {
+        return IAxis::getBinBoundaries( );
+    }
+
+    virtual ::std::vector< double > getBinCenters(  ) const  {
+        if( bp::override func_getBinCenters = this->get_override( "getBinCenters" ) )
+            return func_getBinCenters(  );
+        else
+            return this->IAxis::getBinCenters(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinCenters(  ) const  {
+        return IAxis::getBinCenters( );
+    }
+
 };
 
 void register_AxisDouble_class(){
@@ -244,6 +268,28 @@ void register_AxisDouble_class(){
                 , ( bp::arg("element") ) );
         
         }
+        { //::IAxis::getBinBoundaries
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinBoundaries_function_type )(  ) const;
+            typedef ::std::vector< double > ( AxisDouble_wrapper::*default_getBinBoundaries_function_type )(  ) const;
+            
+            AxisDouble_exposer.def( 
+                "getBinBoundaries"
+                , getBinBoundaries_function_type(&::IAxis::getBinBoundaries)
+                , default_getBinBoundaries_function_type(&AxisDouble_wrapper::default_getBinBoundaries) );
+        
+        }
+        { //::IAxis::getBinCenters
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinCenters_function_type )(  ) const;
+            typedef ::std::vector< double > ( AxisDouble_wrapper::*default_getBinCenters_function_type )(  ) const;
+            
+            AxisDouble_exposer.def( 
+                "getBinCenters"
+                , getBinCenters_function_type(&::IAxis::getBinCenters)
+                , default_getBinCenters_function_type(&AxisDouble_wrapper::default_getBinCenters) );
+        
+        }
     }
 
 }
diff --git a/Core/PythonAPI/src/FixedBinAxis.pypp.cpp b/Core/PythonAPI/src/FixedBinAxis.pypp.cpp
index 22c07cf4c47..7f77ba06a13 100644
--- a/Core/PythonAPI/src/FixedBinAxis.pypp.cpp
+++ b/Core/PythonAPI/src/FixedBinAxis.pypp.cpp
@@ -73,6 +73,30 @@ struct FixedBinAxis_wrapper : FixedBinAxis, bp::wrapper< FixedBinAxis > {
         return FixedBinAxis::getBin( index );
     }
 
+    virtual ::std::vector< double > getBinBoundaries(  ) const  {
+        if( bp::override func_getBinBoundaries = this->get_override( "getBinBoundaries" ) )
+            return func_getBinBoundaries(  );
+        else
+            return this->FixedBinAxis::getBinBoundaries(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinBoundaries(  ) const  {
+        return FixedBinAxis::getBinBoundaries( );
+    }
+
+    virtual ::std::vector< double > getBinCenters(  ) const  {
+        if( bp::override func_getBinCenters = this->get_override( "getBinCenters" ) )
+            return func_getBinCenters(  );
+        else
+            return this->FixedBinAxis::getBinCenters(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinCenters(  ) const  {
+        return FixedBinAxis::getBinCenters( );
+    }
+
     virtual double getMax(  ) const  {
         if( bp::override func_getMax = this->get_override( "getMax" ) )
             return func_getMax(  );
@@ -177,6 +201,28 @@ void register_FixedBinAxis_class(){
                 , default_getBin_function_type(&FixedBinAxis_wrapper::default_getBin)
                 , ( bp::arg("index") ) );
         
+        }
+        { //::FixedBinAxis::getBinBoundaries
+        
+            typedef ::std::vector< double > ( ::FixedBinAxis::*getBinBoundaries_function_type )(  ) const;
+            typedef ::std::vector< double > ( FixedBinAxis_wrapper::*default_getBinBoundaries_function_type )(  ) const;
+            
+            FixedBinAxis_exposer.def( 
+                "getBinBoundaries"
+                , getBinBoundaries_function_type(&::FixedBinAxis::getBinBoundaries)
+                , default_getBinBoundaries_function_type(&FixedBinAxis_wrapper::default_getBinBoundaries) );
+        
+        }
+        { //::FixedBinAxis::getBinCenters
+        
+            typedef ::std::vector< double > ( ::FixedBinAxis::*getBinCenters_function_type )(  ) const;
+            typedef ::std::vector< double > ( FixedBinAxis_wrapper::*default_getBinCenters_function_type )(  ) const;
+            
+            FixedBinAxis_exposer.def( 
+                "getBinCenters"
+                , getBinCenters_function_type(&::FixedBinAxis::getBinCenters)
+                , default_getBinCenters_function_type(&FixedBinAxis_wrapper::default_getBinCenters) );
+        
         }
         { //::FixedBinAxis::getMax
         
diff --git a/Core/PythonAPI/src/IAxis.pypp.cpp b/Core/PythonAPI/src/IAxis.pypp.cpp
index 8422ee3a14c..a490adf476e 100644
--- a/Core/PythonAPI/src/IAxis.pypp.cpp
+++ b/Core/PythonAPI/src/IAxis.pypp.cpp
@@ -50,6 +50,30 @@ struct IAxis_wrapper : IAxis, bp::wrapper< IAxis > {
         return func_getBin( index );
     }
 
+    virtual ::std::vector< double > getBinBoundaries(  ) const  {
+        if( bp::override func_getBinBoundaries = this->get_override( "getBinBoundaries" ) )
+            return func_getBinBoundaries(  );
+        else
+            return this->IAxis::getBinBoundaries(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinBoundaries(  ) const  {
+        return IAxis::getBinBoundaries( );
+    }
+
+    virtual ::std::vector< double > getBinCenters(  ) const  {
+        if( bp::override func_getBinCenters = this->get_override( "getBinCenters" ) )
+            return func_getBinCenters(  );
+        else
+            return this->IAxis::getBinCenters(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinCenters(  ) const  {
+        return IAxis::getBinCenters( );
+    }
+
     virtual double getMax(  ) const {
         bp::override func_getMax = this->get_override( "getMax" );
         return func_getMax(  );
@@ -124,6 +148,28 @@ void register_IAxis_class(){
                 , bp::pure_virtual( getBin_function_type(&::IAxis::getBin) )
                 , ( bp::arg("index") ) );
         
+        }
+        { //::IAxis::getBinBoundaries
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinBoundaries_function_type )(  ) const;
+            typedef ::std::vector< double > ( IAxis_wrapper::*default_getBinBoundaries_function_type )(  ) const;
+            
+            IAxis_exposer.def( 
+                "getBinBoundaries"
+                , getBinBoundaries_function_type(&::IAxis::getBinBoundaries)
+                , default_getBinBoundaries_function_type(&IAxis_wrapper::default_getBinBoundaries) );
+        
+        }
+        { //::IAxis::getBinCenters
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinCenters_function_type )(  ) const;
+            typedef ::std::vector< double > ( IAxis_wrapper::*default_getBinCenters_function_type )(  ) const;
+            
+            IAxis_exposer.def( 
+                "getBinCenters"
+                , getBinCenters_function_type(&::IAxis::getBinCenters)
+                , default_getBinCenters_function_type(&IAxis_wrapper::default_getBinCenters) );
+        
         }
         { //::IAxis::getMax
         
diff --git a/Core/PythonAPI/src/VariableBinAxis.pypp.cpp b/Core/PythonAPI/src/VariableBinAxis.pypp.cpp
index 27b2048c660..4337903e659 100644
--- a/Core/PythonAPI/src/VariableBinAxis.pypp.cpp
+++ b/Core/PythonAPI/src/VariableBinAxis.pypp.cpp
@@ -126,6 +126,30 @@ struct VariableBinAxis_wrapper : VariableBinAxis, bp::wrapper< VariableBinAxis >
         return IAxis::createDoubleBinSize( );
     }
 
+    virtual ::std::vector< double > getBinBoundaries(  ) const  {
+        if( bp::override func_getBinBoundaries = this->get_override( "getBinBoundaries" ) )
+            return func_getBinBoundaries(  );
+        else
+            return this->IAxis::getBinBoundaries(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinBoundaries(  ) const  {
+        return IAxis::getBinBoundaries( );
+    }
+
+    virtual ::std::vector< double > getBinCenters(  ) const  {
+        if( bp::override func_getBinCenters = this->get_override( "getBinCenters" ) )
+            return func_getBinCenters(  );
+        else
+            return this->IAxis::getBinCenters(  );
+    }
+    
+    
+    ::std::vector< double > default_getBinCenters(  ) const  {
+        return IAxis::getBinCenters( );
+    }
+
 };
 
 void register_VariableBinAxis_class(){
@@ -227,6 +251,28 @@ void register_VariableBinAxis_class(){
                 , bp::return_value_policy< bp::manage_new_object >() );
         
         }
+        { //::IAxis::getBinBoundaries
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinBoundaries_function_type )(  ) const;
+            typedef ::std::vector< double > ( VariableBinAxis_wrapper::*default_getBinBoundaries_function_type )(  ) const;
+            
+            VariableBinAxis_exposer.def( 
+                "getBinBoundaries"
+                , getBinBoundaries_function_type(&::IAxis::getBinBoundaries)
+                , default_getBinBoundaries_function_type(&VariableBinAxis_wrapper::default_getBinBoundaries) );
+        
+        }
+        { //::IAxis::getBinCenters
+        
+            typedef ::std::vector< double > ( ::IAxis::*getBinCenters_function_type )(  ) const;
+            typedef ::std::vector< double > ( VariableBinAxis_wrapper::*default_getBinCenters_function_type )(  ) const;
+            
+            VariableBinAxis_exposer.def( 
+                "getBinCenters"
+                , getBinCenters_function_type(&::IAxis::getBinCenters)
+                , default_getBinCenters_function_type(&VariableBinAxis_wrapper::default_getBinCenters) );
+        
+        }
     }
 
 }
diff --git a/Core/Tools/inc/FixedBinAxis.h b/Core/Tools/inc/FixedBinAxis.h
index f14f49f43b3..e1b3b8677d8 100644
--- a/Core/Tools/inc/FixedBinAxis.h
+++ b/Core/Tools/inc/FixedBinAxis.h
@@ -50,6 +50,10 @@ public:
 
     size_t findClosestIndex(double value) const;
 
+    std::vector<double > getBinCenters() const;
+
+    std::vector<double > getBinBoundaries() const;
+
 protected:
     void print(std::ostream& ostr) const;
     virtual bool equals(const IAxis& other) const;
diff --git a/Core/Tools/inc/IAxis.h b/Core/Tools/inc/IAxis.h
index 998d8858103..cccc9371ecc 100644
--- a/Core/Tools/inc/IAxis.h
+++ b/Core/Tools/inc/IAxis.h
@@ -64,13 +64,13 @@ public:
     //! test for equality
     friend bool operator==(const IAxis& left, const IAxis& right);
 
-//    friend bool operator==(const IAxis& left, const IAxis& right) {
-//        return left.equals(right);
-//    }
-
     friend std::ostream& operator<<(std::ostream& ostr, const IAxis& m)
     { m.print(ostr); return ostr; }
 
+    virtual std::vector<double > getBinCenters() const;
+
+    virtual  std::vector<double > getBinBoundaries() const;
+
 protected:
     virtual void print(std::ostream& ostr) const=0;
     virtual bool equals(const IAxis& other) const;
@@ -95,6 +95,16 @@ inline bool operator!=(const IAxis& left, const IAxis& right) {
     return !(left == right);
 }
 
+inline std::vector<double> IAxis::getBinCenters() const
+{
+    throw Exceptions::NotImplementedException("IAxis::getBinCenters() -> Error. Not implemented.");
+}
+
+inline std::vector<double> IAxis::getBinBoundaries() const
+{
+    throw Exceptions::NotImplementedException("IAxis::getBinBoundaries() -> Error. Not implemented.");
+}
+
 //! global helper function for comparison of axes
 inline bool HaveSameNameAndShape(const IAxis& left, const IAxis& right)
 {
diff --git a/Core/Tools/src/FixedBinAxis.cpp b/Core/Tools/src/FixedBinAxis.cpp
index 9a289b6cdf8..ab2af5426af 100644
--- a/Core/Tools/src/FixedBinAxis.cpp
+++ b/Core/Tools/src/FixedBinAxis.cpp
@@ -80,6 +80,27 @@ size_t FixedBinAxis::findClosestIndex(double value) const
     return int( (value-m_start)/step);
 }
 
+std::vector<double> FixedBinAxis::getBinCenters() const
+{
+    std::vector<double> result;
+    result.resize(getSize(), 0.0);
+    for(size_t i=0; i<getSize(); ++i) {
+        result[i] = getBin(i).getMidPoint();
+    }
+    return result;
+}
+
+std::vector<double> FixedBinAxis::getBinBoundaries() const
+{
+    std::vector<double> result;
+    result.resize(getSize()+1, 0.0);
+    for(size_t i=0; i<getSize(); ++i) {
+        result[i] = getBin(i).m_lower;
+    }
+    result[getSize()] = getBin(getSize()-1).m_upper;
+    return result;
+}
+
 
 void FixedBinAxis::print(std::ostream& ostr) const
 {
diff --git a/Tests/FunctionalTests/TestPyCore/axes.py b/Tests/FunctionalTests/TestPyCore/axes.py
index 2f53a8f060f..fc5dff3252f 100644
--- a/Tests/FunctionalTests/TestPyCore/axes.py
+++ b/Tests/FunctionalTests/TestPyCore/axes.py
@@ -29,8 +29,29 @@ class AxesTest(unittest.TestCase):
     def test_FixedBinAxis_equality(self):
         b1 = FixedBinAxis("axis", 99, -1.01, 3.3)
         b2 = FixedBinAxis("axis", 99, -1.01, 3.3)
-
         self.assertTrue( b1 == b2)
+        b3 = FixedBinAxis("axissss", 99, -1.01, 3.3)
+        b4 = FixedBinAxis("axis", 99, -1.0, 3.3)
+        b5 = FixedBinAxis("axis", 99, -1.01, 3.29)
+        b6 = FixedBinAxis("axiss", 98, -1.01, 3.3)
+        self.assertFalse( b1 == b3)
+        self.assertFalse( b1 == b4)
+        self.assertFalse( b1 == b5)
+        self.assertFalse( b1 == b6)
+
+    def test_FixedBinAxis_boundaries(self):
+        axis = FixedBinAxis("name", 3, -1.5, 1.5)
+        centers = axis.getBinCenters()
+        self.assertEqual(3, len(centers))
+        self.assertAlmostEqual(-1.0, centers[0])
+        self.assertAlmostEqual(0.0, centers[1])
+        self.assertAlmostEqual(1.0, centers[2])
+        boundaries = axis.getBinBoundaries()
+        self.assertEqual(4, len(boundaries))
+        self.assertAlmostEqual(-1.5, boundaries[0])
+        self.assertAlmostEqual(-0.5, boundaries[1])
+        self.assertAlmostEqual(0.5, boundaries[2])
+        self.assertAlmostEqual(1.5, boundaries[3])
 
 
 if __name__ == '__main__':
diff --git a/Tests/FunctionalTests/TestPyCore/intensitydata_io.py b/Tests/FunctionalTests/TestPyCore/intensitydata_io.py
index b97e3c1e845..5151a0cc3e4 100644
--- a/Tests/FunctionalTests/TestPyCore/intensitydata_io.py
+++ b/Tests/FunctionalTests/TestPyCore/intensitydata_io.py
@@ -1,4 +1,4 @@
-# tests of IntensityData object
+# tests of IO operations with the IntensityData object
 
 import sys
 import os
@@ -13,27 +13,31 @@ from libBornAgainCore import *
 
 
 def fill_data(data):
-    """Fills intensity data with some numbers"""
+    """
+    Fills intensity data with some numbers
+    """
     for i in range(0, data.getAllocatedSize()):
         data[i] = i
 
 
 def is_the_same(data1, data2):
+    """
+    Checks if two data are identical
+    """
     if data1.getAllocatedSize() != data2.getAllocatedSize():
         return False
     if data1.getRank() != data2.getRank():
         return False
     for i in range(0, data1.getRank()):
-        if data1.getAxis(i) == data2.getAxis(i):
-            print "xxx"
-        else:
-            print "yyy"
+        if data1.getAxis(i) != data2.getAxis(i):
+            return False
+    for i in range(0, data1.getAllocatedSize()):
+        if data1[i] != data2[i]:
+            return False
 
     return True
 
 
-
-
 class OutputDataIOTest(unittest.TestCase):
     """
     Test serialization of IntensityData
@@ -44,8 +48,27 @@ class OutputDataIOTest(unittest.TestCase):
         fill_data(data)
         OutputDataIOFactory.writeIntensityData(data, "tmp.baint")
         newdata = OutputDataIOFactory.readIntensityData("tmp.baint")
+        self.assertTrue(is_the_same(data, newdata))
+
+    def test_2D_FixedBinAxis(self):
+        data = IntensityData()
+        data.addAxis(FixedBinAxis("axis0", 9, -1.00000001, 1.0))
+        data.addAxis(FixedBinAxis("axis1", 3, -4.0, 5.0))
+        fill_data(data)
+        OutputDataIOFactory.writeIntensityData(data, "tmp.baint")
+        newdata = OutputDataIOFactory.readIntensityData("tmp.baint")
+        self.assertTrue(is_the_same(data, newdata))
 
+    def test_3D_FixedBinAxis(self):
+        data = IntensityData()
+        data.addAxis(FixedBinAxis("axis0", 9, -1.00000001, 1.0))
+        data.addAxis(FixedBinAxis("axis1", 1, -4.0, 5.0))
+        data.addAxis(FixedBinAxis("axis2", 3, 0.0, 1.0))
+        fill_data(data)
+        OutputDataIOFactory.writeIntensityData(data, "tmp.baint")
+        newdata = OutputDataIOFactory.readIntensityData("tmp.baint")
         self.assertTrue(is_the_same(data, newdata))
 
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/Tests/UnitTests/TestCore/FixedBinAxisTest.h b/Tests/UnitTests/TestCore/FixedBinAxisTest.h
index d18f8c3145f..5e7b6b0e0f7 100644
--- a/Tests/UnitTests/TestCore/FixedBinAxisTest.h
+++ b/Tests/UnitTests/TestCore/FixedBinAxisTest.h
@@ -142,5 +142,26 @@ TEST_F(FixedBinAxisTest, IOStream)
     delete result;
 }
 
+TEST_F(FixedBinAxisTest, BinCenters)
+{
+    FixedBinAxis axis("name", 3, -1.5, 1.5);
+    std::vector<double> centers = axis.getBinCenters();
+    EXPECT_EQ(3, centers.size());
+    EXPECT_DOUBLE_EQ(-1.0, centers[0]);
+    EXPECT_DOUBLE_EQ(0.0, centers[1]);
+    EXPECT_DOUBLE_EQ(1.0, centers[2]);
+}
+
+TEST_F(FixedBinAxisTest, BinBoundaries)
+{
+    FixedBinAxis axis("name", 3, -1.5, 1.5);
+    std::vector<double> boundaries = axis.getBinBoundaries();
+    EXPECT_EQ(4, boundaries.size());
+    EXPECT_DOUBLE_EQ(-1.5, boundaries[0]);
+    EXPECT_DOUBLE_EQ(-0.5, boundaries[1]);
+    EXPECT_DOUBLE_EQ(0.5, boundaries[2]);
+    EXPECT_DOUBLE_EQ(1.5, boundaries[3]);
+}
+
 
 #endif
-- 
GitLab