[SciPy-user] Using savemat with (nested) NumPy record arrays?

Christopher A Mejia camejia at raytheon.com
Fri Apr 24 09:46:56 EDT 2009


Matthew,

Yes and yes!  I downloaded the latest SVN, and savemat of NumPy scalars 
(shape==()) worked correctly, and savemat ran much faster.  A data set 
which did not complete in writing overnight (~16 hours) succesfully wrote 
in 4.5 minutes with the update.  Thank you!

I did notice that the files created by savemat are rather large; if I read 
it in MATLAB and write it back out, it is much smaller.  Maybe MATLAB is 
intelligent deciding when to compress the data?  Anyway, this is not a big 
deal and savemat certainly provides the functionality I need.

Another "nice to have" would be to upgrade savemat to work with nested 
dtypes, in addition to dtype=object.  I don't know enough about Python to 
know if this is simple or complicated, and as long as one knows that you 
need to set dtype=object instead of defining a nested dtype, again all of 
the functionality is there.

Thanks again,
--Chris
 



Matthew Brett <matthew.brett at gmail.com> 
Sent by: scipy-user-bounces at scipy.org
04/22/2009 09:09 PM
Please respond to
SciPy Users List <scipy-user at scipy.org>


To
SciPy Users List <scipy-user at scipy.org>
cc

Subject
Re: [SciPy-user] Using savemat with (nested) NumPy record arrays?






Hi,

> 2.  However, I didn't get any data showing up in MATLAB after loading my
> file, unless I made sure that all of the arrays had a shape with at 
least
> one dimension.

There was a bug in scipy 0.7 release - do you have the latest SVN?
Does that work?

> The problem I'm running into now is that the savemat function is too 
slow.
>  The top level of data I'm trying to save is an array of structures.  It
> seems that the time for savemat increases exponentially as the number of
> records in this structure array increases.  Is there a better way to
> organize the storage of data into savemat, or is there a simple way to
> modify savemat to speed it up?

Yes, that's a known problem as well.  The hope is that the current SVN
implementation is a lot faster.  I'd be very glad of your feedback
about that...

Thanks,

Matthew
_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090424/ab2363b6/attachment.html>


More information about the SciPy-User mailing list