On 4/30/12 12:08 PM, Alvaro Tejero Cantero wrote:
> Hi all,
>
> I created a table:
>
>>>> joins.createTable('/','spikes',{'t20k':pt.Int32Col(),'tetrode':pt.UInt8Col(),
>>>>  'unit':pt.UInt8Col()},'Spike times')
> I populated it
>
>>>> joins.root.spikes.append(zip(np.arange(100),np.zeros(100), 3*np.ones(100)))
> now if I do
>
>>>> joins.root.spikes.cols.tetrode[:] = np.ones(100)
> I can see the updated value (all ones instead of zeros)
>
> If I fetch all the table in memory,
>
>>>> joins.root.spikes[:]
> I still see only the original zeros, i.e. the column update has not propagated

Hmm, I cannot reproduce this:

In [18]: joins = pt.openFile("joins.h5", "w")

In [19]: 
joins.createTable('/','spikes',{'t20k':pt.Int32Col(),'tetrode':pt.UInt8Col(), 
'unit':pt.UInt8Col()},'Spike times')
Out[19]:
/spikes (Table(0,)) 'Spike times'
   description := {
   "t20k": Int32Col(shape=(), dflt=0, pos=0),
   "tetrode": UInt8Col(shape=(), dflt=0, pos=1),
   "unit": UInt8Col(shape=(), dflt=0, pos=2)}
   byteorder := 'little'
   chunkshape := (10922,)

In [20]: joins.root.spikes.append(zip(np.arange(10),np.zeros(10), 
3*np.ones(10)))

In [22]: joins.root.spikes[:]
Out[22]:
array([(0, 0, 3), (1, 0, 3), (2, 0, 3), (3, 0, 3), (4, 0, 3), (5, 0, 3),
        (6, 0, 3), (7, 0, 3), (8, 0, 3), (9, 0, 3)],
       dtype=[('t20k', '<i4'), ('tetrode', 'u1'), ('unit', 'u1')])

In [23]: joins.root.spikes.cols.tetrode[:] = np.ones(10)

In [24]: joins.root.spikes[:]
Out[24]:
array([(0, 1, 3), (1, 1, 3), (2, 1, 3), (3, 1, 3), (4, 1, 3), (5, 1, 3),
        (6, 1, 3), (7, 1, 3), (8, 1, 3), (9, 1, 3)],
       dtype=[('t20k', '<i4'), ('tetrode', 'u1'), ('unit', 'u1')])

Which versions are you using?

-- 
Francesc Alted


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to