From: Arthur <ajs...@op...> - 2006-10-30 11:09:22
|
Folks, I have now - I believe - successfully implemented a VPython that is compatible with the final 1.0 release of the numpy library. I have tried to do so touching as little of the existing code as possible, hoping to avoid the possibility of inadvertently introducing bugs into the code in this process. In fact the most radical surgery to the existing code is a simplification - i.e. removing code and logic that was there only to allow for the build against the *both* Numeric and numarray libraries and the selection of one or the other as a preference. My code assumes a build against numpy, and only numpy. As hoped, there wasn't all that more that needed to be done to get the basic compatibility issues resolved beyond what could be learned from Phil Austin's approach in moving his num_util helper functions for boost::python::numeric arrays (used in the current vpython release) to numpy compatibility. See. http://www.eos.ubc.ca/research/clouds/software/pythonlibs/num_util/num_util_release2/ The only problems I have had running the demos and my own code that utilizes vpython is in differences between the Numeric and numpy Python APIs. For example numpy wants a lower case type identifier, e.g."float", rather than as upper case "Float" when creating an array with a type identifier. Numpy does have an "oldnumeric.py" library whose purpose - as the name implies - is to add a compatibility layer between numpy and the older numeric libraries at the Python coding level.. It is trivial to have that library load as part of the start-up of vpython. For my purposes, I want to begin to understand the numpy library better, and having the incompatibilities fall out is helpful, so I have not done so. But Bruce might want to include it in the vpython start-up routines, at least during some transition period. What I have. *not* done is accomplish the changes to the build mechanism that are necessary to detect the numpy library as part of the configure routine and to create the proper Makefile or issue the appropriate messages in case of its failure to do so. I have simply been manually editing the Makefile for the few changes necessary to build against numpy. My interest in learning more about the vpython, boost and numpy internals, and get more hands on with C++ in general, made this little numpy compatibility effort on my part something I enjoyed, being compatible with my more general personal objectives. Dealing with the build issues would be less so.So I am hoping someone else will step up to the plate. OTOH, the necessary changes are probably not hard to accomplish, and if no one else does, I will try to get to it. Bruce, What next? Art |