From: Anthony S. <sc...@gm...> - 2013-01-23 15:57:54
|
Hi Andreas, I think that the problem here is that coord_slice is actually a list of slices, which you can't index by. (Though, you may be able to in numpy...) Try something like _ds[coord_slice[0]] instead. Be Well Anthony B eW On Tue, Jan 22, 2013 at 8:44 AM, Andreas Hilboll <li...@hi...> wrote: > Hi, > > how can I use Python's built-in `slice` object on CArray? Currently, I'm > trying > > In: coord_slice > Out: [slice(0, 31, None), slice(0, 5760, None), slice(0, 2880, None)] > > In: _ds > Out: /data/mydata (CArray(31, 5760, 2880), shuffle, blosc(5)) '' > atom := Float32Atom(shape=(), dflt=0.0) > maindim := 0 > flavor := 'numpy' > byteorder := 'little' > chunkshape := (1, 45, 2880) > > In: _ds[coord_slice] > Out: *** TypeError: long() argument must be a string or a number, > not 'slice' > > The problem is that I want to write something generic, and I don't know > beforehand how many dimensions the CArray has. My current plan is to > create a tuple of slice objects programatically (using list > comprehension), and then use this tuple as index. But apparently it > doesn't work with pytables 2.3.1. > > Any suggestions on how to accomplish my task are greatly appreciated :) > > Cheers, Andreas. > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users > |