[Numpy-discussion] bug in array instanciation?

2012-01-27 Thread Emmanuel Mayssat
In [20]: dt_knobs = [('pvName',(str,40)),('start','float'),('stop','float'),('mode',(str,10))] In [21]: r_knobs = np.recarray([],dtype=dt_knobs) In [22]: r_knobs Out[22]: rec.array(('\xa0\x8c\xc9\x02\x00\x00\x00\x00(\xc8v\x02\x00\x00\x00\x00\x00\xd3\x86\x02\x00\x00\x00\x00\x10\xdeJ\x02\x00\x00\x0

Re: [Numpy-discussion] array metadata

2012-01-26 Thread Emmanuel Mayssat
subclassing is what I was looking for. Indeed the code is almost available at http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray I just created a dictionary variable which I called 'metadata' I had to overload the __repr__ method to prin

[Numpy-discussion] array metadata

2012-01-25 Thread Emmanuel Mayssat
Is there a way to store metadata for an array? For example, date the samples were collected, name of the operator, etc. Regards, -- Emmanuel ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discuss

[Numpy-discussion] 'Advanced' save and restore operation

2012-01-23 Thread Emmanuel Mayssat
After having saved data, I need to know/remember the data dtype to restore it correctly. Is there a way to save the dtype with the data? (I guess the header parameter of savedata could help, but they are only available in v2.0+ ) I would like to save several related structured array and a dictiona

[Numpy-discussion] Saving and loading a structured array from a TEXT file

2012-01-23 Thread Emmanuel Mayssat
Is there a way to save a structured array in a text file? My problem is not so much in the saving procedure, but rather in the 'reloading' procedure. See below In [3]: import numpy as np In [4]: r = np.ones(3,dtype=[('name', '|S5'), ('foo', ' in () > 1 r2 = np.fromfile('toto.txt',sep='\n',dt