diff --git a/.travis.yml b/.travis.yml index b069c5e3ffdbeefdcc9d3bd0209f5d15c28c3555..0fdd2bbc4792094cf104addc2bebf8e65ac5ef4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ install: - "python bootstrap.py" - "CFLAGS=-coverage ./bin/buildout" script: - - "./bin/python -c 'from xbob.io.base import get_config; print(get_config())'" - - "./bin/coverage run --source=xbob.io.base ./bin/nosetests -sv" + - "./bin/python -c 'from bob.io.base import get_config; print(get_config())'" + - "./bin/coverage run --source=bob.io.base ./bin/nosetests -sv" - "./bin/sphinx-build -b doctest doc sphinx" - "./bin/sphinx-build -b html doc sphinx" after_success: diff --git a/MANIFEST.in b/MANIFEST.in index 15ce78194492f3b44eac23a578d67e9d676b094a..7f7ea4c772cd31efda180ef24a3a945d1a596a51 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include LICENSE README.rst bootstrap.py buildout.cfg recursive-include doc conf.py *.rst -recursive-include xbob *.cpp *.h -recursive-include xbob/io/base/data *.* +recursive-include bob *.cpp *.h +recursive-include bob/io/base/data *.* diff --git a/README.rst b/README.rst index 52ad86b2fc2dacd6a4f028b371b143bd0643ca5f..63f677f016ac9a6d1de4193bdea26780cc949893 100644 --- a/README.rst +++ b/README.rst @@ -2,16 +2,16 @@ .. Andre Anjos <andre.anjos@idiap.ch> .. Thu 29 Aug 2013 16:07:57 CEST -.. image:: https://travis-ci.org/bioidiap/xbob.io.base.svg?branch=master - :target: https://travis-ci.org/bioidiap/xbob.io.base -.. image:: https://coveralls.io/repos/bioidiap/xbob.io.base/badge.png - :target: https://coveralls.io/r/bioidiap/xbob.io.base -.. image:: http://img.shields.io/github/tag/bioidiap/xbob.io.base.png - :target: https://github.com/bioidiap/xbob.io.base -.. image:: http://img.shields.io/pypi/v/xbob.io.base.png - :target: https://pypi.python.org/pypi/xbob.io.base -.. image:: http://img.shields.io/pypi/dm/xbob.io.base.png - :target: https://pypi.python.org/pypi/xbob.io.base +.. image:: https://travis-ci.org/bioidiap/bob.io.base.svg?branch=master + :target: https://travis-ci.org/bioidiap/bob.io.base +.. image:: https://coveralls.io/repos/bioidiap/bob.io.base/badge.png + :target: https://coveralls.io/r/bioidiap/bob.io.base +.. image:: http://img.shields.io/github/tag/bioidiap/bob.io.base.png + :target: https://github.com/bioidiap/bob.io.base +.. image:: http://img.shields.io/pypi/v/bob.io.base.png + :target: https://pypi.python.org/pypi/bob.io.base +.. image:: http://img.shields.io/pypi/dm/bob.io.base.png + :target: https://pypi.python.org/pypi/bob.io.base ============================= Python bindings for bob::io @@ -41,7 +41,7 @@ Testing You can run a set of tests using the nose test runner:: - $ nosetests -sv xbob.io.base + $ nosetests -sv bob.io.base .. warning:: @@ -58,7 +58,7 @@ You can run our documentation tests using sphinx itself:: You can test overall test coverage with:: - $ nosetests --with-coverage --cover-package=xbob.io.base + $ nosetests --with-coverage --cover-package=bob.io.base The ``coverage`` egg must be installed for this to work properly. diff --git a/xbob/__init__.py b/bob/__init__.py similarity index 100% rename from xbob/__init__.py rename to bob/__init__.py diff --git a/xbob/io/__init__.py b/bob/io/__init__.py similarity index 100% rename from xbob/io/__init__.py rename to bob/io/__init__.py diff --git a/xbob/io/base/__init__.py b/bob/io/base/__init__.py similarity index 100% rename from xbob/io/base/__init__.py rename to bob/io/base/__init__.py diff --git a/xbob/io/base/bobskin.cpp b/bob/io/base/bobskin.cpp similarity index 100% rename from xbob/io/base/bobskin.cpp rename to bob/io/base/bobskin.cpp diff --git a/xbob/io/base/bobskin.h b/bob/io/base/bobskin.h similarity index 98% rename from xbob/io/base/bobskin.h rename to bob/io/base/bobskin.h index 5527bb618e5a77ff14f603c0682dad3bd439276d..8343daf566826e454feee632632554142a93c61e 100644 --- a/xbob/io/base/bobskin.h +++ b/bob/io/base/bobskin.h @@ -14,7 +14,7 @@ #include <bob/core/array.h> extern "C" { -#include <xbob.blitz/capi.h> +#include <bob.blitz/capi.h> } diff --git a/xbob/io/base/codec.cpp b/bob/io/base/codec.cpp similarity index 96% rename from xbob/io/base/codec.cpp rename to bob/io/base/codec.cpp index 2e503514291be687d86a5e9cf9fad22f52db30e9..fe5aad405a922f05c97bac4b9736cb4fa8e3c8bb 100644 --- a/xbob/io/base/codec.cpp +++ b/bob/io/base/codec.cpp @@ -5,8 +5,8 @@ * @brief Bindings to bob::io::CodecRegistry */ -#define XBOB_IO_BASE_MODULE -#include <xbob.io.base/api.h> +#define BOB_IO_BASE_MODULE +#include <bob.io.base/api.h> int PyBobIoCodec_Register (const char* extension, const char* description, bob::io::file_factory_t factory) { boost::shared_ptr<bob::io::CodecRegistry> instance = diff --git a/xbob/io/base/data/matlab_1d.hdf5 b/bob/io/base/data/matlab_1d.hdf5 similarity index 100% rename from xbob/io/base/data/matlab_1d.hdf5 rename to bob/io/base/data/matlab_1d.hdf5 diff --git a/xbob/io/base/data/matlab_2d.hdf5 b/bob/io/base/data/matlab_2d.hdf5 similarity index 100% rename from xbob/io/base/data/matlab_2d.hdf5 rename to bob/io/base/data/matlab_2d.hdf5 diff --git a/xbob/io/base/data/test1.hdf5 b/bob/io/base/data/test1.hdf5 similarity index 100% rename from xbob/io/base/data/test1.hdf5 rename to bob/io/base/data/test1.hdf5 diff --git a/xbob/io/base/data/test7_unlimited.hdf5 b/bob/io/base/data/test7_unlimited.hdf5 similarity index 100% rename from xbob/io/base/data/test7_unlimited.hdf5 rename to bob/io/base/data/test7_unlimited.hdf5 diff --git a/xbob/io/base/data/test_array_codec.txt b/bob/io/base/data/test_array_codec.txt similarity index 100% rename from xbob/io/base/data/test_array_codec.txt rename to bob/io/base/data/test_array_codec.txt diff --git a/xbob/io/base/data/torch.tensor b/bob/io/base/data/torch.tensor similarity index 100% rename from xbob/io/base/data/torch.tensor rename to bob/io/base/data/torch.tensor diff --git a/xbob/io/base/data/torch3.bindata b/bob/io/base/data/torch3.bindata similarity index 100% rename from xbob/io/base/data/torch3.bindata rename to bob/io/base/data/torch3.bindata diff --git a/xbob/io/base/file.cpp b/bob/io/base/file.cpp similarity index 98% rename from xbob/io/base/file.cpp rename to bob/io/base/file.cpp index 8974bc176090bb529fc28700900438eb7232b1fa..f293b657260240e748ea165e1a2186bc0cc42b4c 100644 --- a/xbob/io/base/file.cpp +++ b/bob/io/base/file.cpp @@ -5,18 +5,18 @@ * @brief Bindings to bob::io::File */ -#define XBOB_IO_BASE_MODULE +#define BOB_IO_BASE_MODULE #include "bobskin.h" -#include <xbob.io.base/api.h> +#include <bob.io.base/api.h> #include <bob/io/CodecRegistry.h> #include <bob/io/utils.h> #include <numpy/arrayobject.h> -#include <xbob.blitz/capi.h> -#include <xbob.blitz/cleanup.h> +#include <bob.blitz/capi.h> +#include <bob.blitz/cleanup.h> #include <stdexcept> #define FILETYPE_NAME "File" -PyDoc_STRVAR(s_file_str, XBOB_EXT_MODULE_PREFIX "." FILETYPE_NAME); +PyDoc_STRVAR(s_file_str, BOB_EXT_MODULE_PREFIX "." FILETYPE_NAME); PyDoc_STRVAR(s_file_doc, "File(filename, [mode='r', [pretend_extension='']]) -> new bob::io::File\n\ @@ -477,10 +477,10 @@ Parameters:\n\ \n\ array\n\ [array] The array to be written into the file. It can be a\n\ - numpy, a xbob.blitz.array or any other object which can be\n\ + numpy, a bob.blitz.array or any other object which can be\n\ converted to either of them, as long as the number of\n\ dimensions and scalar type are supported by\n\ - :py:class:`xbob.blitz.array`.\n\ + :py:class:`bob.blitz.array`.\n\ \n\ This method writes data to the file. It acts like the\n\ given array is the only piece of data that will ever be written\n\ @@ -530,10 +530,10 @@ Parameters:\n\ \n\ array\n\ [array] The array to be added into the file. It can be a\n\ - numpy, a xbob.blitz.array or any other object which can be\n\ + numpy, a bob.blitz.array or any other object which can be\n\ converted to either of them, as long as the number of\n\ dimensions and scalar type are supported by\n\ - :py:class:`xbob.blitz.array`.\n\ + :py:class:`bob.blitz.array`.\n\ \n\ This method appends data to the file. If the file does not\n\ exist, creates a new file, else, makes sure that the inserted\n\ @@ -630,7 +630,7 @@ static PyMethodDef PyBobIoFile_Methods[] = { **********************************/ #define FILEITERTYPE_NAME "File.iter" -PyDoc_STRVAR(s_fileiterator_str, XBOB_EXT_MODULE_PREFIX "." FILEITERTYPE_NAME); +PyDoc_STRVAR(s_fileiterator_str, BOB_EXT_MODULE_PREFIX "." FILEITERTYPE_NAME); /* How to create a new PyBobIoFileIteratorObject */ static PyObject* PyBobIoFileIterator_New(PyTypeObject* type, PyObject*, PyObject*) { diff --git a/xbob/io/base/hdf5.cpp b/bob/io/base/hdf5.cpp similarity index 99% rename from xbob/io/base/hdf5.cpp rename to bob/io/base/hdf5.cpp index f17b0830e319b03e354a22e6fd84759decb51d4a..823bf175deb1128dceda1b831a8e460b15a5d53f 100644 --- a/xbob/io/base/hdf5.cpp +++ b/bob/io/base/hdf5.cpp @@ -5,18 +5,18 @@ * @brief Bindings to bob::io::HDF5File */ -#define XBOB_IO_BASE_MODULE -#include <xbob.io.base/api.h> +#define BOB_IO_BASE_MODULE +#include <bob.io.base/api.h> #include <boost/make_shared.hpp> #include <numpy/arrayobject.h> -#include <xbob.blitz/cppapi.h> -#include <xbob.blitz/cleanup.h> +#include <bob.blitz/cppapi.h> +#include <bob.blitz/cleanup.h> #include <stdexcept> #include <cstring> #define HDF5FILE_NAME "HDF5File" -PyDoc_STRVAR(s_hdf5file_str, XBOB_EXT_MODULE_PREFIX "." HDF5FILE_NAME); +PyDoc_STRVAR(s_hdf5file_str, BOB_EXT_MODULE_PREFIX "." HDF5FILE_NAME); PyDoc_STRVAR(s_hdf5file_doc, "HDF5File(filename, [mode='r']) -> new bob::io::HDF5File\n\ @@ -978,7 +978,7 @@ static bool PyBobIoHDF5File_IsPythonScalar(PyObject* obj) { /** * Returns the type of object `op' is - a scalar (return value = 0), a - * xbob.blitzarray (return value = 1), a numpy.ndarray (return value = 2), an + * bob.blitzarray (return value = 1), a numpy.ndarray (return value = 2), an * object which is convertible to a numpy.ndarray (return value = 3) or returns * -1 if the object cannot be converted. No error is set on the python stack. * @@ -1208,7 +1208,7 @@ static PyObject* PyBobIoHDF5File_Replace(PyBobIoHDF5FileObject* self, PyObject* else { //write as array switch (is_array) { - case 1: //xbob.blitz.array + case 1: //bob.blitz.array self->f->write_buffer(path, pos, type, ((PyBlitzArrayObject*)data)->data); break; @@ -1341,7 +1341,7 @@ static int PyBobIoHDF5File_InnerAppend(PyBobIoHDF5FileObject* self, const char* else { //write as array switch (is_array) { - case 1: //xbob.blitz.array + case 1: //bob.blitz.array if (!self->f->contains(path)) self->f->create(path, type, true, compression); self->f->extend_buffer(path, type, ((PyBlitzArrayObject*)data)->data); break; @@ -1532,7 +1532,7 @@ static PyObject* PyBobIoHDF5File_Set(PyBobIoHDF5FileObject* self, PyObject* args else { //write as array switch (is_array) { - case 1: //xbob.blitz.array + case 1: //bob.blitz.array if (!self->f->contains(path)) self->f->create(path, type, false, compression); self->f->write_buffer(path, 0, type, ((PyBlitzArrayObject*)data)->data); break; @@ -1962,7 +1962,7 @@ static PyObject* PyBobIoHDF5File_WriteAttribute(PyBobIoHDF5FileObject* self, try { switch (is_array) { - case 1: //xbob.blitz.array + case 1: //bob.blitz.array self->f->write_attribute(path, name, type, ((PyBlitzArrayObject*)o)->data); break; diff --git a/xbob/io/base/include/xbob.io.base/api.h b/bob/io/base/include/bob.io.base/api.h similarity index 71% rename from xbob/io/base/include/xbob.io.base/api.h rename to bob/io/base/include/bob.io.base/api.h index 63fd1ed85e748c6b376349b7dd594b7e8432f9af..668b1a41b5fe7069dc121eb79ed398dad36340a5 100644 --- a/xbob/io/base/include/xbob.io.base/api.h +++ b/bob/io/base/include/bob.io.base/api.h @@ -5,17 +5,17 @@ * @brief C/C++ API for bob::io */ -#ifndef XBOB_IO_BASE_H -#define XBOB_IO_BASE_H +#ifndef BOB_IO_BASE_H +#define BOB_IO_BASE_H /* Define Module Name and Prefix for other Modules - Note: We cannot use XBOB_EXT_* macros here, unfortunately */ -#define XBOB_IO_BASE_PREFIX "xbob.io.base" -#define XBOB_IO_BASE_FULL_NAME "xbob.io.base._library" + Note: We cannot use BOB_EXT_* macros here, unfortunately */ +#define BOB_IO_BASE_PREFIX "bob.io.base" +#define BOB_IO_BASE_FULL_NAME "bob.io.base._library" #include <Python.h> -#include <xbob.io.base/config.h> +#include <bob.io.base/config.h> #include <bob/config.h> #include <bob/io/File.h> #include <bob/io/HDF5File.h> @@ -29,8 +29,8 @@ /* Enum defining entries in the function table */ enum _PyBobIo_ENUM{ - PyXbobIo_APIVersion_NUM = 0, - // Bindings for xbob.io.base.File + PyBobIo_APIVersion_NUM = 0, + // Bindings for bob.io.base.File PyBobIoFile_Type_NUM, PyBobIoFileIterator_Type_NUM, // I/O generic bindings @@ -47,17 +47,17 @@ enum _PyBobIo_ENUM{ PyBobIoCodec_IsRegistered_NUM, PyBobIoCodec_GetDescription_NUM, // Total number of C API pointers - PyXbobIo_API_pointers + PyBobIo_API_pointers }; /************** * Versioning * **************/ -#define PyXbobIo_APIVersion_TYPE int +#define PyBobIo_APIVersion_TYPE int /********************************** - * Bindings for xbob.io.base.File * + * Bindings for bob.io.base.File * **********************************/ /* Type definition for PyBobIoFileObject */ @@ -131,18 +131,18 @@ typedef struct { #define PyBobIoCodec_GetDescription_RET const char* #define PyBobIoCodec_GetDescription_PROTO (const char* extension) -#ifdef XBOB_IO_BASE_MODULE +#ifdef BOB_IO_BASE_MODULE - /* This section is used when compiling `xbob.io.base' itself */ + /* This section is used when compiling `bob.io.base' itself */ /************** * Versioning * **************/ - extern int PyXbobIo_APIVersion; + extern int PyBobIo_APIVersion; /********************************** - * Bindings for xbob.io.base.File * + * Bindings for bob.io.base.File * **********************************/ extern PyBobIoFile_Type_TYPE PyBobIoFile_Type; @@ -182,15 +182,15 @@ typedef struct { #else - /* This section is used in modules that use `xbob.io.base's' C-API */ + /* This section is used in modules that use `bob.io.base's' C-API */ # if defined(NO_IMPORT_ARRAY) - extern void **PyXbobIo_API; + extern void **PyBobIo_API; # else # if defined(PY_ARRAY_UNIQUE_SYMBOL) - void **PyXbobIo_API; + void **PyBobIo_API; # else - static void **PyXbobIo_API=NULL; + static void **PyBobIo_API=NULL; # endif # endif @@ -198,58 +198,58 @@ typedef struct { * Versioning * **************/ -# define PyXbobIo_APIVersion (*(PyXbobIo_APIVersion_TYPE *)PyXbobIo_API[PyXbobIo_APIVersion_NUM]) +# define PyBobIo_APIVersion (*(PyBobIo_APIVersion_TYPE *)PyBobIo_API[PyBobIo_APIVersion_NUM]) /***************************** - * Bindings for xbob.io.File * + * Bindings for bob.io.File * *****************************/ -# define PyBobIoFile_Type (*(PyBobIoFile_Type_TYPE *)PyXbobIo_API[PyBobIoFile_Type_NUM]) -# define PyBobIoFileIterator_Type (*(PyBobIoFileIterator_Type_TYPE *)PyXbobIo_API[PyBobIoFileIterator_Type_NUM]) +# define PyBobIoFile_Type (*(PyBobIoFile_Type_TYPE *)PyBobIo_API[PyBobIoFile_Type_NUM]) +# define PyBobIoFileIterator_Type (*(PyBobIoFileIterator_Type_TYPE *)PyBobIo_API[PyBobIoFileIterator_Type_NUM]) /************************ * I/O generic bindings * ************************/ -# define PyBobIo_AsTypenum (*(PyBobIo_AsTypenum_RET (*)PyBobIo_AsTypenum_PROTO) PyXbobIo_API[PyBobIo_AsTypenum_NUM]) +# define PyBobIo_AsTypenum (*(PyBobIo_AsTypenum_RET (*)PyBobIo_AsTypenum_PROTO) PyBobIo_API[PyBobIo_AsTypenum_NUM]) -# define PyBobIo_TypeInfoAsTuple (*(PyBobIo_TypeInfoAsTuple_RET (*)PyBobIo_TypeInfoAsTuple_PROTO) PyXbobIo_API[PyBobIo_TypeInfoAsTuple_NUM]) +# define PyBobIo_TypeInfoAsTuple (*(PyBobIo_TypeInfoAsTuple_RET (*)PyBobIo_TypeInfoAsTuple_PROTO) PyBobIo_API[PyBobIo_TypeInfoAsTuple_NUM]) -# define PyBobIo_FilenameConverter (*(PyBobIo_FilenameConverter_RET (*)PyBobIo_FilenameConverter_PROTO) PyXbobIo_API[PyBobIo_FilenameConverter_NUM]) +# define PyBobIo_FilenameConverter (*(PyBobIo_FilenameConverter_RET (*)PyBobIo_FilenameConverter_PROTO) PyBobIo_API[PyBobIo_FilenameConverter_NUM]) /***************** * HDF5 bindings * *****************/ -# define PyBobIoHDF5File_Type (*(PyBobIoHDF5File_Type_TYPE *)PyXbobIo_API[PyBobIoHDF5File_Type_NUM]) +# define PyBobIoHDF5File_Type (*(PyBobIoHDF5File_Type_TYPE *)PyBobIo_API[PyBobIoHDF5File_Type_NUM]) -# define PyBobIoHDF5File_Check (*(PyBobIoHDF5File_Check_RET (*)PyBobIoHDF5File_Check_PROTO) PyXbobIo_API[PyBobIoHDF5File_Check_NUM]) +# define PyBobIoHDF5File_Check (*(PyBobIoHDF5File_Check_RET (*)PyBobIoHDF5File_Check_PROTO) PyBobIo_API[PyBobIoHDF5File_Check_NUM]) -# define PyBobIoHDF5File_Converter (*(PyBobIoHDF5File_Converter_RET (*)PyBobIoHDF5File_Converter_PROTO) PyXbobIo_API[PyBobIoHDF5File_Converter_NUM]) +# define PyBobIoHDF5File_Converter (*(PyBobIoHDF5File_Converter_RET (*)PyBobIoHDF5File_Converter_PROTO) PyBobIo_API[PyBobIoHDF5File_Converter_NUM]) /***************************************** * Code Registration and De-registration * *****************************************/ -# define PyBobIoCodec_Register (*(PyBobIoCodec_Register_RET (*)PyBobIoCodec_Register_PROTO) PyXbobIo_API[PyBobIoCodec_Register_NUM]) +# define PyBobIoCodec_Register (*(PyBobIoCodec_Register_RET (*)PyBobIoCodec_Register_PROTO) PyBobIo_API[PyBobIoCodec_Register_NUM]) -# define PyBobIoCodec_Deregister (*(PyBobIoCodec_Deregister_RET (*)PyBobIoCodec_Deregister_PROTO) PyXbobIo_API[PyBobIoCodec_Deregister_NUM]) +# define PyBobIoCodec_Deregister (*(PyBobIoCodec_Deregister_RET (*)PyBobIoCodec_Deregister_PROTO) PyBobIo_API[PyBobIoCodec_Deregister_NUM]) -# define PyBobIoCodec_IsRegistered (*(PyBobIoCodec_IsRegistered_RET (*)PyBobIoCodec_IsRegistered_PROTO) PyXbobIo_API[PyBobIoCodec_IsRegistered_NUM]) +# define PyBobIoCodec_IsRegistered (*(PyBobIoCodec_IsRegistered_RET (*)PyBobIoCodec_IsRegistered_PROTO) PyBobIo_API[PyBobIoCodec_IsRegistered_NUM]) -# define PyBobIoCodec_GetDescription (*(PyBobIoCodec_GetDescription_RET (*)PyBobIoCodec_GetDescription_PROTO) PyXbobIo_API[PyBobIoCodec_GetDescription_NUM]) +# define PyBobIoCodec_GetDescription (*(PyBobIoCodec_GetDescription_RET (*)PyBobIoCodec_GetDescription_PROTO) PyBobIo_API[PyBobIoCodec_GetDescription_NUM]) # if !defined(NO_IMPORT_ARRAY) /** * Returns -1 on error, 0 on success. */ - static int import_xbob_io_base(void) { + static int import_bob_io_base(void) { PyObject *c_api_object; PyObject *module; - module = PyImport_ImportModule(XBOB_IO_BASE_FULL_NAME); + module = PyImport_ImportModule(BOB_IO_BASE_FULL_NAME); if (module == NULL) return -1; @@ -262,34 +262,34 @@ typedef struct { # if PY_VERSION_HEX >= 0x02070000 if (PyCapsule_CheckExact(c_api_object)) { - PyXbobIo_API = (void **)PyCapsule_GetPointer(c_api_object, + PyBobIo_API = (void **)PyCapsule_GetPointer(c_api_object, PyCapsule_GetName(c_api_object)); } # else if (PyCObject_Check(c_api_object)) { - PyXbobIo_API = (void **)PyCObject_AsVoidPtr(c_api_object); + PyBobIo_API = (void **)PyCObject_AsVoidPtr(c_api_object); } # endif Py_DECREF(c_api_object); Py_DECREF(module); - if (!PyXbobIo_API) { + if (!PyBobIo_API) { PyErr_SetString(PyExc_ImportError, "cannot find C/C++ API " # if PY_VERSION_HEX >= 0x02070000 "capsule" # else "cobject" # endif - " at `" XBOB_IO_BASE_FULL_NAME "._C_API'"); + " at `" BOB_IO_BASE_FULL_NAME "._C_API'"); return -1; } /* Checks that the imported version matches the compiled version */ - int imported_version = *(int*)PyXbobIo_API[PyXbobIo_APIVersion_NUM]; + int imported_version = *(int*)PyBobIo_API[PyBobIo_APIVersion_NUM]; - if (XBOB_IO_BASE_API_VERSION != imported_version) { - PyErr_Format(PyExc_ImportError, XBOB_IO_BASE_FULL_NAME " import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", XBOB_IO_BASE_API_VERSION, imported_version); + if (BOB_IO_BASE_API_VERSION != imported_version) { + PyErr_Format(PyExc_ImportError, BOB_IO_BASE_FULL_NAME " import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOB_IO_BASE_API_VERSION, imported_version); return -1; } @@ -300,6 +300,6 @@ typedef struct { # endif //!defined(NO_IMPORT_ARRAY) -#endif /* XBOB_IO_BASE_MODULE */ +#endif /* BOB_IO_BASE_MODULE */ -#endif /* XBOB_IO_BASE_H */ +#endif /* BOB_IO_BASE_H */ diff --git a/bob/io/base/include/bob.io.base/config.h b/bob/io/base/include/bob.io.base/config.h new file mode 100644 index 0000000000000000000000000000000000000000..76fc73daa2d4501d9a2216f2c9876f1af49815b1 --- /dev/null +++ b/bob/io/base/include/bob.io.base/config.h @@ -0,0 +1,14 @@ +/** + * @author Andre Anjos <andre.anjos@idiap.ch> + * @date Fri 1 Nov 07:10:59 2013 + * + * @brief General directives for all modules in bob.io + */ + +#ifndef BOB_IO_BASE_CONFIG_H +#define BOB_IO_BASE_CONFIG_H + +/* Macros that define versions and important names */ +#define BOB_IO_BASE_API_VERSION 0x0200 + +#endif /* BOB_IO_BASE_CONFIG_H */ diff --git a/xbob/io/base/main.cpp b/bob/io/base/main.cpp similarity index 53% rename from xbob/io/base/main.cpp rename to bob/io/base/main.cpp index 6d3b5c1ae17cdab66a0f4ceea6a8c0a50038f6be..7e97111e8c6326856a237a23f94e0bb29bb8a673 100644 --- a/xbob/io/base/main.cpp +++ b/bob/io/base/main.cpp @@ -5,14 +5,14 @@ * @brief Bindings to bob::io */ -#define XBOB_IO_BASE_MODULE -#include <xbob.io.base/api.h> +#define BOB_IO_BASE_MODULE +#include <bob.io.base/api.h> #ifdef NO_IMPORT_ARRAY #undef NO_IMPORT_ARRAY #endif -#include <xbob.blitz/capi.h> -#include <xbob.blitz/cleanup.h> +#include <bob.blitz/capi.h> +#include <bob.blitz/cleanup.h> static PyMethodDef module_methods[] = { {0} /* Sentinel */ @@ -20,12 +20,12 @@ static PyMethodDef module_methods[] = { PyDoc_STRVAR(module_docstr, "Core bob::io classes and methods"); -int PyXbobIo_APIVersion = XBOB_IO_BASE_API_VERSION; +int PyBobIo_APIVersion = BOB_IO_BASE_API_VERSION; #if PY_VERSION_HEX >= 0x03000000 static PyModuleDef module_definition = { PyModuleDef_HEAD_INIT, - XBOB_EXT_MODULE_NAME, + BOB_EXT_MODULE_NAME, module_docstr, -1, module_methods, @@ -47,14 +47,14 @@ static PyObject* create_module (void) { # if PY_VERSION_HEX >= 0x03000000 PyObject* m = PyModule_Create(&module_definition); # else - PyObject* m = Py_InitModule3(XBOB_EXT_MODULE_NAME, module_methods, module_docstr); + PyObject* m = Py_InitModule3(BOB_EXT_MODULE_NAME, module_methods, module_docstr); # endif if (!m) return 0; auto m_ = make_safe(m); /* register some constants */ - if (PyModule_AddIntConstant(m, "__api_version__", XBOB_IO_BASE_API_VERSION) < 0) return 0; - if (PyModule_AddStringConstant(m, "__version__", XBOB_EXT_MODULE_VERSION) < 0) return 0; + if (PyModule_AddIntConstant(m, "__api_version__", BOB_IO_BASE_API_VERSION) < 0) return 0; + if (PyModule_AddStringConstant(m, "__version__", BOB_EXT_MODULE_VERSION) < 0) return 0; /* register the types to python */ Py_INCREF(&PyBobIoFile_Type); @@ -66,7 +66,7 @@ static PyObject* create_module (void) { Py_INCREF(&PyBobIoHDF5File_Type); if (PyModule_AddObject(m, "HDF5File", (PyObject *)&PyBobIoHDF5File_Type) < 0) return 0; - static void* PyXbobIo_API[PyXbobIo_API_pointers]; + static void* PyBobIo_API[PyBobIo_API_pointers]; /* exhaustive list of C APIs */ @@ -74,58 +74,58 @@ static PyObject* create_module (void) { * Versioning * **************/ - PyXbobIo_API[PyXbobIo_APIVersion_NUM] = (void *)&PyXbobIo_APIVersion; + PyBobIo_API[PyBobIo_APIVersion_NUM] = (void *)&PyBobIo_APIVersion; /********************************** - * Bindings for xbob.io.base.File * + * Bindings for bob.io.base.File * **********************************/ - PyXbobIo_API[PyBobIoFile_Type_NUM] = (void *)&PyBobIoFile_Type; + PyBobIo_API[PyBobIoFile_Type_NUM] = (void *)&PyBobIoFile_Type; - PyXbobIo_API[PyBobIoFileIterator_Type_NUM] = (void *)&PyBobIoFileIterator_Type; + PyBobIo_API[PyBobIoFileIterator_Type_NUM] = (void *)&PyBobIoFileIterator_Type; /************************ * I/O generic bindings * ************************/ - PyXbobIo_API[PyBobIo_AsTypenum_NUM] = (void *)PyBobIo_AsTypenum; + PyBobIo_API[PyBobIo_AsTypenum_NUM] = (void *)PyBobIo_AsTypenum; - PyXbobIo_API[PyBobIo_TypeInfoAsTuple_NUM] = (void *)PyBobIo_TypeInfoAsTuple; + PyBobIo_API[PyBobIo_TypeInfoAsTuple_NUM] = (void *)PyBobIo_TypeInfoAsTuple; - PyXbobIo_API[PyBobIo_FilenameConverter_NUM] = (void *)PyBobIo_FilenameConverter; + PyBobIo_API[PyBobIo_FilenameConverter_NUM] = (void *)PyBobIo_FilenameConverter; /***************** * HDF5 bindings * *****************/ - PyXbobIo_API[PyBobIoHDF5File_Type_NUM] = (void *)&PyBobIoHDF5File_Type; + PyBobIo_API[PyBobIoHDF5File_Type_NUM] = (void *)&PyBobIoHDF5File_Type; - PyXbobIo_API[PyBobIoHDF5File_Check_NUM] = (void *)&PyBobIoHDF5File_Check; + PyBobIo_API[PyBobIoHDF5File_Check_NUM] = (void *)&PyBobIoHDF5File_Check; - PyXbobIo_API[PyBobIoHDF5File_Converter_NUM] = (void *)&PyBobIoHDF5File_Converter; + PyBobIo_API[PyBobIoHDF5File_Converter_NUM] = (void *)&PyBobIoHDF5File_Converter; /***************************************** * Code Registration and De-registration * *****************************************/ - PyXbobIo_API[PyBobIoCodec_Register_NUM] = (void *)&PyBobIoCodec_Register; + PyBobIo_API[PyBobIoCodec_Register_NUM] = (void *)&PyBobIoCodec_Register; - PyXbobIo_API[PyBobIoCodec_Deregister_NUM] = (void *)&PyBobIoCodec_Deregister; + PyBobIo_API[PyBobIoCodec_Deregister_NUM] = (void *)&PyBobIoCodec_Deregister; - PyXbobIo_API[PyBobIoCodec_IsRegistered_NUM] = (void *)&PyBobIoCodec_IsRegistered; + PyBobIo_API[PyBobIoCodec_IsRegistered_NUM] = (void *)&PyBobIoCodec_IsRegistered; - PyXbobIo_API[PyBobIoCodec_GetDescription_NUM] = (void *)&PyBobIoCodec_GetDescription; + PyBobIo_API[PyBobIoCodec_GetDescription_NUM] = (void *)&PyBobIoCodec_GetDescription; #if PY_VERSION_HEX >= 0x02070000 /* defines the PyCapsule */ - PyObject* c_api_object = PyCapsule_New((void *)PyXbobIo_API, - XBOB_EXT_MODULE_PREFIX "." XBOB_EXT_MODULE_NAME "._C_API", 0); + PyObject* c_api_object = PyCapsule_New((void *)PyBobIo_API, + BOB_EXT_MODULE_PREFIX "." BOB_EXT_MODULE_NAME "._C_API", 0); #else - PyObject* c_api_object = PyCObject_FromVoidPtr((void *)PyXbobIo_API, 0); + PyObject* c_api_object = PyCObject_FromVoidPtr((void *)PyBobIo_API, 0); #endif @@ -134,9 +134,9 @@ static PyObject* create_module (void) { if (PyModule_AddObject(m, "_C_API", c_api_object) < 0) return 0; /* imports dependencies */ - if (import_xbob_blitz() < 0) { + if (import_bob_blitz() < 0) { PyErr_Print(); - PyErr_Format(PyExc_ImportError, "cannot import `%s'", XBOB_EXT_MODULE_NAME); + PyErr_Format(PyExc_ImportError, "cannot import `%s'", BOB_EXT_MODULE_NAME); return 0; } @@ -145,7 +145,7 @@ static PyObject* create_module (void) { } -PyMODINIT_FUNC XBOB_EXT_ENTRY_NAME (void) { +PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) { # if PY_VERSION_HEX >= 0x03000000 return # endif diff --git a/xbob/io/base/test_file.py b/bob/io/base/test_file.py similarity index 100% rename from xbob/io/base/test_file.py rename to bob/io/base/test_file.py diff --git a/xbob/io/base/test_hdf5.py b/bob/io/base/test_hdf5.py similarity index 100% rename from xbob/io/base/test_hdf5.py rename to bob/io/base/test_hdf5.py diff --git a/xbob/io/base/test_utils.py b/bob/io/base/test_utils.py similarity index 95% rename from xbob/io/base/test_utils.py rename to bob/io/base/test_utils.py index 2ba6d1908acf6653be2439453d9c16041a2eb7cd..27a4827f97e5dee33dcba0722584d65f1fb3ce6a 100644 --- a/xbob/io/base/test_utils.py +++ b/bob/io/base/test_utils.py @@ -5,7 +5,7 @@ # # Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland -"""Re-usable decorators and utilities for xbob test code +"""Re-usable decorators and utilities for bob test code """ import os @@ -24,7 +24,7 @@ def datafile(f, module=None, path='data'): package: string, optional This is the python-style package name of the module you want to retrieve - the data from. This should be something like ``xbob.io.test``, but you + the data from. This should be something like ``bob.io.test``, but you normally refer it using the ``__name__`` property of the module you want to find the path relative to. diff --git a/xbob/io/base/version.cpp b/bob/io/base/version.cpp similarity index 88% rename from xbob/io/base/version.cpp rename to bob/io/base/version.cpp index e5458f98d6e14ad8fa0b32ff40ac846ec6637114..d545e2888ac633b5a1b694325b4b4f23126acaf4 100644 --- a/xbob/io/base/version.cpp +++ b/bob/io/base/version.cpp @@ -10,8 +10,8 @@ #ifdef NO_IMPORT_ARRAY #undef NO_IMPORT_ARRAY #endif -#define XBOB_IO_BASE_MODULE -#include <xbob.io.base/config.h> +#define BOB_IO_BASE_MODULE +#include <bob.io.base/config.h> #include <string> #include <cstdlib> @@ -22,8 +22,8 @@ #include <bob/config.h> #include <bob/io/CodecRegistry.h> -#include <xbob.blitz/capi.h> -#include <xbob.blitz/cleanup.h> +#include <bob.blitz/capi.h> +#include <bob.blitz/cleanup.h> #include <hdf5.h> static int dict_set(PyObject* d, const char* key, const char* value) { @@ -120,10 +120,10 @@ static PyObject* numpy_version() { } /** - * xbob.blitz c/c++ api version + * bob.blitz c/c++ api version */ -static PyObject* xbob_blitz_version() { - return Py_BuildValue("{ss}", "api", BOOST_PP_STRINGIZE(XBOB_BLITZ_API_VERSION)); +static PyObject* bob_blitz_version() { + return Py_BuildValue("{ss}", "api", BOOST_PP_STRINGIZE(BOB_BLITZ_API_VERSION)); } static PyObject* build_version_dictionary() { @@ -139,7 +139,7 @@ static PyObject* build_version_dictionary() { if (!dict_steal(retval, "Python", python_version())) return 0; if (!dict_steal(retval, "NumPy", numpy_version())) return 0; if (!dict_set(retval, "Blitz++", BZ_VERSION)) return 0; - if (!dict_steal(retval, "xbob.blitz", xbob_blitz_version())) return 0; + if (!dict_steal(retval, "bob.blitz", bob_blitz_version())) return 0; Py_INCREF(retval); Py_INCREF(retval); @@ -193,7 +193,7 @@ PyDoc_STRVAR(module_docstr, #if PY_VERSION_HEX >= 0x03000000 static PyModuleDef module_definition = { PyModuleDef_HEAD_INIT, - XBOB_EXT_MODULE_NAME, + BOB_EXT_MODULE_NAME, module_docstr, -1, module_methods, @@ -206,22 +206,22 @@ static PyObject* create_module (void) { # if PY_VERSION_HEX >= 0x03000000 PyObject* m = PyModule_Create(&module_definition); # else - PyObject* m = Py_InitModule3(XBOB_EXT_MODULE_NAME, module_methods, module_docstr); + PyObject* m = Py_InitModule3(BOB_EXT_MODULE_NAME, module_methods, module_docstr); # endif if (!m) return 0; auto m_ = make_safe(m); ///< protects against early returns /* register version numbers and constants */ - if (PyModule_AddIntConstant(m, "api", XBOB_IO_BASE_API_VERSION) < 0) + if (PyModule_AddIntConstant(m, "api", BOB_IO_BASE_API_VERSION) < 0) return 0; - if (PyModule_AddStringConstant(m, "module", XBOB_EXT_MODULE_VERSION) < 0) + if (PyModule_AddStringConstant(m, "module", BOB_EXT_MODULE_VERSION) < 0) return 0; if (PyModule_AddObject(m, "externals", build_version_dictionary()) < 0) return 0; /* imports dependencies */ - if (import_xbob_blitz() < 0) { + if (import_bob_blitz() < 0) { PyErr_Print(); - PyErr_Format(PyExc_ImportError, "cannot import `%s'", XBOB_EXT_MODULE_NAME); + PyErr_Format(PyExc_ImportError, "cannot import `%s'", BOB_EXT_MODULE_NAME); return 0; } @@ -230,7 +230,7 @@ static PyObject* create_module (void) { } -PyMODINIT_FUNC XBOB_EXT_ENTRY_NAME (void) { +PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) { # if PY_VERSION_HEX >= 0x03000000 return # endif diff --git a/buildout.cfg b/buildout.cfg index df31b0580459db15c5f9ec54616a60a25369ca77..82733dba98b02b958a8516d1eea547638d4a42cb 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -4,23 +4,23 @@ [buildout] parts = scripts -eggs = xbob.io.base -extensions = xbob.buildout +eggs = bob.io.base +extensions = bob.buildout mr.developer auto-checkout = * -develop = src/xbob.extension - src/xbob.blitz +develop = src/bob.extension + src/bob.blitz . -; options for xbob.buildout extension +; options for bob.buildout extension debug = true verbose = true -prefixes = /idiap/group/torch5spro/nightlies/last/bob/linux-x86_64-release +prefixes = /idiap/group/torch5spro/releases/preview/install/linux-x86_64-release /Users/andre/work/bob/b/dbg/ [sources] -xbob.extension = git https://github.com/bioidiap/xbob.extension branch=prototype -xbob.blitz = git https://github.com/bioidiap/xbob.blitz +bob.extension = git https://github.com/bioidiap/bob.extension +bob.blitz = git https://github.com/bioidiap/bob.blitz [scripts] -recipe = xbob.buildout:scripts +recipe = bob.buildout:scripts diff --git a/doc/c_cpp_api.rst b/doc/c_cpp_api.rst index 1a26b115cc5481eb7153e2d17eee1d2f8568ae01..3c532abf46aa415e7b4ffcdbe218c6bbccdb610a 100644 --- a/doc/c_cpp_api.rst +++ b/doc/c_cpp_api.rst @@ -6,10 +6,10 @@ C++ API ========= -The C++ API of ``xbob.io.base`` allows users to leverage from automatic converters -for classes in :py:class:`xbob.io.base`. To use the C API, clients should first, -include the header file ``<xbob.io.base/api.h>`` on their compilation units and -then, make sure to call once ``import_xbob_io_base()`` at their module +The C++ API of ``bob.io.base`` allows users to leverage from automatic converters +for classes in :py:class:`bob.io.base`. To use the C API, clients should first, +include the header file ``<bob.io.base/api.h>`` on their compilation units and +then, make sure to call once ``import_bob_io_base()`` at their module instantiation, as explained at the `Python manual <http://docs.python.org/2/extending/extending.html#using-capsules>`_. @@ -18,7 +18,7 @@ the import function: .. code-block:: c++ - #include <xbob.io.base/api.h> + #include <bob.io.base/api.h> PyMODINIT_FUNC initclient(void) { @@ -27,13 +27,13 @@ the import function: if (!m) return; /* imports dependencies */ - if (import_xbob_blitz() < 0) { + if (import_bob_blitz() < 0) { PyErr_Print(); PyErr_SetString(PyExc_ImportError, "cannot import extension"); return 0; } - if (import_xbob_io_base() < 0) { + if (import_bob_io_base() < 0) { PyErr_Print(); PyErr_SetString(PyExc_ImportError, "cannot import extension"); return 0; @@ -44,7 +44,7 @@ the import function: .. note:: The include directory can be discovered using - :py:func:`xbob.io.base.get_include`. + :py:func:`bob.io.base.get_include`. Generic Functions ----------------- diff --git a/doc/conf.py b/doc/conf.py index 6c479bad580229749711afe33d53b0c623fe1cb7..bb21f932ed474f32cb9c4a95e577a8fd3fb6f57d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -58,12 +58,12 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'xbob.io.base' +project = u'bob.io.base' import time copyright = u'%s, Idiap Research Institute' % time.strftime('%Y') # Grab the setup entry -distribution = pkg_resources.require('xbob.io.base')[0] +distribution = pkg_resources.require('bob.io.base')[0] # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -129,7 +129,7 @@ if sphinx.__version__ >= "1.0": #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = 'xbob_io_base' +#html_short_title = 'bob_io_base' # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -187,7 +187,7 @@ html_favicon = 'img/favicon.ico' #html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'xbob_io_base_doc' +htmlhelp_basename = 'bob_io_base_doc' # -- Options for LaTeX output -------------------------------------------------- @@ -201,7 +201,7 @@ latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'xbob_io_base.tex', u'Core Bob I/O Routines', + ('index', 'bob_io_base.tex', u'Core Bob I/O Routines', u'Biometrics Group, Idiap Research Institute', 'manual'), ] @@ -241,7 +241,7 @@ rst_epilog = """ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'xbob_io_base', u'Core Bob I/O Routines Documentation', [u'Idiap Research Institute'], 1) + ('index', 'bob_io_base', u'Core Bob I/O Routines Documentation', [u'Idiap Research Institute'], 1) ] # Default processing flags for sphinx diff --git a/doc/guide.rst b/doc/guide.rst index e491d01d49d539c0c47e044af158522ba4901de4..b6ffc51cb5e0213814893e16bc5078398950074a 100644 --- a/doc/guide.rst +++ b/doc/guide.rst @@ -20,7 +20,7 @@ and |project| loaded into the `Python`_ environment. .. testsetup:: * import numpy - import xbob.io.base + import bob.io.base import tempfile import os @@ -44,7 +44,7 @@ an `HDF5`_ file. These are supplied by the `HDF5`_ project. ``h5diff`` Finds the differences between HDF5 files. -I/O operations using the class `xbob.io.base.HDF5File` +I/O operations using the class `bob.io.base.HDF5File` ------------------------------------------------------ Writing operations @@ -57,7 +57,7 @@ floats. >>> an_integer = 5 >>> a_float = 3.1416 - >>> f = xbob.io.base.HDF5File('testfile1.hdf5', 'w') + >>> f = bob.io.base.HDF5File('testfile1.hdf5', 'w') >>> f.set('my_integer', an_integer) >>> f.set('my_float', a_float) >>> del f @@ -108,7 +108,7 @@ in a different directory like this: .. doctest:: - >>> f = xbob.io.base.HDF5File('testfile1.hdf5', 'a') + >>> f = bob.io.base.HDF5File('testfile1.hdf5', 'a') >>> f.create_group('/test') >>> f.set('/test/my_float', numpy.float32(6.28)) >>> del f @@ -144,7 +144,7 @@ as it was defined. If you need to place lots of variables in a subfolder, it may be better to setup the prefix folder before starting the writing operations on the - :py:class:`xbob.io.base.HDF5File` object. You can do this using the method + :py:class:`bob.io.base.HDF5File` object. You can do this using the method :py:meth:`HDF5File.cd`. Look up its help for more information and usage instructions. @@ -155,7 +155,7 @@ is an example: .. doctest:: >>> A = numpy.array(range(4), 'int8').reshape(2,2) - >>> f = xbob.io.base.HDF5File('testfile1.hdf5', 'a') + >>> f = bob.io.base.HDF5File('testfile1.hdf5', 'a') >>> f.set('my_array', A) >>> del f @@ -175,23 +175,23 @@ The result of running ``h5dump`` on the file ``testfile3.hdf5`` should be: ... You don't need to limit yourself to single variables, you can also save lists -of scalars and arrays using the function :py:meth:`xbob.io.base.HDF5.append` -instead of :py:meth:`xbob.io.base.HDF5.set`. +of scalars and arrays using the function :py:meth:`bob.io.base.HDF5.append` +instead of :py:meth:`bob.io.base.HDF5.set`. Reading operations ------------------ Reading data from a file that you just wrote to is just as easy. For this task -you should use :py:meth:`xbob.io.base.HDF5File.read`. The read method will read +you should use :py:meth:`bob.io.base.HDF5File.read`. The read method will read all the contents of the variable pointed to by the given path. This is the normal way to read a variable you have written with -:py:meth:`xbob.io.base.HDF5File.set`. If you decided to create a list of scalar +:py:meth:`bob.io.base.HDF5File.set`. If you decided to create a list of scalar or arrays, the way to read that up would be using -:py:meth:`xbob.io.base.HDF5File.lread` instead. Here is an example: +:py:meth:`bob.io.base.HDF5File.lread` instead. Here is an example: .. doctest:: - >>> f = xbob.io.base.HDF5File('testfile1.hdf5') #read only + >>> f = bob.io.base.HDF5File('testfile1.hdf5') #read only >>> f.read('my_integer') #reads integer 5 >>> print(f.read('my_array')) # reads the array @@ -200,13 +200,13 @@ or arrays, the way to read that up would be using >>> del f Now let's look at an example where we have used -:py:meth:`xbob.io.base.HDF5File.append` instead of -:py:meth:`xbob.io.base.HDF5File.set` to write data to a file. That is normally +:py:meth:`bob.io.base.HDF5File.append` instead of +:py:meth:`bob.io.base.HDF5File.set` to write data to a file. That is normally the case when you write lists of variables to a dataset. .. doctest:: - >>> f = xbob.io.base.HDF5File('testfile2.hdf5', 'w') + >>> f = bob.io.base.HDF5File('testfile2.hdf5', 'w') >>> f.append('arrayset', numpy.array(range(10), 'float64')) >>> f.append('arrayset', 2*numpy.array(range(10), 'float64')) >>> f.append('arrayset', 3*numpy.array(range(10), 'float64')) @@ -241,20 +241,20 @@ shot: .. doctest:: - >>> f = xbob.io.base.HDF5File('testfile2.hdf5') + >>> f = bob.io.base.HDF5File('testfile2.hdf5') >>> print(f.read('arrayset')) [[ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] [ 0. 2. 4. 6. 8. 10. 12. 14. 16. 18.] [ 0. 3. 6. 9. 12. 15. 18. 21. 24. 27.]] As you can see, the only difference between -:py:meth:`xbob.io.base.HDF5File.read` and -:py:meth:`xbob.io.base.HDF5File.lread` is on how |project| considers the +:py:meth:`bob.io.base.HDF5File.read` and +:py:meth:`bob.io.base.HDF5File.lread` is on how |project| considers the available data (as a single array with N dimensions or as a set of arrays with N-1 dimensions). In the first example, you would have also been able to read the variable `my_array` as an arrayset using -:py:meth:`xbob.io.base.HDF5File.lread` instead of -:py:meth:`xbob.io.base.HDF5File.read`. In this case, each position readout +:py:meth:`bob.io.base.HDF5File.lread` instead of +:py:meth:`bob.io.base.HDF5File.read`. In this case, each position readout would return a 1D uint8 array instead of a 2D array. Array interfaces @@ -266,27 +266,27 @@ other software frameworks, debug your data or just implement your own classes that can serialize and de-serialize from HDF5 file containers. In |project|, most of the time you will be working with :py:class:`numpy.ndarrays`\s. In special situations though, you may be asked to handle -:py:class:`xbob.io.base.File`\s. :py:class:`xbob.io.base.File` objects create a +:py:class:`bob.io.base.File`\s. :py:class:`bob.io.base.File` objects create a transparent connection between C++ (`Blitz++`_) / Python (`NumPy`_) arrays and file access. You specify the filename from which you want to input data and -the :py:class:`xbob.io.base.File` object decides what is the best codec to be +the :py:class:`bob.io.base.File` object decides what is the best codec to be used (from the extension) and how to read the data back into your array. -To create an :py:class:`xbob.io.base.File` from a file path, just do the +To create an :py:class:`bob.io.base.File` from a file path, just do the following: .. doctest:: - >>> a = xbob.io.base.File('testfile2.hdf5', 'r') + >>> a = bob.io.base.File('testfile2.hdf5', 'r') >>> a.filename 'testfile2.hdf5' -:py:class:`xbob.io.base.File`\s simulate containers for +:py:class:`bob.io.base.File`\s simulate containers for :py:class:`numpy.ndarray`\s, transparently accessing the file data when requested. Note, however, that when you instantiate an -:py:class:`xbob.io.base.File` it does **not** load the file contents into +:py:class:`bob.io.base.File` it does **not** load the file contents into memory. It waits until you emit another explicit instruction to do so. We do -this with the :py:meth:`xbob.io.base.File.read` method: +this with the :py:meth:`bob.io.base.File.read` method: .. doctest:: @@ -296,44 +296,44 @@ this with the :py:meth:`xbob.io.base.File.read` method: [ 0., 2., 4., 6., 8., 10., 12., 14., 16., 18.], [ 0., 3., 6., 9., 12., 15., 18., 21., 24., 27.]]) -Every time you say :py:meth:`xbob.io.base.File.read`, the file contents will be +Every time you say :py:meth:`bob.io.base.File.read`, the file contents will be read from the file and into a new array. -Saving arrays to the :py:class:`xbob.io.base.File` is as easy, just call the -:py:meth:`xbob.io.base.File.write` method: +Saving arrays to the :py:class:`bob.io.base.File` is as easy, just call the +:py:meth:`bob.io.base.File.write` method: .. doctest:: - >>> f = xbob.io.base.File('copy1.hdf5', 'w') + >>> f = bob.io.base.File('copy1.hdf5', 'w') >>> f.write(array) Numpy ndarray shortcuts ----------------------- To just load an :py:class:`numpy.ndarray` in memory, you can use a short cut -that lives at :py:func:`xbob.io.base.load`. With it, you don't have to go -through the :py:class:`xbob.io.base.File` container: +that lives at :py:func:`bob.io.base.load`. With it, you don't have to go +through the :py:class:`bob.io.base.File` container: .. doctest:: - >>> t = xbob.io.base.load('testfile2.hdf5') + >>> t = bob.io.base.load('testfile2.hdf5') >>> t array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.], [ 0., 2., 4., 6., 8., 10., 12., 14., 16., 18.], [ 0., 3., 6., 9., 12., 15., 18., 21., 24., 27.]]) You can also directly save :py:class:`numpy.ndarray`\s without going through -the :py:class:`xbob.io.base.Array` container: +the :py:class:`bob.io.base.Array` container: .. doctest:: - >>> xbob.io.base.save(t, 'copy2.hdf5') + >>> bob.io.base.save(t, 'copy2.hdf5') .. note:: - Under the hood, we still use the :py:class:`xbob.io.base.File` API to execute + Under the hood, we still use the :py:class:`bob.io.base.File` API to execute the read and write operations. Have a look at the manual section for - :py:mod:`xbob.io.base` for more details and other shortcuts available. + :py:mod:`bob.io.base` for more details and other shortcuts available. .. _audiosignal: diff --git a/doc/py_api.rst b/doc/py_api.rst index 866049c6fbfaea0637310f2b09e75a8b7fb99ef8..d42d535eb0bc65cb30bfce964871473d5e737084 100644 --- a/doc/py_api.rst +++ b/doc/py_api.rst @@ -7,35 +7,35 @@ ============ This section includes information for using the pure Python API of -``xbob.io.base``. +``bob.io.base``. Classes ------- -.. autoclass:: xbob.io.base.File +.. autoclass:: bob.io.base.File -.. autoclass:: xbob.io.base.HDF5File +.. autoclass:: bob.io.base.HDF5File Functions --------- -.. autofunction:: xbob.io.base.load +.. autofunction:: bob.io.base.load -.. autofunction:: xbob.io.base.merge +.. autofunction:: bob.io.base.merge -.. autofunction:: xbob.io.base.save +.. autofunction:: bob.io.base.save -.. autofunction:: xbob.io.base.append +.. autofunction:: bob.io.base.append -.. autofunction:: xbob.io.base.peek +.. autofunction:: bob.io.base.peek -.. autofunction:: xbob.io.base.peek_all +.. autofunction:: bob.io.base.peek_all -.. autofunction:: xbob.io.base.create_directories_save +.. autofunction:: bob.io.base.create_directories_save C++ API Helpers --------------- -.. autofunction:: xbob.io.base.get_include +.. autofunction:: bob.io.base.get_include diff --git a/setup.py b/setup.py index 9daf8a8622298318dbfb6a1819519fff63407406..5ac4b943eaf67764c5ddf0b5fa3ae97ae7d8e7d6 100644 --- a/setup.py +++ b/setup.py @@ -4,12 +4,12 @@ # Mon 16 Apr 08:18:08 2012 CEST from setuptools import setup, find_packages, dist -dist.Distribution(dict(setup_requires=['xbob.blitz'])) -from xbob.blitz.extension import Extension +dist.Distribution(dict(setup_requires=['bob.blitz'])) +from bob.blitz.extension import Extension import os package_dir = os.path.dirname(os.path.realpath(__file__)) -package_dir = os.path.join(package_dir, 'xbob', 'io', 'base', 'include') +package_dir = os.path.join(package_dir, 'bob', 'io', 'base', 'include') include_dirs = [package_dir] packages = ['bob-io >= 2.0.0a2'] @@ -17,10 +17,10 @@ version = '2.0.0a0' setup( - name='xbob.io.base', + name='bob.io.base', version=version, description='Base bindings for bob.io', - url='http://github.com/bioidiap/xbob.io.base', + url='http://github.com/bioidiap/bob.io.base', license='BSD', author='Andre Anjos', author_email='andre.anjos@idiap.ch', @@ -32,30 +32,30 @@ setup( install_requires=[ 'setuptools', - 'xbob.blitz', + 'bob.blitz', ], namespace_packages=[ - "xbob", - "xbob.io", + "bob", + "bob.io", ], ext_modules = [ - Extension("xbob.io.base.version", + Extension("bob.io.base.version", [ - "xbob/io/base/version.cpp", + "bob/io/base/version.cpp", ], packages = packages, include_dirs = include_dirs, version = version, ), - Extension("xbob.io.base._library", + Extension("bob.io.base._library", [ - "xbob/io/base/bobskin.cpp", - "xbob/io/base/codec.cpp", - "xbob/io/base/file.cpp", - "xbob/io/base/hdf5.cpp", - "xbob/io/base/main.cpp", + "bob/io/base/bobskin.cpp", + "bob/io/base/codec.cpp", + "bob/io/base/file.cpp", + "bob/io/base/hdf5.cpp", + "bob/io/base/main.cpp", ], packages = packages, include_dirs = include_dirs, diff --git a/xbob/io/base/include/xbob.io.base/config.h b/xbob/io/base/include/xbob.io.base/config.h deleted file mode 100644 index 0305b45ecf89c8c496d9154b374a814b4c89957f..0000000000000000000000000000000000000000 --- a/xbob/io/base/include/xbob.io.base/config.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @author Andre Anjos <andre.anjos@idiap.ch> - * @date Fri 1 Nov 07:10:59 2013 - * - * @brief General directives for all modules in xbob.io - */ - -#ifndef XBOB_IO_BASE_CONFIG_H -#define XBOB_IO_BASE_CONFIG_H - -/* Macros that define versions and important names */ -#define XBOB_IO_BASE_API_VERSION 0x0200 - -#endif /* XBOB_IO_BASE_CONFIG_H */