diff --git a/include/scalfmm/tools/fma_loader.hpp b/include/scalfmm/tools/fma_loader.hpp
index 9647c684e6bce872956134b3ca4c3b16b7bb4413..5c99f314c83c07fb10baf47599990cc6d77fe212 100644
--- a/include/scalfmm/tools/fma_loader.hpp
+++ b/include/scalfmm/tools/fma_loader.hpp
@@ -20,7 +20,7 @@
 #include <ios>
 #include <iostream>
 #include <iterator>
-#include <string.h>
+#include <span>
 #include <string>
 #include <vector>
 
@@ -305,7 +305,7 @@ namespace scalfmm::io
         inline auto getNbRecordPerline() -> unsigned int { return m_typeData[1]; }
 
         /**
-         * @brief The box width from the simulation file opened by the loader
+         * @brief The Dimension space of the simulation file opened by the loader
          *
          * @return the Dimension space
          */
@@ -442,17 +442,13 @@ namespace scalfmm::io
             {
                 this->readAscciHeader(nbval);
             }
+
             if(Dimension < m_typeData[2])
             {
                 std::cerr << "Wrong dimension. Template parameter is " << Dimension << " and dimension in file is "
                           << m_typeData[2] << ".\n";
             }
-            // if(m_typeData[1] != sizeof(FReal)) {
-            //     std::string type[2]{"float","double"};
-            //     std::cout << type[0] << " "<< type[1]<< m_typeData[0] <<  " "<< m_typeData[0] <<  " "<< m_typeData[1]
-            //     <<std::endl; std::cout << "Data conversion is needed (Reader in "<< type[sizeof(FReal)/4-1]
-            //     << ") data in file are in " << type[m_typeData[0]/4-1]<< std::endl;
-            // }
+
             if(m_verbose)
             {
                 std::cout << "   nbParticles: " << this->m_nbParticles << std::endl
@@ -523,10 +519,11 @@ namespace scalfmm::io
                 m_typeData[2] = 3;
                 m_typeData[3] = 1;
             }
+
             if(m_typeData[0] != sizeof(FReal))
             {
-                std::cerr << "Size of elements in part file " << m_typeData[0] << " is different from size of FReal "
-                          << sizeof(FReal) << std::endl;
+                std::cerr << "readBinaryHeader: Size of elements in part file " << m_typeData[0]
+                          << " is different from size of FReal " << sizeof(FReal) << std::endl;
                 std::cerr << "The conversion is not yet implemented for binary file\n";
                 std::exit(EXIT_FAILURE);
             }
@@ -730,25 +727,28 @@ namespace scalfmm::io
          *
          * Should be used if we write the particles with writeArrayOfReal method
          *
-         * @tparam PointType
-         * @param centerOfBox      The center of the Box (FPoint<FReal> class)
+         * @tparam PointType  The type of a point
+         * @param centerOfBox      The center of the Box (FPoint<FReal, dimension> class)
          * @param boxWidth         The width of the box
          * @param nbParticles      Number of particles in the box (or to save)
          * @param dataType         Size of the data type of the values in particle
          * @param nbDataPerRecord  Number of record/value per particle
-         * @param dimension
-         * @param nb_input_values
+         * @param dimension.       The dimension of the problem 
+         * @param nb_input_values. The number of input values in a particle
          */
-        template<class PointType>
-        auto writeHeader(const PointType& centerOfBox, const FReal& boxWidth, const std::size_t& nbParticles,
-                         const unsigned int dataType, const unsigned int nbDataPerRecord, const unsigned int dimension,
-                         const unsigned int nb_input_values) -> void
+        template<class PointType, typename IntType>
+        auto writeHeader(const PointType& centerOfBox, const FReal& boxWidth, const IntType& nbParticles,
+                         const IntType& dataType, const IntType& nbDataPerRecord, const IntType& dimension,
+                         const IntType& nb_input_values) -> void
         {
-            std::array<unsigned int, 4> typeFReal = {dataType, nbDataPerRecord, dimension, nb_input_values};
+            std::array<unsigned int, 4> typeFReal = {
+              static_cast<unsigned int>(dataType), static_cast<unsigned int>(nbDataPerRecord),
+              static_cast<unsigned int>(dimension), static_cast<unsigned int>(nb_input_values)};
+
             FReal x = boxWidth * FReal(0.5);
             if(this->m_binaryFile)
             {
-                this->writerBinaryHeader(centerOfBox, x, nbParticles, typeFReal.data(), 4);
+                this->writerBinaryHeader(&(centerOfBox[0]), x, nbParticles, typeFReal.data(), 4);
             }
             else
             {
@@ -767,9 +767,42 @@ namespace scalfmm::io
             {
                 std::cout << e << " ";
             }
-            std::cout << std::endl;
+            std::cout << std::endl << std::flush;
         }
 
+        template<typename IntType>
+        auto writeHeader(const FReal* centerOfBox, const FReal& boxWidth, const IntType& nbParticles,
+                         const IntType& dataType, const IntType& nbDataPerRecord, const IntType& dimension,
+                         const IntType& nb_input_values) -> void
+        {
+            std::array<unsigned int, 4> typeFReal = {
+              static_cast<unsigned int>(dataType), static_cast<unsigned int>(nbDataPerRecord),
+              static_cast<unsigned int>(dimension), static_cast<unsigned int>(nb_input_values)};
+
+            FReal x = boxWidth * FReal(0.5);
+            if(this->m_binaryFile)
+            {
+                this->writerBinaryHeader(centerOfBox, x, nbParticles, typeFReal.data(), 4);
+            }
+            else
+            {
+                this->writerAscciHeader(centerOfBox, x, nbParticles, typeFReal.data(), 4);
+            }
+            std::cout << "   Datatype ";
+            for(int i = 0; i < 4; ++i)
+            {
+                std::cout << " " << typeFReal[i];
+            }
+            std::cout << '\n';
+            std::cout << "   nbParticles: " << nbParticles << std::endl
+                      << "   Box width:   " << boxWidth << std::endl
+                      << "   Center:      ";
+            for(int i = 0; i < typeFReal[2]; ++i)
+            {
+                std::cout << centerOfBox[i] << " ";
+            }
+            std::cout << std::endl << std::flush;
+        }
         /**
          * @brief
          *
@@ -791,7 +824,7 @@ namespace scalfmm::io
             FReal x = boxWidth * FReal(0.5);
             if(this->m_binaryFile)
             {
-                this->writerBinaryHeader(centerOfBox, x, nbParticles, typeFReal.data(), 2);
+                this->writerBinaryHeader(&centerOfBox[0], x, nbParticles, typeFReal.data(), 2);
             }
             else
             {
@@ -818,7 +851,8 @@ namespace scalfmm::io
          * Fwriter.writeArrayOfReal(particles, nbParticles);
          * @endcode
          */
-        auto writeArrayOfReal(const FReal* dataToWrite, const int nbData, const std::size_t N) -> void
+        template<typename int1Type, typename int2Type>
+        auto writeArrayOfReal(const FReal* dataToWrite, const int1Type nbData, const int2Type N) -> void
         {
             if(m_binaryFile)
             {
@@ -863,10 +897,10 @@ namespace scalfmm::io
         template<class TreeType>
         auto writeDataFromTree(const TreeType& tree, const std::size_t& number_particles) -> void
         {
-            constexpr int dimension = TreeType::leaf_type::dimension;
-            constexpr int nb_input_elements = TreeType::leaf_type::particle_type::inputs_size;
-            constexpr int nb_output_elements = TreeType::leaf_type::particle_type::outputs_size;
-            constexpr int nb_elt_per_par = dimension + nb_input_elements + nb_output_elements;
+            constexpr std::size_t dimension = TreeType::leaf_type::dimension;
+            constexpr std::size_t nb_input_elements = TreeType::leaf_type::particle_type::inputs_size;
+            constexpr std::size_t nb_output_elements = TreeType::leaf_type::particle_type::outputs_size;
+            constexpr std::size_t nb_elt_per_par = dimension + nb_input_elements + nb_output_elements;
             std::cout << "Dimension: " << dimension << std::endl;
             std::cout << "Number of input values: " << nb_input_elements << std::endl;
             std::cout << "Number of output values: " << nb_output_elements << std::endl;
@@ -961,14 +995,14 @@ namespace scalfmm::io
 
       protected:
         /**
-         * @brief
+         * @brief Write the header of the file for fma format
          *
-         * @tparam PointType
-         * @param centerOfBox
-         * @param boxWidth
-         * @param nbParticles
-         * @param typeFReal
-         * @param nbVal
+         * @tparam PointType  The type of the point 
+         * @param centerOfBox The centre of the box
+         * @param boxWidth the size of the Box
+         * @param nbParticles Number of particles to write
+         * @param typeFReal array of size 4 containing {dataType, nbDataPerRecord, dimension, nb_input_values};
+         * @param nbVal Number of values for one particles (dimension + nb_input_values + nb_output_values)
          */
         template<class PointType>
         auto writerAscciHeader(const PointType& centerOfBox, const FReal& boxWidth, const std::size_t& nbParticles,
@@ -992,27 +1026,56 @@ namespace scalfmm::io
 
             (*this->m_file) << '\n';
         }
+        /**
+         * @brief Write the header of the file for fma format
+         *
+         * @param centerOfBox The centre of the box
+         * @param boxWidth the size of the Box
+         * @param nbParticles Number of particles to write
+         * @param typeFReal array of size 4 containing {dataType, nbDataPerRecord, dimension, nb_input_values};
+         * @param nbVal Number of values for one particles (dimension + nb_input_values + nb_output_values)
+         */
+        auto writerAscciHeader(const FReal* centerOfBox, const FReal& boxWidth, const std::size_t& nbParticles,
+                               const unsigned int* typeFReal, const unsigned int nbVal) -> void
+        {
+            this->m_file->precision(std::numeric_limits<FReal>::digits10);
+            // Line 1
+            (*this->m_file) << typeFReal[0];
+            for(unsigned int i = 1; i < nbVal; ++i)
+            {
+                (*this->m_file) << "  " << typeFReal[i];
+            }
+            (*this->m_file) << '\n';
+            // Line 2
+            (*this->m_file) << nbParticles << "   " << boxWidth;
+            for(std::size_t i = 0; i < typeFReal[2]; ++i)
+            {
+                (*this->m_file) << "  " << centerOfBox[i];
+                ;
+            }
 
+            (*this->m_file) << '\n';
+        }
         /**
-         * @brief
+         * @brief Write the header of the file for bfma format
          *
-         * @tparam PointType
-         * @param centerOfBox
-         * @param boxWidth
-         * @param nbParticles
-         * @param typeFReal
-         * @param nbVal
+         * @tparam PointType  The type of a point 
+         * @param centerOfBox the centre of the box (point<Freal, typeFReal[2]>)
+         * @param boxWidth the size of the Box
+         * @param nbParticles Number of particles to write
+         * @param typeFReal array of size 4 containing {dataType, nbDataPerRecord, dimension, nb_input_values};
+         * @param nbVal Number of values for one particles (dimension + nb_input_values + nb_output_values)
          */
         template<class PointType>
-        auto writerBinaryHeader(const PointType& centerOfBox, const FReal& boxWidth, const std::size_t& nbParticles,
+        auto writerBinaryHeader(PointType const& centerOfBox, const FReal& boxWidth, const std::size_t& nbParticles,
                                 const unsigned int* typeFReal, const unsigned int nbVal) -> void
         {
             m_file->seekg(std::ios::beg);
             m_file->write((const char*)typeFReal, nbVal * sizeof(unsigned int));
             if(typeFReal[0] != sizeof(FReal))
             {
-                std::cout << "Size of elements in part file " << typeFReal[0] << " is different from size of FReal "
-                          << sizeof(FReal) << std::endl;
+                std::cout << "writerBinaryHeader: Size of elements in part file " << typeFReal[0]
+                          << " is different from size of FReal " << sizeof(FReal) << std::endl;
                 std::exit(EXIT_FAILURE);
             }
             else
@@ -1022,11 +1085,45 @@ namespace scalfmm::io
                 m_file->write((const char*)&(boxWidth), sizeof(boxWidth));
                 if(nbVal == 2)   // old Format
                 {
-                    m_file->write((const char*)(&centerOfBox[0]), sizeof(FReal) * 3);
+                    m_file->write((const char*)(&(centerOfBox[0])), sizeof(FReal) * 3);
+                }
+                else
+                {
+                    m_file->write((const char*)(&(centerOfBox[0])), sizeof(FReal) * typeFReal[2]);
+                }
+            }
+        }
+        /**
+         * @brief Write the header of the file for bfma format
+         *
+         * @param centerOfBox A pointer on the position of the centre of the box (size typeFReal[2])
+         * @param boxWidth the size of the Box
+         * @param nbParticles Number of particles to write
+         * @param typeFReal array of size 4 containing {dataType, nbDataPerRecord, dimension, nb_input_values};
+         * @param nbVal Number of values for one particles (dimension + nb_input_values + nb_output_values)
+         */
+        auto writerBinaryHeader(const FReal* centerOfBox, const FReal& boxWidth, const std::size_t& nbParticles,
+                                const unsigned int* typeFReal, const unsigned int nbVal) -> void
+        {
+            m_file->seekg(std::ios::beg);
+            m_file->write((const char*)typeFReal, nbVal * sizeof(unsigned int));
+            if(typeFReal[0] != sizeof(FReal))
+            {
+                std::cout << "writerBinaryHeader: Size of elements in part file " << typeFReal[0]
+                          << " is different from size of FReal " << sizeof(FReal) << std::endl;
+                std::exit(EXIT_FAILURE);
+            }
+            else
+            {
+                m_file->write((const char*)&(nbParticles), sizeof(std::size_t));
+                m_file->write((const char*)&(boxWidth), sizeof(boxWidth));
+                if(nbVal == 2)   // old Format
+                {
+                    m_file->write((const char*)(centerOfBox), sizeof(FReal) * 3);
                 }
                 else
                 {
-                    m_file->write((const char*)(&centerOfBox[0]), sizeof(FReal) * typeFReal[2]);
+                    m_file->write((const char*)(centerOfBox), sizeof(FReal) * typeFReal[2]);
                 }
             }
         }
diff --git a/python_interface/fmmTools.py b/python_interface/fmmTools.py
index 31a0b687f066f35aea842fe519770f4faedd432a..e1bc25ce32761534d35b3769aae63da14d0edd14 100644
--- a/python_interface/fmmTools.py
+++ b/python_interface/fmmTools.py
@@ -1,16 +1,24 @@
 import os
 import sys
 import numpy as np 
-from pyfmm import fmaloader
+from pyfmm import fmaloader, fmawriter, point
 
 
+def get_real_type(data):
+
+    if data == 4:
+        return np.float 
+    elif data== 8:
+        return np.float64 
+    else :
+        sys.exit("Oops!  no valid number (4 or 8).")
 
 def fmareader_ascii(filename,verbose=False):
     '''
         Read an FMA file of scalfmmm 
 
         Return 
-            particules an array of three objects (position, inputs, ou tputs)
+            particules an array of three objects (Numpy array) (position, inputs, ou tputs)
             centre of the box
             the size of the box
     '''
@@ -19,6 +27,8 @@ def fmareader_ascii(filename,verbose=False):
     file = open(filename, "r")
     line1 = file.readline()
     lline = line1.split()
+    data_type = int(lline[0])
+    my_type = get_real_type(data_type)
     nval= int(lline[1])
     dimension = int(lline[2])
     nb_inputs = int(lline[3])
@@ -28,10 +38,10 @@ def fmareader_ascii(filename,verbose=False):
     line2 = file.readline() 
     lline = line2.split()
     npoints =  int(lline[0])
-    size = float(lline[1])*2.0
-    centre = np.zeros(dimension, dtype = float)
+    size = my_type(lline[1])*2.0
+    centre = np.zeros(dimension, dtype = my_type)
     for i in range(dimension):
-        centre[i] = float(lline[i+2])
+        centre[i] = my_type(lline[i+2])
     file.close()
     # Read the particles
     particles = np.empty((3), dtype=object)
@@ -39,7 +49,7 @@ def fmareader_ascii(filename,verbose=False):
 
     particles[1] = np.loadtxt(filename,  comments='#', skiprows=2, usecols=range(dimension,(dimension+nb_inputs))).reshape((npoints,nb_inputs))
     if nb_outputs == 0:
-        particles[2] = np.zeros((npoints,1),dtype=np.float64) 
+        particles[2] = np.zeros((npoints,1),dtype=my_type) 
     else:
         start = dimension+nb_inputs 
         particles[2] = np.loadtxt(filename,  comments='#', skiprows=2, usecols=range(start,(start+nb_outputs))).reshape(npoints,nb_outputs)
@@ -60,7 +70,9 @@ def fmareader_binary(filename,verbose=False):
             the size of the box
     '''
     loader = fmaloader(name=filename, verbose=verbose)
-    print("fmareader_binary",filename)
+    
+    my_type = get_real_type(loader.data_type())
+
     nb_particles = loader.n()
     nb_data = loader.nb_data()
     dim = loader.dim()
@@ -68,20 +80,22 @@ def fmareader_binary(filename,verbose=False):
     nb_outputs = loader.nb_outputs()
     data = loader.read()
     particles = np.empty((3), dtype=object)
-
     particles[0] = data[:,0:dim]
     particles[1] = data[:,dim:dim+nb_inputs]
     if nb_outputs == 0:
-        particles[2] = np.zeros((nb_particles,1),dtype=np.float64) 
+        particles[2] = np.zeros((nb_particles,1),dtype=my_type) 
     else:
         start = dim+nb_inputs 
         particles[2] = data[:,start:start+nb_outputs]
 
-    centre = loader.centre()
-    width = loader.width()
+    centre_tmp = loader.centre()
+    width = my_type(loader.width())
+    centre = np.zeros((dim),dtype=my_type)
+    for i in range(dim):
+        centre[i] = centre_tmp[i]
     return particles,centre,width
 
-def fmareader(filename,verbose=False):
+def fma_reader(filename,verbose=False):
     '''
         Read an FMA file of scalfmmm 
 
@@ -107,15 +121,16 @@ def fmawriter_ascii(filename,particles, centre, width,verbose=False):
         write particles in  FMA file of scalfmmm 
 
     '''
-
+    print(" -------------- fmawriter_ascii ------------------")
     # write the two first line of the header
     file = open(filename, "w")
     #   DatatypeSize  Number_of_record_per_line dimension Number_of_input_data
     #   NB_particles  half_Box_width  Center (dim values)
     #   Particle_values
+    print("fmawriter_ascii ", centre, type(centre))
     p_shape = particles.shape
     print(type(p_shape),p_shape)
-    if particles[0].dtype == 'float64':
+    if particles[0].dtype == 'float64' or particles[0].dtype == 'np.float64':
         line1 = '8'
     else:
         line1 = '4'
@@ -148,30 +163,57 @@ def fmawriter_ascii(filename,particles, centre, width,verbose=False):
                 linep += str(current[p, j]) + ' '
 
         file.write(linep+'\n')
+    file.close()
 
     #
+def fmawriter_binary(filename,particles, centre, width,verbose=False):
+    '''
+        write particles in  FMA file of scalfmmm 
 
-    file.close()
+    '''
+    writer = fmawriter(name=filename, binary=True)
+    n = 0
+    for i in range(particles.shape[0]):
+        print(i,particles[i].dtype)
+        n += particles[i].shape[1]
+    n_particles =  particles[0].shape[0]
+    array = np.zeros([n_particles, n], dtype=particles[0].dtype, order='C')
 
+    start = 0 
+    for i in range(particles.shape[0]):
+        end = start + particles[i].shape[1]
+        array[:,start:end] = particles[i][:,0:particles[i].shape[1]]
+        start = end
 
+    if particles[0].dtype == 'float64' or particles[0].dtype == np.float64:
+        dataType = 8
+    else:
+        dataType = 4
+ 
+    writer.write_header(centre, width, n_particles, dataType,dataType, particles[0].shape[1], particles[1].shape[1])
 
-def fmawriter(filename, particles, centre, width, verbose=False):
-    '''
-        Read an FMA file of scalfmmm 
+    writer.write(array, n, n_particles)
+    writer.close()
 
-        Return 
-            particules an array of three objects (position, inputs, ou tputs)
+
+#
+def fma_writer(filename, particles, centre, width, verbose=False):
+    '''
+        write  an FMA file of scalfmmm 
+        Inputs
+            particules an array of three objects (position, inputs, outputs)
             centre of the box
             the size of the box
     '''
     # Chemin du fichier
-    print("read file ",filename)
+    print("write file ",filename)
     # Extraction de l'extension
     extension = os.path.splitext(filename)
     if  extension[-1] == '.fma':
         fmawriter_ascii(filename,particles, centre, width,verbose)
-    # elif  extension[-1] == '.bfma':
-    #     return fmareader_binary(filename,verbose)
+    elif  extension[-1] == '.bfma':
+        fmawriter_binary(filename,particles, centre, width,verbose)
+
     else:
         sys.exit("Wrong extention. only .fma (ascii) files are avalaible")
 
@@ -180,13 +222,7 @@ def fmawriter(filename, particles, centre, width, verbose=False):
 if __name__ == '__main__':
     filename = "../data/cubeSorted_10_PF.fma"
 
-# # Extraction de l'extension
-#     extension = os.path.splitext(filename)
-
-# # Affichage de l'extension
-#     print(f"L'extension du fichier est : {extension}")
-
-    particles, centre, size = fmareader(filename)
+    particles, centre, size = fma_reader(filename)
 
     print("centre", centre)
     print("size", size)
diff --git a/python_interface/pyfmm.cpp b/python_interface/pyfmm.cpp
index 44bd61e74d101bcb20263bb6519649f0390fdeed..5486bb98c8cfa88d4166af949a2ccc27d3dbb287 100644
--- a/python_interface/pyfmm.cpp
+++ b/python_interface/pyfmm.cpp
@@ -87,6 +87,16 @@ namespace pyfmm
     using np_array = py_array_t<value_type>;
     using np_array_int = py_array_t<int>;
 
+    namespace to_cpp
+    {
+        template<typename T>
+        auto to_ptr(py_array_t<T> const& array) -> T*
+        {
+            py::buffer_info buf_info = array.request();
+            return static_cast<T*>(buf_info.ptr);
+        }
+    }   // namespace to_cpp
+
 }   // namespace pyfmm
 
 PYBIND11_MAKE_OPAQUE(pyfmm::container_type);
@@ -621,12 +631,14 @@ PYBIND11_MODULE(pyfmm, m)
       // fillParticles(vector_type & dataToRead, const std::size_t N)
       .def("n", &fmaloader::getNumberOfParticles)
       .def("nb_data", &fmaloader::getNbRecordPerline)
+      .def("data_type", &fmaloader::getDataType)
       .def("dim", &fmaloader::get_dimension)
       .def("nb_inputs", &fmaloader::get_number_of_input_per_record)
       .def("nb_outputs", &fmaloader::get_number_of_output_per_record)
       .def("data_type", &fmaloader::getDataType)
       .def("centre", &fmaloader::getBoxCenter)
       .def("width", &fmaloader::getBoxWidth)
+      .def("close", &fmaloader::close)
       .def(
         "read",
         [](fmaloader& loader)
@@ -634,17 +646,39 @@ PYBIND11_MODULE(pyfmm, m)
             int nb_line_record = loader.getNbRecordPerline();
             int nb_particles = loader.getNumberOfParticles();
             std::vector<value_type> data(nb_particles * nb_line_record);
-            std::cout << "n_mine_record " << nb_line_record << std::endl;
             loader.fillParticles(data, nb_particles);
             return py::array_t<value_type, py::array::c_style>({nb_particles, nb_line_record}, data.data());
         },
         pybind11::return_value_policy::move, " read the data (matrix C form)");
 
+    /////////////////////////////////////////////////////////////////////////
+    //
+    // Writer interface
+    //
     using fmawriter = scalfmm::io::FFmaGenericWriter<value_type>;
 
     py::class_<fmawriter>(m, "fmawriter")
-      .def(py::init<const std::string&>(), py::arg("name"))
-      .def(py::init<const std::string&, bool>(), py::arg("name"), py::arg("binary"))
+      .def(py::init<const std::string&>(), py::arg("name"), " open a file to store the data. (extension fma or bfma) ")
+      .def(py::init<const std::string&, bool>(), py::arg("name"), py::arg("binary"),
+           " open a file to store the data. (extension fma or bfma) ")
 
-      .def("write", &fmawriter::writeDataFromTree<typename pyfmm::group_tree_type>);
+      .def("close", &fmawriter::close, " close the file")
+      .def(
+        "write_header",
+        [](fmawriter& writer, pyfmm::np_array centre, const value_type& width, const int nb_particles,
+           const int dataType, const int nbDataPerRecord, const int dimension, const int nb_input_values)
+        {
+            const value_type* ptr = pyfmm::to_cpp::to_ptr(centre);
+            writer.writeHeader(ptr, width, nb_particles, dataType, nbDataPerRecord, dimension, nb_input_values);
+        },
+        " write the header")
+      .def("write", &fmawriter::writeDataFromTree<typename pyfmm::group_tree_type>, " write the data particles")
+      .def(
+        "write",
+        [](fmawriter& writer, pyfmm::np_array particles, const int full_size, const int nb_particles)
+        {
+            const value_type* ptr = pyfmm::to_cpp::to_ptr(particles);
+            writer.writeArrayOfReal(ptr, full_size, nb_particles);
+        },
+        " write the data particles");
 }
\ No newline at end of file
diff --git a/python_interface/read-write.py b/python_interface/read-write.py
index 4cf6fd45d860ec5da19c1179d36ccfd81e3ab028..a703e8ef01c9e1ff343741e3f6ef04a67825e5c0 100644
--- a/python_interface/read-write.py
+++ b/python_interface/read-write.py
@@ -1,9 +1,7 @@
 import argparse
 import numpy as np 
 
-from pyfmm import fmaloader
-from fmmTools import fmareader, fmawriter
-
+from fmmTools import fma_reader, fma_writer
 
 
 parser = argparse.ArgumentParser(prog="read-write")
@@ -15,23 +13,29 @@ parser.add_argument("-of", "--output_file",default="output.fma",  type=str, help
 
 args = parser.parse_args()
 
-parser.print_help()
-
 filename = args.input_file
 
-
-particles, centre, width = fmareader(filename)
-
-print("centre", centre)
-print("size", width)
-
+#
+# Read the particles from file filename
+#   particles is an array of size 3 containaing numpy arrays
+#    particles[0]  the position matrix of size nb_particles x dimension
+#    particles[1]  the input matrix of size nb_particles x nb_input
+#    particles[2]  the output matrix of size nb_particles x nb_output
+#   centre is a Numpy array containing the centre of the simulation box
+#   width is the width of the simulation box
+particles, centre, width = fma_reader(filename,verbose=True)
+
+print("centre", centre, type(centre))
+print("size", width,  type(width))
 filename = args.output_file
 
-print(particles)
-
 # remove z axis
 pos = particles[0]
 particles[0] = pos[:,0:2]
+centre = centre[0:2]
+
+print("xxx centre", centre, type(centre))
+
 #
-#. Write the new particles
-fmawriter(filename,particles, centre, width)
\ No newline at end of file
+# Write the new particles 
+fma_writer(filename,particles, centre, width)
diff --git a/tools/change_file_format.cpp b/tools/change_file_format.cpp
index 4c040163d4d3cfeb678654e89add5b0e88165b02..e921801fb3145bc56dc573879d912e62e5d26b2b 100644
--- a/tools/change_file_format.cpp
+++ b/tools/change_file_format.cpp
@@ -97,9 +97,9 @@ void change_format(const std::string& input_file, int& use_old_format, const std
     bool verbose = true;
     scalfmm::io::FFmaGenericLoader<value_type, Dimension> loader(input_file, verbose, (use_old_format == 1));
 
-    const auto NbPoints = loader.getNumberOfParticles();
-    const auto nbData = loader.getNbRecordPerline();
-    const auto arraySize = nbData * NbPoints;
+    const std::size_t NbPoints = loader.getNumberOfParticles();
+    const std::size_t nbData = loader.getNbRecordPerline();
+    const std::size_t arraySize = nbData * NbPoints;
 
     std::vector<value_type> particles(arraySize, 0.0);
 
@@ -118,8 +118,8 @@ void change_format(const std::string& input_file, int& use_old_format, const std
     if(!output_file.empty())
     {
         scalfmm::io::FFmaGenericWriter<value_type> writer(output_file);
-        auto nb_input = loader.get_number_of_input_per_record();
-        auto dim = loader.get_dimension();
+        std::size_t nb_input = loader.get_number_of_input_per_record();
+        std::size_t dim = loader.get_dimension();
         if(use_old_format == 2)
         {
             writer.writeHeaderOld(loader.getCenterOfBox(), loader.getBoxWidth(), NbPoints, sizeof(value_type), nbData,