← Back to team overview

dolfin team mailing list archive

Re: PythonFile: read_array()

 

On Fri, Oct 28, 2005 at 12:01:03AM -0500, Anders Logg wrote:
> I tried the new PythonFile format and ran into some problems.
> 
> Where is dolfin.read_array() that gets called when reading data
> generated in the new PythonFile format?
> 
> It also looks like the Python format is dependent on PyDOLFIN. Is that
> necessary? Maybe one would like to compute a solution with a C++
> program and then visualize it from Python without having to install
> PyDOLFIN?
> 
> Another topic while I'm at it: should we decide on some basic coding
> styles? Nothing serious, but I would suggest the following to begin
> with (it's basically what we have now):
> 
>     classes:   ClassName
>     functions: functionName
>     variables: variable_name
> 
> So read_array() would be readArray().
> 
> In addition, we should try to keep the number of function names and
> variable names consisting of more than one word to a minimum (by
> design, not by cryptic naming).
> 
> /Anders
> 

Hi!

read_array() is in src/pydolfin/dolfin/read_array.py (the PyDOLFIN
module consists of both a shared library and Python code, to allow for
extra utility functions for example). It's a reimplementation of
scipy.io.read_array() which for some reason is terribly slow (a factor
20 slower than a naive implementation, they know about this). So the
real solution is to rewrite scipy.io.read_array() and make it
fast. This is just a temporary fix so I don't have to wait 5 minutes
for something that should take 15 seconds when trying out PyDOLFIN.

I guess an even better solution would be to find an XML-format which
can handle incremental storage of matrices, but I couldn't find such a
format.

The Python format is only dependent on PyDOLFIN through read_array(),
but it's interface-compatible with scipy.io.read_array() (the same
goes for the data format), so all that's needed is just to read the
files with scipy to remove the PyDOLFIN dependency.

The coding style looks good. In this case though, the function name
comes from scipy, so then it should probably remain the same for
compatibility.

  Johan



Follow ups

References