diff --git a/bob/io/base/cpp/CSVFile.cpp b/bob/io/base/cpp/CSVFile.cpp deleted file mode 100644 index 1200523a09b74eee343a14686b39ba76995cc058..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/CSVFile.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/** - * @date Thu 10 May 2012 15:19:24 CEST - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * @brief Code to read and write CSV files to/from arrays. CSV files are always - * treated as containing sequences of double precision numbers. - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#include <sstream> -#include <fstream> -#include <string> -#include <boost/filesystem.hpp> -#include <boost/format.hpp> -#include <boost/filesystem.hpp> -#include <boost/make_shared.hpp> -#include <boost/tokenizer.hpp> - -#include <boost/shared_array.hpp> -#include <boost/algorithm/string.hpp> - -#include <bob.io.base/CodecRegistry.h> - -typedef boost::tokenizer<boost::escaped_list_separator<char> > Tokenizer; - -class CSVFile: public bob::io::base::File { - - public: //api - - /** - * Peeks the file contents for a type. We assume the element type to be - * always doubles. This method, effectively, only peaks for the total - * number of lines and the number of columns in the file. - */ - void peek() { - - std::string line; - size_t line_number = 0; - size_t entries = 0; - std::streampos cur_pos = 0; - - m_file.seekg(0); //< returns to the begin of file and start reading... - - while (std::getline(m_file,line)) { - ++line_number; - m_pos.push_back(cur_pos); - cur_pos = m_file.tellg(); - Tokenizer tok(line); - size_t size = std::distance(tok.begin(), tok.end()); - if (!entries) entries = size; - else if (entries != size) { - boost::format m("line %d at file '%s' contains %d entries instead of %d (expected)"); - m % line_number % m_filename % size % entries; - throw std::runtime_error(m.str()); - } - } - - if (!line_number) { - m_newfile = true; - m_pos.clear(); - return; - } - - m_arrayset_type.dtype = bob::io::base::array::t_float64; - m_arrayset_type.nd = 1; - m_arrayset_type.shape[0] = entries; - m_arrayset_type.update_strides(); - - m_array_type = m_arrayset_type; - m_array_type.nd = 2; - m_array_type.shape[0] = m_pos.size(); - m_array_type.shape[1] = entries; - m_array_type.update_strides(); - } - - CSVFile(const char* path, char mode): - m_filename(path), - m_newfile(false) { - - if (mode == 'r' || (mode == 'a' && boost::filesystem::exists(path))) { //try peeking - - if (mode == 'r') - m_file.open(m_filename.c_str(), std::ios::in); - else if (mode == 'a') - m_file.open(m_filename.c_str(), std::ios::app|std::ios::in|std::ios::out); - if (!m_file.is_open()) { - boost::format m("cannot open file '%s' for reading or appending"); - m % path; - throw std::runtime_error(m.str()); - } - - peek(); ///< peek file properties - } - else { - m_file.open(m_filename.c_str(), std::ios::trunc|std::ios::in|std::ios::out); - - if (!m_file.is_open()) { - boost::format m("cannot open file '%s' for writing"); - m % path; - throw std::runtime_error(m.str()); - } - - m_newfile = true; - } - - //general precision settings, in case output is needed... - m_file.precision(10); - m_file.setf(std::ios_base::scientific, std::ios_base::floatfield); - - } - - virtual ~CSVFile() { } - - virtual const char* filename() const { - return m_filename.c_str(); - } - - virtual const bob::io::base::array::typeinfo& type() const { - return m_arrayset_type; - } - - virtual const bob::io::base::array::typeinfo& type_all() const { - return m_array_type; - } - - virtual size_t size() const { - return m_pos.size(); - } - - virtual const char* name() const { - return s_codecname.c_str(); - } - - virtual void read_all(bob::io::base::array::interface& buffer) { - if (m_newfile) - throw std::runtime_error("uninitialized CSV file cannot be read"); - - if (!buffer.type().is_compatible(m_array_type)) buffer.set(m_array_type); - - //read contents - std::string line; - if (m_file.eof()) m_file.clear(); ///< clear current "end" state. - m_file.seekg(0); - double* p = static_cast<double*>(buffer.ptr()); - while (std::getline(m_file, line)) { - Tokenizer tok(line); - for(Tokenizer::iterator k=tok.begin(); k!=tok.end(); ++k) { - std::istringstream(*k) >> *(p++); - } - } - } - - virtual void read(bob::io::base::array::interface& buffer, size_t index) { - - if (m_newfile) - throw std::runtime_error("uninitialized CSV file cannot be read"); - - if (!buffer.type().is_compatible(m_arrayset_type)) - buffer.set(m_arrayset_type); - - if (index >= m_pos.size()) { - boost::format m("cannot array at position %d -- there is only %d entries at file '%s'"); - m % index % m_pos.size() % m_filename; - throw std::runtime_error(m.str()); - } - - //reads a specific line from the file. - std::string line; - if (m_file.eof()) m_file.clear(); ///< clear current "end" state. - m_file.seekg(m_pos[index]); - if (!std::getline(m_file, line)) { - boost::format m("could not seek to line %u (offset %u) while reading file '%s'"); - m % index % m_pos[index] % m_filename; - throw std::runtime_error(m.str()); - } - Tokenizer tok(line); - double* p = static_cast<double*>(buffer.ptr()); - for(Tokenizer::iterator k=tok.begin(); k!=tok.end(); ++k) { - std::istringstream(*k) >> *(p++); - } - - } - - virtual size_t append (const bob::io::base::array::interface& buffer) { - - const bob::io::base::array::typeinfo& type = buffer.type(); - - if (m_newfile) { - if (type.nd != 1 || type.dtype != bob::io::base::array::t_float64) { - boost::format m("cannot append %s to file '%s' - CSV files only accept 1D double precision float arrays"); - m % type.str() % m_filename; - throw std::runtime_error(m.str()); - } - m_pos.clear(); - m_arrayset_type = m_array_type = type; - m_array_type.shape[1] = m_arrayset_type.shape[0]; - m_newfile = false; - } - - else { - - //check compatibility - if (!m_arrayset_type.is_compatible(buffer.type())) { - boost::format m("CSV file '%s' only accepts arrays of type %s"); - m % m_filename % m_arrayset_type.str(); - throw std::runtime_error(m.str()); - } - - } - - const double* p = static_cast<const double*>(buffer.ptr()); - if (m_pos.size()) m_file << std::endl; ///< adds a new line - m_pos.push_back(m_file.tellp()); ///< register start of line - for (size_t k=1; k<type.shape[0]; ++k) m_file << *(p++) << ","; - m_file << *(p++); - m_array_type.shape[0] = m_pos.size(); - m_array_type.update_strides(); - return (m_pos.size()-1); - - } - - virtual void write (const bob::io::base::array::interface& buffer) { - - const bob::io::base::array::typeinfo& type = buffer.type(); - - if (m_newfile) { - if (type.nd != 2 || type.dtype != bob::io::base::array::t_float64) { - boost::format m("cannot write %s to file '%s' - CSV files only accept a single 2D double precision float array as input"); - m % type.str() % m_filename; - throw std::runtime_error(m.str()); - } - const double* p = static_cast<const double*>(buffer.ptr()); - for (size_t l=1; l<type.shape[0]; ++l) { - m_pos.push_back(m_file.tellp()); - for (size_t k=1; k<type.shape[1]; ++k) m_file << *(p++) << ","; - m_file << *(p++) << std::endl; - } - for (size_t k=1; k<type.shape[1]; ++k) m_file << *(p++) << ","; - m_file << *(p++); - m_arrayset_type = type; - m_arrayset_type.nd = 1; - m_arrayset_type.shape[0] = type.shape[1]; - m_arrayset_type.update_strides(); - m_array_type = type; - m_newfile = false; - return; - } - - //TODO - throw std::runtime_error("Writing a 2D array to a CSV file that already contains entries is not implemented at the moment"); - - } - - private: //representation - std::fstream m_file; - std::string m_filename; - bool m_newfile; - bob::io::base::array::typeinfo m_array_type; - bob::io::base::array::typeinfo m_arrayset_type; - std::vector<std::streampos> m_pos; ///< dictionary of line starts - - static std::string s_codecname; - -}; - -std::string CSVFile::s_codecname = "bob.csv"; - -/** - * From this point onwards we have the registration procedure. If you are - * looking at this file for a coding example, just follow the procedure bellow, - * minus local modifications you may need to apply. - */ - -/** - * This defines the factory method F that can create codecs of this type. - * - * Here are the meanings of the mode flag that should be respected by your - * factory implementation: - * - * 'r': opens for reading only - no modifications can occur; it is an - * error to open a file that does not exist for read-only operations. - * 'w': opens for reading and writing, but truncates the file if it - * exists; it is not an error to open files that do not exist with - * this flag. - * 'a': opens for reading and writing - any type of modification can - * occur. If the file does not exist, this flag is effectively like - * 'w'. - * - * Returns a newly allocated File object that can read and write data to the - * file using a specific backend. - * - * @note: This method can be static. - */ -static boost::shared_ptr<bob::io::base::File> make_file (const char* path, char mode) { - return boost::make_shared<CSVFile>(path, mode); -} - -/** - * Takes care of codec registration per se. - */ -static bool register_codec() { - - boost::shared_ptr<bob::io::base::CodecRegistry> instance = - bob::io::base::CodecRegistry::instance(); - - instance->registerExtension(".csv", "Comma-Separated Values", &make_file); - instance->registerExtension(".txt", "Comma-Separated Values", &make_file); - - return true; - -} - -static bool codec_registered = register_codec(); diff --git a/bob/io/base/cpp/T3File.cpp b/bob/io/base/cpp/T3File.cpp deleted file mode 100644 index 8380a62fd912aa370f06f7e307c6fe614559eb81..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/T3File.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/** - * @date Wed Oct 26 17:11:16 2011 +0200 - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * @brief Implements a torch3vision bindata reader/writer - * The format, as described in the old source code goes like this. - * 1) data is always recorded in little endian format - * 2) the first 4 bytes describe an integer that indicates the number of arrays - * to follow - * 3) the second 4 bytes describe an integer that specifies the frame width. - * 4) all arrays inserted there are single dimensional arrays. - * 5) all elements from all arrays are "normally" float (4-bytes), but could be - * double if set in the header of T3 during compilation. The file size will - * indicate the right type to use. - * Because of this restriction, this codec will only be able to work with - * single-dimension input. - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#include <fstream> -#include <boost/filesystem.hpp> -#include <boost/make_shared.hpp> -#include <boost/format.hpp> - -//some infrastructure to check the file size -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <bob.core/check.h> - -#include <bob.io.base/CodecRegistry.h> -#include <bob.io.base/blitz_array.h> - -static inline size_t get_filesize(const char* filename) { - struct stat filestatus; - stat(filename, &filestatus); - return filestatus.st_size; -} - -class T3File: public bob::io::base::File { - - public: //api - - T3File(const char* path, char mode): - m_filename(path), - m_newfile(true), - m_length(0) { - if ( mode == 'r' || (mode == 'a' && boost::filesystem::exists(path) ) ) { // try peek - size_t fsize = get_filesize(path); - fsize -= 8; // remove the first two entries - // read the first two 4-byte integers in the file, convert to unsigned - - std::fstream s(path, std::ios::binary|std::ios::in); - - if (!s) { - boost::format m("cannot open file `%s'"); - m % path; - throw std::runtime_error(m.str()); - } - - uint32_t nsamples, framesize; - nsamples = framesize = 0; - s.read((char*)&nsamples, sizeof(uint32_t)); - s.read((char*)&framesize, sizeof(uint32_t)); - - m_length = nsamples; - - // are those floats or doubles? - if (fsize == (nsamples*framesize*sizeof(float))) { - m_type_array.dtype = bob::io::base::array::t_float32; - m_type_arrayset.dtype = bob::io::base::array::t_float32; - } - else if (fsize == (nsamples*framesize*sizeof(double))) { - m_type_array.dtype = bob::io::base::array::t_float64; - m_type_arrayset.dtype = bob::io::base::array::t_float64; - } - else { - boost::format s("Cannot read file '%s', mode = '%c': fsize (%d) != %d*%d*sizeof(float32) nor *sizeof(float64)"); - s % path % mode % fsize % nsamples % framesize; - throw std::runtime_error(s.str()); - } - - size_t shape[2] = {nsamples, framesize}; - m_type_array.set_shape<size_t>(2, &shape[0]); - m_type_arrayset.set_shape<size_t>(1, &shape[1]); - m_newfile = false; - - } - } - - virtual ~T3File() { } - - virtual const char* filename() const { - return m_filename.c_str(); - } - - virtual const bob::io::base::array::typeinfo& type_all () const { - return m_type_array; - } - - virtual const bob::io::base::array::typeinfo& type () const { - return m_type_arrayset; - } - - virtual size_t size() const { - return m_length; - } - - virtual const char* name() const { - return s_codecname.c_str(); - } - - virtual void read_all(bob::io::base::array::interface& buffer) { - - if (m_newfile) { - boost::format f("cannot read uninitialized t3 binary file at '%s'"); - f % m_filename; - throw std::runtime_error(f.str()); - } - - if (!buffer.type().is_compatible(m_type_array)) buffer.set(m_type_array); - - //open the file, now for reading the contents... - std::ifstream ifile(m_filename.c_str(), std::ios::binary|std::ios::in); - - //skip the first 8 bytes, that contain the header that we already read - ifile.seekg(8, std::ios::beg); - ifile.read(static_cast<char*>(buffer.ptr()), buffer.type().buffer_size()); - - } - - virtual void read(bob::io::base::array::interface& buffer, size_t index) { - - if (m_newfile) { - boost::format f("cannot read uninitialized t3 binary file at '%s'"); - f % m_filename; - throw std::runtime_error(f.str()); - } - - const bob::io::base::array::typeinfo& type = buffer.type(); - - if (!buffer.type().is_compatible(m_type_arrayset)) buffer.set(m_type_arrayset); - - //open the file, now for reading the contents... - std::ifstream ifile(m_filename.c_str(), std::ios::binary|std::ios::in); - - //skip the first 8 bytes, that contain the header that we already read - ifile.seekg(8 + (index*type.buffer_size()), std::ios::beg); - ifile.read(static_cast<char*>(buffer.ptr()), type.buffer_size()); - - } - - virtual size_t append (const bob::io::base::array::interface& buffer) { - - const bob::io::base::array::typeinfo& info = buffer.type(); - - if (!m_newfile && !info.is_compatible(m_type_arrayset)) { - boost::format f("input buffer of type %s cannot be appended to already initialized torch3vision binary file of type %s"); - f % info.str() % m_type_arrayset.str(); - throw std::runtime_error(f.str()); - } - - std::ofstream ofile; - if (m_newfile) { - - //can only save uni-dimensional data, so throw if that is not the case - if (info.nd != 1) { - boost::format m("codec for torch3vision binary files can only save uni-dimensional data, but you passed: %s"); - m % info.str(); - throw std::runtime_error(m.str()); - } - - //can only save float32 or float64, otherwise, throw. - if ((info.dtype != bob::io::base::array::t_float32) && - (info.dtype != bob::io::base::array::t_float64)) { - boost::format f("cannot have T3 bindata files with type %s - only float32 or float64"); - f % bob::io::base::array::stringize(info.dtype); - throw std::runtime_error(f.str()); - } - - ofile.open(m_filename.c_str(), std::ios::binary|std::ios::out|std::ios::trunc); - - //header writing... - const uint32_t nsamples = 0; - const uint32_t framesize = info.shape[0]; - ofile.write((const char*)&nsamples, sizeof(uint32_t)); - ofile.write((const char*)&framesize, sizeof(uint32_t)); - - m_type_arrayset = info; - m_type_array.dtype = info.dtype; - m_newfile = false; ///< block re-initialization - m_length = 0; - - } - else { - //only open the file, the rest is setup already - ofile.open(m_filename.c_str(), std::ios::binary|std::ios::out|std::ios::app); - } - - if (!ofile) { - boost::format f("cannot open output file '%s' for writing"); - f % m_filename; - throw std::runtime_error(f.str()); - } - - ofile.write(static_cast<const char*>(buffer.ptr()), info.buffer_size()); - ofile.close(); - - //setup new type information - ++m_length; - size_t shape[2] = {m_length, info.shape[0]}; - m_type_array.set_shape<size_t>(2, &shape[0]); - - //update the header information on the file - ofile.open(m_filename.c_str(), std::ios::binary|std::ios::in|std::ios::out); - const uint32_t nsamples = m_length; - ofile.write((const char*)&nsamples, sizeof(uint32_t)); - ofile.flush(); - return m_length-1; - - } - - /** - * Supports writing a single vector or a set of vectors represented as a - * matrix. In this last case, vectors are formed from the rows of the given - * matrix. - */ - virtual void write (const bob::io::base::array::interface& buffer) { - - m_newfile = true; //force file re-setting - const bob::io::base::array::typeinfo& info = buffer.type(); - - if (info.nd == 1) {//just do a normal append - append(buffer); - } - - else if (info.nd == 2) { //append every array individually - - const uint8_t* ptr = static_cast<const uint8_t*>(buffer.ptr()); - bob::io::base::array::typeinfo slice_info(info.dtype, static_cast<size_t>(1), - &info.shape[1]); - for (size_t k=0; k<info.shape[0]; ++k) { - const void* slice_ptr=static_cast<const void*>(ptr+k*slice_info.buffer_size()); - bob::io::base::array::blitz_array slice(const_cast<void*>(slice_ptr), slice_info); - append(slice); - } - - } - - else { - boost::format f("cannot do single write of torch3vision .bindata file with array with type '%s' - only supports 1D or 2D arrays of types float32 or float64"); - f % info.str(); - throw std::runtime_error(f.str()); - } - - } - - private: //representation - - std::string m_filename; - bool m_newfile; - bob::io::base::array::typeinfo m_type_array; - bob::io::base::array::typeinfo m_type_arrayset; - size_t m_length; - - static std::string s_codecname; - -}; - -std::string T3File::s_codecname = "torch3.binary"; - -/** - * From this point onwards we have the registration procedure. If you are - * looking at this file for a coding example, just follow the procedure bellow, - * minus local modifications you may need to apply. - */ - -/** - * This defines the factory method F that can create codecs of this type. - * - * Here are the meanings of the mode flag that should be respected by your - * factory implementation: - * - * 'r': opens for reading only - no modifications can occur; it is an - * error to open a file that does not exist for read-only operations. - * 'w': opens for reading and writing, but truncates the file if it - * exists; it is not an error to open files that do not exist with - * this flag. - * 'a': opens for reading and writing - any type of modification can - * occur. If the file does not exist, this flag is effectively like - * 'w'. - * - * Returns a newly allocated File object that can read and write data to the - * file using a specific backend. - * - * @note: This method can be static. - */ -static boost::shared_ptr<bob::io::base::File> make_file (const char* path, char mode) { - return boost::make_shared<T3File>(path, mode); -} - -/** - * Takes care of codec registration per se. - */ -static bool register_codec() { - - boost::shared_ptr<bob::io::base::CodecRegistry> instance = - bob::io::base::CodecRegistry::instance(); - - instance->registerExtension(".bindata", "torch3 binary data format", &make_file); - - return true; - -} - -static bool codec_registered = register_codec(); diff --git a/bob/io/base/cpp/TensorArrayFile.cpp b/bob/io/base/cpp/TensorArrayFile.cpp deleted file mode 100644 index d0cb72d82c948519126ac0e4dcfe237197d017b4..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/TensorArrayFile.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/** - * @date Wed Oct 26 17:11:16 2011 +0200 - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * @brief Implements the TensorArrayCodec type - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#include "TensorFile.h" -#include <bob.io.base/CodecRegistry.h> - -class TensorArrayFile: public bob::io::base::File { - - public: //api - - TensorArrayFile(const char* path, bob::io::base::TensorFile::openmode mode): - m_file(path, mode), - m_filename(path) { - if (m_file.size()) m_file.peek(m_type); - } - - virtual ~TensorArrayFile() { } - - virtual const char* filename() const { - return m_filename.c_str(); - } - - virtual const bob::io::base::array::typeinfo& type_all () const { - return m_type; - } - - virtual const bob::io::base::array::typeinfo& type () const { - return m_type; - } - - virtual size_t size() const { - return m_file.size(); - } - - virtual const char* name() const { - return s_codecname.c_str(); - } - - virtual void read_all(bob::io::base::array::interface& buffer) { - - if(!m_file) - throw std::runtime_error("uninitialized binary file cannot be read"); - - m_file.read(0, buffer); - - } - - virtual void read(bob::io::base::array::interface& buffer, size_t index) { - - if(!m_file) - throw std::runtime_error("uninitialized binary file cannot be read"); - - m_file.read(index, buffer); - - } - - virtual size_t append (const bob::io::base::array::interface& buffer) { - - m_file.write(buffer); - - if (size() == 1) m_file.peek(m_type); - - return size() - 1; - - } - - virtual void write (const bob::io::base::array::interface& buffer) { - - //we don't have a special way to treat write()'s like in HDF5. - append(buffer); - - } - - private: //representation - - bob::io::base::TensorFile m_file; - bob::io::base::array::typeinfo m_type; - std::string m_filename; - - static std::string s_codecname; - -}; - -std::string TensorArrayFile::s_codecname = "bob.tensor"; - -/** - * From this point onwards we have the registration procedure. If you are - * looking at this file for a coding example, just follow the procedure bellow, - * minus local modifications you may need to apply. - */ - -/** - * This defines the factory method F that can create codecs of this type. - * - * Here are the meanings of the mode flag that should be respected by your - * factory implementation: - * - * 'r': opens for reading only - no modifications can occur; it is an - * error to open a file that does not exist for read-only operations. - * 'w': opens for reading and writing, but truncates the file if it - * exists; it is not an error to open files that do not exist with - * this flag. - * 'a': opens for reading and writing - any type of modification can - * occur. If the file does not exist, this flag is effectively like - * 'w'. - * - * Returns a newly allocated File object that can read and write data to the - * file using a specific backend. - * - * @note: This method can be static. - */ -static boost::shared_ptr<bob::io::base::File> make_file (const char* path, char mode) { - - bob::io::base::TensorFile::openmode _mode; - if (mode == 'r') _mode = bob::io::base::TensorFile::in; - else if (mode == 'w') _mode = bob::io::base::TensorFile::out; - else if (mode == 'a') _mode = bob::io::base::TensorFile::append; - else throw std::runtime_error("unsupported tensor file opening mode"); - - return boost::make_shared<TensorArrayFile>(path, _mode); - -} - -/** - * Takes care of codec registration per se. - */ -static bool register_codec() { - - boost::shared_ptr<bob::io::base::CodecRegistry> instance = - bob::io::base::CodecRegistry::instance(); - - instance->registerExtension(".tensor", "torch3vision v2.1 tensor files", &make_file); - - return true; - -} - -static bool codec_registered = register_codec(); diff --git a/bob/io/base/cpp/TensorFile.cpp b/bob/io/base/cpp/TensorFile.cpp deleted file mode 100644 index 8f9ff3455c245613c6b0b2c31e327856493089ed..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/TensorFile.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/** - * @date Wed Jun 22 17:50:08 2011 +0200 - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * @brief This class can be used to store and load multiarrays into/from files. - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#include "TensorFile.h" - -#include <bob.io.base/reorder.h> -#include <bob.io.base/array_type.h> - -// see: http://stackoverflow.com/questions/13061979/shared-ptr-to-an-array-should-it-be-used -template< typename T > -struct array_deleter -{ - void operator ()( T const * p) - { - delete[] p; - } -}; - -bob::io::base::TensorFile::TensorFile(const std::string& filename, - bob::io::base::TensorFile::openmode flag): - m_header_init(false), - m_current_array(0), - m_n_arrays_written(0), - m_openmode(flag) -{ - if((flag & bob::io::base::TensorFile::out) && (flag & bob::io::base::TensorFile::in)) { - m_stream.open(filename.c_str(), std::ios::in | std::ios::out | - std::ios::binary); - if(m_stream) - { - m_header.read(m_stream); - m_buffer.reset(new char[m_header.m_type.buffer_size()], array_deleter<char>()); - m_header_init = true; - m_n_arrays_written = m_header.m_n_samples; - - if (flag & bob::io::base::TensorFile::append) { - m_stream.seekp(0, std::ios::end); - m_current_array = m_header.m_n_samples; - } - } - } - else if(flag & bob::io::base::TensorFile::out) { - if(m_stream && (flag & bob::io::base::TensorFile::append)) { - m_stream.open(filename.c_str(), std::ios::out | std::ios::in | - std::ios::binary); - m_header.read(m_stream); - m_buffer.reset(new char[m_header.m_type.buffer_size()], array_deleter<char>()); - m_header_init = true; - m_n_arrays_written = m_header.m_n_samples; - m_stream.seekp(0, std::ios::end); - m_current_array = m_header.m_n_samples; - } - else - m_stream.open(filename.c_str(), std::ios::out | std::ios::binary); - } - else if(flag & bob::io::base::TensorFile::in) { - m_stream.open(filename.c_str(), std::ios::in | std::ios::binary); - if(m_stream) { - m_header.read(m_stream); - m_buffer.reset(new char[m_header.m_type.buffer_size()], array_deleter<char>()); - m_header_init = true; - m_n_arrays_written = m_header.m_n_samples; - - if (flag & bob::io::base::TensorFile::append) { - throw std::runtime_error("cannot append data in read only mode"); - } - } - } - else { - throw std::runtime_error("invalid combination of flags"); - } -} - -bob::io::base::TensorFile::~TensorFile() { - close(); -} - -void bob::io::base::TensorFile::peek(bob::io::base::array::typeinfo& info) const { - info = m_header.m_type; -} - -void bob::io::base::TensorFile::close() { - // Rewrite the header and update the number of samples - m_header.m_n_samples = m_n_arrays_written; - if(m_openmode & bob::io::base::TensorFile::out) m_header.write(m_stream); - - m_stream.close(); -} - -void bob::io::base::TensorFile::initHeader(const bob::io::base::array::typeinfo& info) { - // Check that data have not already been written - if (m_n_arrays_written > 0 ) { - throw std::runtime_error("cannot init the header of an output stream in which data have already been written"); - } - - // Initialize header - m_header.m_type = info; - m_header.m_tensor_type = bob::io::base::arrayTypeToTensorType(info.dtype); - m_header.write(m_stream); - - // Temporary buffer to help with data transposition... - m_buffer.reset(new char[m_header.m_type.buffer_size()], array_deleter<char>()); - - m_header_init = true; -} - -void bob::io::base::TensorFile::write(const bob::io::base::array::interface& data) { - - const bob::io::base::array::typeinfo& info = data.type(); - - if (!m_header_init) initHeader(info); - else { - //checks compatibility with previously written stuff - if (!m_header.m_type.is_compatible(info)) - throw std::runtime_error("buffer does not conform to expected type"); - } - - bob::io::base::row_to_col_order(data.ptr(), m_buffer.get(), info); - - m_stream.write(static_cast<const char*>(m_buffer.get()), info.buffer_size()); - - // increment m_n_arrays_written and m_current_array - ++m_current_array; - if (m_current_array>m_n_arrays_written) ++m_n_arrays_written; -} - -void bob::io::base::TensorFile::read (bob::io::base::array::interface& buf) { - - if(!m_header_init) { - throw std::runtime_error("TensorFile: header is not initialized"); - } - if(!buf.type().is_compatible(m_header.m_type)) buf.set(m_header.m_type); - - m_stream.read(reinterpret_cast<char*>(m_buffer.get()), - m_header.m_type.buffer_size()); - - bob::io::base::col_to_row_order(m_buffer.get(), buf.ptr(), m_header.m_type); - - ++m_current_array; -} - -void bob::io::base::TensorFile::read (size_t index, bob::io::base::array::interface& buf) { - - // Check that we are reaching an existing array - if( index > m_header.m_n_samples ) { - boost::format m("request to read list item at position %d which is outside the bounds of declared object with size %d"); - m % index % m_header.m_n_samples; - throw std::runtime_error(m.str()); - } - - // Set the stream pointer at the correct position - m_stream.seekg( m_header.getArrayIndex(index) ); - m_current_array = index; - - // Put the content of the stream in the blitz array. - read(buf); -} diff --git a/bob/io/base/cpp/TensorFile.h b/bob/io/base/cpp/TensorFile.h deleted file mode 100644 index 35d42bfcea4d9a25084b82c28f008acb0f9f0609..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/TensorFile.h +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @date Wed Jun 22 17:50:08 2011 +0200 - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * @brief This class can be used to load and store arrays from/to .tensor files - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#ifndef BOB_IO_TENSORFILE_H -#define BOB_IO_TENSORFILE_H - -#include <boost/format.hpp> -#include <stdexcept> - -#include <bob.io.base/blitz_array.h> - -#include "TensorFileHeader.h" - -namespace bob { namespace io { namespace base { - - /** - * Defines the flags that might be used when loading/storing a file - * containing blitz arrays. - */ - enum _TensorFileFlag { - _unset = 0, - _append = 1L << 0, - _in = 1L << 3, - _out = 1L << 4 - }; - - /** - * This class can be used for loading and storing multiarrays from/to - * tensor files - */ - class TensorFile - { - public: - /** - * Defines the bitmask type for providing information about the type of - * the stream. - */ - typedef _TensorFileFlag openmode; - static const openmode append = _append; - static const openmode in = _in; - static const openmode out = _out; - - /** - * Constructor - */ - TensorFile(const std::string& filename, openmode f); - - /** - * Destructor - */ - ~TensorFile(); - - /** - * Tests if next operation will succeed. - */ - inline bool operator!() const { return !m_stream; } - - /** - * Closes the TensorFile - */ - void close(); - - /** - * Puts an Array of a given type into the output stream/file. If the - * type/shape have not yet been set, it is set according to the type - * and shape given in the blitz array, otherwise the type/shape should - * match or an exception is thrown. - * - * Please note that blitz::Array<> will be implicitly constructed as - * required and respecting those norms. - * - * @warning: Please convert your files to HDF5, this format is - * deprecated starting on 16.04.2011 - AA - */ - void write(const bob::io::base::array::interface& data); - - /** - * Reads the file data into a bob::io::base::array::interface - this variant reads the next - * variable. The bob::io::base::array::interface size will be reset if required. - */ - void read(bob::io::base::array::interface& data); - - /** - * Reads the file data into a bob::io::base::array::interface - this variant allows the - * specification of a position to read data from. The bob::io::base::array::interface size will be - * reset if required. - */ - void read (size_t index, bob::io::base::array::interface& data); - - /** - * Peeks the file and returns the currently set typeinfo - */ - void peek(bob::io::base::array::typeinfo& info) const; - - /** - * Gets the number of samples/arrays written so far - * - * @warning An exception is thrown if nothing was written so far - */ - inline size_t size() const { - return (m_header_init)? m_n_arrays_written : 0; - } - - /** - * Gets the number of elements per array - * - * @warning An exception is thrown if nothing was written so far - */ - inline size_t getNElements() const { - headerInitialized(); - return m_header.getNElements(); - } - - /** - * Gets the size along a particular dimension - * - * @warning An exception is thrown if nothing was written so far - */ - inline size_t getSize(size_t dim_index) const { - headerInitialized(); - return m_header.m_type.shape[dim_index]; - } - - /** - * Initializes the tensor file with the given type and shape. - */ - inline void initTensorFile(const bob::io::base::array::typeinfo& info) { - initHeader(info); - } - - private: //Some stuff I need privately - - /** - * Checks if the end of the tensor file is reached - */ - inline void endOfFile() { - if(m_current_array >= m_header.m_n_samples ) { - boost::format m("TensorFile::endOfFile(): current array index == %d is outside the bounds of declared object with size %d"); - m % m_current_array % m_header.m_n_samples; - throw std::runtime_error(m.str()); - } - } - - /** - * Checks that the header has been initialized, and raise an - * exception if not - */ - inline void headerInitialized() const { - if (!m_header_init) { - throw std::runtime_error("TensorFile: header is not initialized"); - } - } - - /** - * Initializes the header of the (output) stream with the given type - * and shape - */ - void initHeader(const bob::io::base::array::typeinfo& info); - - public: - - /******************************************************************** - * Specific blitz::Array<> operations - ********************************************************************/ - - - /** - * A shortcut to write a blitz::Array<T,D> - * - * @warning: Please convert your files to HDF5, this format is - * deprecated starting on 16.04.2011 - AA - */ - template <typename T, int D> - inline void write(blitz::Array<T,D>& bz) { - write(bob::io::base::array::blitz_array(bz)); - } - - /** - * Load one blitz++ multiarray from the input stream/file All the - * multiarrays saved have the same dimensions. - */ - template <typename T, int D> inline blitz::Array<T,D> read() { - bob::io::base::array::typeinfo info; - peek(info); - bob::io::base::array::blitz_array buf(info); - read(buf); - return bob::io::base::array::cast<T,D>(buf); - } - - template <typename T, int D> inline blitz::Array<T,D> read(size_t - index) { - bob::io::base::array::typeinfo info; - peek(info); - bob::io::base::array::blitz_array buf(info); - read(index, buf); - return bob::io::base::array::cast<T,D>(buf); - } - - private: //representation - - bool m_header_init; - size_t m_current_array; - size_t m_n_arrays_written; - std::fstream m_stream; - detail::TensorFileHeader m_header; - openmode m_openmode; - boost::shared_ptr<void> m_buffer; - }; - - inline _TensorFileFlag operator&(_TensorFileFlag a, _TensorFileFlag b) { - return _TensorFileFlag(static_cast<int>(a) & static_cast<int>(b)); - } - - inline _TensorFileFlag operator|(_TensorFileFlag a, _TensorFileFlag b) { - return _TensorFileFlag(static_cast<int>(a) | static_cast<int>(b)); - } - - inline _TensorFileFlag operator^(_TensorFileFlag a, _TensorFileFlag b) { - return _TensorFileFlag(static_cast<int>(a) ^ static_cast<int>(b)); - } - - inline _TensorFileFlag& operator|=(_TensorFileFlag& a, _TensorFileFlag b) { - return a = a | b; - } - - inline _TensorFileFlag& operator&=(_TensorFileFlag& a, _TensorFileFlag b) { - return a = a & b; - } - - inline _TensorFileFlag& operator^=(_TensorFileFlag& a, _TensorFileFlag b) { - return a = a ^ b; - } - - inline _TensorFileFlag operator~(_TensorFileFlag a) { - return _TensorFileFlag(~static_cast<int>(a)); - } - -}}} - -#endif /* BOB_IO_BINFILE_H */ diff --git a/bob/io/base/cpp/TensorFileHeader.cpp b/bob/io/base/cpp/TensorFileHeader.cpp deleted file mode 100644 index fb96a13b5d383eebed1c59467185272ded2a2547..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/TensorFileHeader.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @date Wed Jun 22 17:50:08 2011 +0200 - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * This class defines an header for storing multiarrays into .tensor files. - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#include <boost/format.hpp> - -#include "TensorFileHeader.h" - -bob::io::base::detail::TensorFileHeader::TensorFileHeader() - : m_tensor_type(bob::io::base::Char), - m_type(), - m_n_samples(0), - m_tensor_size(0) -{ -} - -bob::io::base::detail::TensorFileHeader::~TensorFileHeader() { } - -size_t bob::io::base::detail::TensorFileHeader::getArrayIndex (size_t index) const { - size_t header_size = 7 * sizeof(int); - return header_size + index * m_tensor_size; -} - -void bob::io::base::detail::TensorFileHeader::read(std::istream& str) { - // Start reading at the beginning of the stream - str.seekg(std::ios_base::beg); - - int val; - str.read( reinterpret_cast<char*>(&val), sizeof(int)); - m_tensor_type = (bob::io::base::TensorType)val; - m_type.dtype = bob::io::base::tensorTypeToArrayType(m_tensor_type); - - str.read( reinterpret_cast<char*>(&val), sizeof(int)); - m_n_samples = (size_t)val; - - int nd; - str.read(reinterpret_cast<char*>(&nd), sizeof(int)); - - int shape[BOB_MAX_DIM]; - - str.read( reinterpret_cast<char*>(&val), sizeof(int)); - shape[0] = (size_t)val; - str.read( reinterpret_cast<char*>(&val), sizeof(int)); - shape[1] = (size_t)val; - str.read( reinterpret_cast<char*>(&val), sizeof(int)); - shape[2] = (size_t)val; - str.read( reinterpret_cast<char*>(&val), sizeof(int)); - shape[3] = (size_t)val; - - m_type.set_shape(nd, shape); - - header_ok(); -} - -void bob::io::base::detail::TensorFileHeader::write(std::ostream& str) const -{ - // Start writing at the beginning of the stream - str.seekp(std::ios_base::beg); - - int val; - val = (int)m_tensor_type; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); - val = (int)m_n_samples; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); - val = (int)m_type.nd; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); - val = (int)m_type.shape[0]; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); - val = (int)m_type.shape[1]; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); - val = (int)m_type.shape[2]; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); - val = (int)m_type.shape[3]; - str.write( reinterpret_cast<char*>(&val), sizeof(int)); -} - -void bob::io::base::detail::TensorFileHeader::header_ok() -{ - // Check the type - switch (m_tensor_type) - { - // supported tensor types - case bob::io::base::Char: - case bob::io::base::Short: - case bob::io::base::Int: - case bob::io::base::Long: - case bob::io::base::Float: - case bob::io::base::Double: - break; - // error - default: - throw std::runtime_error("unsupported data type found while scanning header of tensor file"); - } - - // Check the number of samples and dimensions - if( m_type.nd < 1 || m_type.nd > 4) { - boost::format m("header for tensor file indicates an unsupported type: %s"); - m % m_type.str(); - throw std::runtime_error(m.str()); - } - - // OK - update(); -} - -void bob::io::base::detail::TensorFileHeader::update() -{ - size_t base_size = 0; - switch (m_tensor_type) - { - case bob::io::base::Char: base_size = sizeof(char); break; - case bob::io::base::Short: base_size = sizeof(short); break; - case bob::io::base::Int: base_size = sizeof(int); break; - case bob::io::base::Long: base_size = sizeof(long); break; - case bob::io::base::Float: base_size = sizeof(float); break; - case bob::io::base::Double: base_size = sizeof(double); break; - default: - throw std::runtime_error("unsupported data type found while updating tensor file"); - } - - size_t tsize = 1; - for(size_t i = 0; i < m_type.nd; ++i) tsize *= m_type.shape[i]; - - m_tensor_size = tsize * base_size; -} - - -bob::io::base::TensorType bob::io::base::arrayTypeToTensorType(bob::io::base::array::ElementType eltype) -{ - switch(eltype) - { - case bob::io::base::array::t_int8: - return bob::io::base::Char; - case bob::io::base::array::t_int16: - return bob::io::base::Short; - case bob::io::base::array::t_int32: - return bob::io::base::Int; - case bob::io::base::array::t_int64: - return bob::io::base::Long; - case bob::io::base::array::t_float32: - return bob::io::base::Float; - case bob::io::base::array::t_float64: - return bob::io::base::Double; - default: - throw std::runtime_error("unsupported data type found while converting array type to tensor type"); - } -} - -bob::io::base::array::ElementType bob::io::base::tensorTypeToArrayType(bob::io::base::TensorType tensortype) -{ - switch(tensortype) - { - case bob::io::base::Char: - return bob::io::base::array::t_int8; - case bob::io::base::Short: - return bob::io::base::array::t_int16; - case bob::io::base::Int: - return bob::io::base::array::t_int32; - case bob::io::base::Long: - return bob::io::base::array::t_int64; - case bob::io::base::Float: - return bob::io::base::array::t_float32; - case bob::io::base::Double: - return bob::io::base::array::t_float64; - default: - throw std::runtime_error("unsupported data type found while converting tensor type to array type"); - } -} diff --git a/bob/io/base/cpp/TensorFileHeader.h b/bob/io/base/cpp/TensorFileHeader.h deleted file mode 100644 index 7e852b829997eb2f07914123e88646ccbd1f2fcb..0000000000000000000000000000000000000000 --- a/bob/io/base/cpp/TensorFileHeader.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @date Wed Jun 22 17:50:08 2011 +0200 - * @author Andre Anjos <andre.anjos@idiap.ch> - * - * @brief This class defines an header for storing multiarrays into - * .tensor files. - * - * Copyright (C) Idiap Research Institute, Martigny, Switzerland - */ - -#ifndef BOB_IO_BASE_TENSORFILEHEADER_H -#define BOB_IO_BASE_TENSORFILEHEADER_H - -#include <fstream> -#include <blitz/array.h> - -#include <bob.io.base/array.h> - -namespace bob { namespace io { namespace base { - - // TensorType - enum TensorType - { - Char, - Short, - Int, - Long, - Float, - Double - }; - - TensorType arrayTypeToTensorType(bob::io::base::array::ElementType eltype); - bob::io::base::array::ElementType tensorTypeToArrayType(bob::io::base::TensorType tensortype); - - namespace detail { - /** - * The Header for storing arrays into binary files. Please note that this - * class is for private use of the TensorFile type. - */ - struct TensorFileHeader { - - /** - * Constructor - */ - TensorFileHeader(); - - /** - * Destructor - */ - virtual ~TensorFileHeader(); - - /** - * Gets the offset of some array in the file - */ - size_t getArrayIndex(size_t index) const; - - /** - * Writes the header into an output stream - */ - void write(std::ostream& str) const; - - /** - * Reads the header from an input stream - */ - void read(std::istream& str); - - /** - * Gets number of elements in binary file - */ - inline size_t getNElements() const { - size_t tmp = 1; - for(size_t i=0; i<m_type.nd; ++i) tmp *= m_type.shape[i]; - return tmp; - } - - /** - * Checks if the header is valid - */ - void header_ok(); - - /** - * Update the TensorSize value - */ - void update(); - - //representation - TensorType m_tensor_type; ///< array element type - bob::io::base::array::typeinfo m_type; ///< the type information - size_t m_n_samples; ///< total number of arrays in the file - size_t m_tensor_size; ///< the number of dimensions in each array - }; - -}}}} - -#endif /* BOB_IO_BASE_TENSORFILEHEADER_H */ diff --git a/bob/io/base/data/torch.tensor b/bob/io/base/data/torch.tensor deleted file mode 100644 index 8c02f00dfbfc96d26e9678dc9f41ee38e98c1f16..0000000000000000000000000000000000000000 Binary files a/bob/io/base/data/torch.tensor and /dev/null differ diff --git a/bob/io/base/data/torch3.bindata b/bob/io/base/data/torch3.bindata deleted file mode 100644 index bbf2b2d8507213774b60619f6d5469d2e0feb423..0000000000000000000000000000000000000000 Binary files a/bob/io/base/data/torch3.bindata and /dev/null differ diff --git a/bob/io/base/test.cpp b/bob/io/base/test.cpp index 5b4acd551579245eb00a8758ab7e7f4eadc01f32..559535a05ce6f8adbbbfc9cdbc7c81c41044bb2a 100644 --- a/bob/io/base/test.cpp +++ b/bob/io/base/test.cpp @@ -48,10 +48,10 @@ BOB_TRY input.reset(); if (blitz::any(test_data - read_data)) - throw std::runtime_error("The CSV IO test did not succeed"); + throw std::runtime_error("The HDF5 IO test did not succeed"); if (blitz::any(test_data - read_data_2)) - throw std::runtime_error("The CSV IO test did not succeed"); + throw std::runtime_error("The HDF5 IO test did not succeed"); Py_RETURN_NONE; BOB_CATCH_FUNCTION("_test_api", 0) diff --git a/bob/io/base/test_file.py b/bob/io/base/test_file.py index f58ca5d319df7822f3815c8d75ea2c8d4e3d5014..12b24850e618e3036273a9a71263161804ab913e 100644 --- a/bob/io/base/test_file.py +++ b/bob/io/base/test_file.py @@ -230,92 +230,3 @@ def test_hdf5(): transcode(test_utils.datafile('test1.hdf5', __name__)) transcode(test_utils.datafile('matlab_1d.hdf5', __name__)) transcode(test_utils.datafile('matlab_2d.hdf5', __name__)) - -@test_utils.extension_available('.bindata') -def test_torch3_binary(): - - # array writing tests - a1 = numpy.random.normal(size=(3,4)).astype('float32') #good, supported - a2 = numpy.random.normal(size=(3,4)).astype('float64') #good, supported - a3 = numpy.random.normal(size=(3,4)).astype('complex128') #not supported - - array_readwrite('.bindata', a1) - array_readwrite(".bindata", a2) - nose.tools.assert_raises(RuntimeError, array_readwrite, ".bindata", a3) - - # arrayset writing tests - a1 = [] - a2 = [] - a3 = [] - a4 = [] - for k in range(10): - a1.append(numpy.random.normal(size=(24,)).astype('float32')) #supported - a2.append(numpy.random.normal(size=(24,)).astype('float64')) #supported - a3.append(numpy.random.normal(size=(24,)).astype('complex128')) #unsupp. - a4.append(numpy.random.normal(size=(3,3))) #not supported - - arrayset_readwrite('.bindata', a1) - arrayset_readwrite(".bindata", a2) - - # checks we raise if we don't suppport a type - nose.tools.assert_raises(RuntimeError, arrayset_readwrite, ".bindata", a3) - nose.tools.assert_raises(RuntimeError, arrayset_readwrite, ".bindata", a4) - - # complete transcoding test - transcode(test_utils.datafile('torch3.bindata', __name__)) - -@test_utils.extension_available('.tensor') -def test_tensorfile(): - - # array writing tests - a1 = numpy.random.normal(size=(3,4)).astype('float32') - a2 = numpy.random.normal(size=(3,4,5)).astype('float64') - a3 = (100*numpy.random.normal(size=(2,3,4,5))).astype('int32') - - array_readwrite('.tensor', a1) - array_readwrite(".tensor", a2) - array_readwrite(".tensor", a3) - array_readwrite('.tensor', a3[::2,::2]) #test non-contiguous - - # arrayset writing tests - a1 = [] - a2 = [] - a3 = [] - for k in range(10): - a1.append(numpy.random.normal(size=(3,4)).astype('float32')) - a2.append(numpy.random.normal(size=(3,4,5)).astype('float64')) - a3.append((100*numpy.random.normal(size=(2,3,4,5))).astype('int32')) - - arrayset_readwrite('.tensor', a1) - arrayset_readwrite(".tensor", a2) - arrayset_readwrite(".tensor", a3) - - # complete transcoding test - transcode(test_utils.datafile('torch.tensor', __name__)) - -@test_utils.extension_available('.csv') -def test_csv(): - - # array writing tests - a1 = numpy.random.normal(size=(5,5)).astype('float64') - a2 = numpy.random.normal(size=(5,10)).astype('float64') - a3 = numpy.random.normal(size=(5,100)).astype('float64') - - array_readwrite('.csv', a1, close=True) - array_readwrite(".csv", a2, close=True) - array_readwrite('.csv', a3, close=True) - array_readwrite('.csv', a3[::2,::2], close=True) #test non-contiguous - - # arrayset writing tests - a1 = [] - a2 = [] - a3 = [] - for k in range(10): - a1.append(numpy.random.normal(size=(5,)).astype('float64')) - a2.append(numpy.random.normal(size=(50,)).astype('float64')) - a3.append(numpy.random.normal(size=(500,)).astype('float64')) - - arrayset_readwrite('.csv', a1, close=True) - arrayset_readwrite(".csv", a2, close=True) - arrayset_readwrite('.csv', a3, close=True) - diff --git a/setup.py b/setup.py index 5dbcd6d748334185a3e7731e420780338c18f44b..04ed2f12ea0dfb380a7ec2e02161558aa08b62aa 100644 --- a/setup.py +++ b/setup.py @@ -141,7 +141,6 @@ setup( Library("bob.io.base.bob_io_base", [ "bob/io/base/cpp/CodecRegistry.cpp", - "bob/io/base/cpp/CSVFile.cpp", "bob/io/base/cpp/File.cpp", "bob/io/base/cpp/HDF5ArrayFile.cpp", "bob/io/base/cpp/HDF5Attribute.cpp", @@ -151,11 +150,7 @@ setup( "bob/io/base/cpp/HDF5Types.cpp", "bob/io/base/cpp/HDF5Utils.cpp", "bob/io/base/cpp/reorder.cpp", - "bob/io/base/cpp/T3File.cpp", - "bob/io/base/cpp/TensorArrayFile.cpp", - "bob/io/base/cpp/TensorFileHeader.cpp", "bob/io/base/cpp/utils.cpp", - "bob/io/base/cpp/TensorFile.cpp", "bob/io/base/cpp/array.cpp", "bob/io/base/cpp/array_type.cpp", "bob/io/base/cpp/blitz_array.cpp",