On Thu, January 4, 2007 12:00, Sven Schreiber wrote:
It all revolves around gretl's nice function package GUI. Of course
everything could also be achieved simply in a regular script, using
'include' etc. However, I really would like to take advantage of the
GUI, it's much more user-friendly; well that's why you guys cooked it up
in the first place, right?
Ok, to be concrete, my prototype py4gretl mini-app does the following:
[snip]
Ok, I see what you mean now. If I'm not mistaken, your idea is to use the
include statement to bring back into gretl some objects (presumably matrices),
previously generated outside by a python script.
Allin and I had started thinking about a similar mechanism some months ago:
the only difference was that I had thought of using Ox instead of python. I
even managed to write a working prototype of an exchange mechanism that worked
as follows.
First, let's define the concept of a "binary bundle". A binary bundle is a
binary file which contains one or more objects. An object can be
1) a scalar
2) a matrix
3) a dataset
4) a model
Now, everything that's needed to shuffle stuff to/from gretl is the ability,
by gretl and the helper application (Ox, python, R, scilab, whatever) to read
and write bundles. I had come to the point of writing an Ox class for this,
and the corresponding C functions, which we never merged into gretl. But if
you think that you can write a corresponding set of functions in python, then
we wouldn't need to mess with run/include. For example, you may do
--- * gretl side * ---
series x = log(z)
bundle_write(x, "/tmp/foo.gbb")
ols y 0 x
matrix V = $vcv
bundle_write(V, "/tmp/foo.gbb")
! ... your external command here ...
matrix beta = bundle_read("b", "/tmp/bar.gbb")
--- * helper app side (pseudocode vaguely reminiscent of R) * ---
x <- bundle.read(x, "/tmp/foo.gbb")
v <- bundle.read(V, "/tmp/foo.gbb")
/* do stuff */
bundle.write(b, "/tmp/bar.gbb")
I think this would provide a very neat way to do what I assume you need.
However, the coding effort is definitely not trivial. Could we schedule this
for 1.7.0?
Riccardo (Jack) Lucchetti
Dipartimento di Economia
FacoltĂ di Economia "G. FuĂ "
Ancona