[SciPy-user] structure arrays in SciPy

Ryan Krauss ryanfedora at comcast.net
Fri May 13 09:15:24 EDT 2005


Maybe an example would make this clearer.  What if I want to store a 
collection of objects with the following properties:
entry1.input='a1'
entry1.output='j2'
entry1.datafile=['file1','file2','file3']
entry1.data1=[1.2,1.47,3.56,....]
entry1.data2=[-1.5,-19.5,35.5,....]

where data1 and data2 are actually Numeric or numarray arrays/matrices.  
How should I go about storing a collection of these objects in SciPy?  
Should I be defining my own class and simply make a list of them and 
pickle the list?

Thanks for any help,

Ryan


Ryan Krauss wrote:

> I need to store and retrieve a collection of test results where each 
> test would have some typical properties like the date it was run and 
> other scalar desriptors.  But the main data from the test will  be 
> vectors or matrices of data the I will later plot.  Each vector or 
> matrix might have 20000 rows of floating point numbers and there may 
> be 10 or more of these test results that I want to store in a group.  
> Can SQLOjbect handle storing a matrix instance?  I am quite new to SQL 
> as well as SQLObject, so I don't know if the matrices could somehow be 
> seperate tables or something.
>
> I started looking into hdf5 as a way to store this kind of data, but I 
> think it is more complicated than I need.
>
> Any help would be appreciated.
>
> Ryan
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>





Ryan Krauss wrote:

> I have some data that I was storing in structure arrays in Matlab.  It 
> seems like I can do everything I need to do with mat_struct in SciPy, 
> but I am wondering if there is a better way.  Basically, I have some 
> experimental data I need to turn into Bode plots and then store with 
> some describing information.  Each test would have a magnitude vector, 
> a phase vector, and then some miscellanious information such as the 
> input and output (which would be strings), and raw data filenames (a 
> list of strings), and maybe a date and a description blurb.  A group 
> of these tests with different inputs and outputs would be one set that 
> I would save as a datafile.  In Matlab, each test was an element of a 
> structure array.  Each element of the structure array had unique 
> magnitude and phase vectors and input and output labels.  The rest of 
> the data was the same but got repeated for each element in the 
> structure array (I want to keep it all together in one structure and 
> what was repeated was small compared to the data vectors).
>
> I think I can do all of this with a list of mat_struct's and I seem to 
> be able to pickle and unpickle them with io.pickler.objload and 
> objsave, but I didn't know if there is some more elegant way of doing 
> this in SciPy.
>
> Any thoughts?
>
> Thanks,
>
> Ryan
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>




More information about the SciPy-User mailing list