[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] Basic Swarm to HDF5 question
From: |
Kerimcan Ozcan |
Subject: |
Re: [Swarm-Support] Basic Swarm to HDF5 question |
Date: |
Sat, 8 Sep 2007 07:08:07 -0700 (PDT) |
Hi Marcus,
Thank you very much for the explanation. I have
another question. I want to create my experimental
parameters and variable values (some agent variable
values) in R. These parameters and variable values
will be in the form of several vectors (e.g. a vector
for the age of each agent) and matrices (e.g. a social
network matrix) of possibly different types (integer,
double, character etc.). Then I will save them as one
HDF5 file (so that one file contains all
parameters/variable values for one experimental
configuration). Then I will read that file from within
SWARM.
For the simplest case consider this as my R file to
generate the HDF file:
# One vector for agent variables
pars <- rnorm(10);
# One matrix for social network
net <- rnorm(100);
dim(net) <- c(10,10);
# Put together as a list and saved in an HDF5 file
expData <- list(pars=pars,net=net);
attr(expData,"type") <- "List";
hdf5save("sup-ex.hdf","expData");
Now, I am at a loss as to how I would load this into
SWARM and access values inside the pars and net
components. In particular, how would you modify the
code given here:
http://www.swarm.org/pipermail/support/2005-May/014651.html
I would really appreciate your help.
Best,
Kerimcan
--- "Marcus G. Daniels" <address@hidden> wrote:
> Hi Kerimcan,
>
> Another place to look is in the Swarm testsuite (in
> the Swarm source code).
> For example tests/collections contrasts shallow
> (table-like) vs
> depth-first (tree-like) saving.
>
> The HDF5 files created by those tests, e.g.
> shallowList.hdf and
> shallowMap.hdf can be loaded as data frames in R.
> Maps will have row
> names attached and lists will not. The deepMap.hdf
> and deepList.hdf
> will be lists of lists when loaded into R. To load,
> use:
>
> library(hdf5)
> hdf5load("shallowMap.hdf")
> collections
>
> Marcus
>
> P.S. while the Swarm side of this is really random
> access, the R side is
> not. It's necessary to load the whole file into
> memory. That's not
> such a big deal these days with cheap RAM and 64 bit
> architectures, but
> it might be nice to rework the R module to do what
> the PgSQL module used
> to do, whereby one `attaches' to the database and
> then proxies to the
> objects are available as ordinary variables, but
> lazily evaluated for
> the sake of random access.
> _______________________________________________
> Support mailing list
> address@hidden
> http://www.swarm.org/mailman/listinfo/support
>
____________________________________________________________________________________
Choose the right car based on your needs. Check out Yahoo! Autos new Car
Finder tool.
http://autos.yahoo.com/carfinder/