swarm-support
[Top][All Lists]
Advanced

[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: Tue, 2 Feb 2010 15:46:59 -0800 (PST)

Hi Marcus and everyone,

I just realized that latest versions of HDF5 package of R are not backwards 
compatible in the sense that not only Swarm 2.2 will not open HDF files created 
in R but also HDFView will not display the contents of the files (complains 
that the file is not in a recognized format). There was also a recent message 
in r-support mailing list about HDF5 not working properly. In other words, the 
HDF5 package for R seems to be working only within R (you can access components 
of it in R) but not outside of it. 

Here is the good news. If you use R 2.7.1 and hdf5_1.6.6 version, it will be 
compatible with Swarm 2.2. Wanted to leave a report so that others who might 
work with HDF5 format don't get frustrated with newer versions.

Best,

Kerimcan


--- On Sat, 9/8/07, Marcus G. Daniels <address@hidden> wrote:

> From: Marcus G. Daniels <address@hidden>
> Subject: Re: [Swarm-Support] Basic Swarm to HDF5 question
> To: "Swarm Support" <address@hidden>
> Date: Saturday, September 8, 2007, 2:16 PM
> Hi Kerimcan,
> > 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.
> >   
> Ok, here's how I'd do it.  First thing to note is that
> the Swarm reader/writer wants to work in objects. To make an
> object in R is just making a named list referencing your
> vectors:
> 
> expData <- list(pars=pars,net=net)
> 
> .. and then attaching a `type' attribute to that
> object.   The Swarm reader will use that type
> name to be the object name to instantiate.
> 
> attr(expData,"type") <- "ExpData"
> 
> Then it's just a matter of having `ExpData' ready on the
> Swarm end with the methods you want.  Actually you
> don't need to make this class at all, if you are willing to
> use probes to read and write its values.
> 
> [fyi, HDF5, the `objects' are stored as HDF5 groups and the
> fields (either scalars, vectors, or matrices) are stored as
> HDF5 datasets.
> The R attributes, e.g. `type' are stored as HDF5 attributes
> on the group.]
> 
> Marcus
> 
> -----Inline Attachment Follows-----
> 
> library(hdf5)
> 
> pars <- rnorm(10)
> net <- rnorm(100)
> dim(net) <- c(10,10)
> 
> expData <- list(pars=pars,net=net)
> attr(expData,"type") <- "ExpData"
> 
> print(pars)
> print(net)
> 
> hdf5save("sup-ex.hdf","expData")
> 
> -----Inline Attachment Follows-----
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Support mailing list
> address@hidden
> http://www.swarm.org/mailman/listinfo/support
> 


      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]