from org.virbo.dataset import QubeDataSetIterator ds= findgen(5,2) print 'Input ds is ', ds print '==ds[:,:]==' it= QubeDataSetIterator(ds) print 'it.rank()=', it.rank(), ' the rank of the result' while it.hasNext(): it.next() print it, it.getValue(ds) print '==start stop iterator ds[0:3,:]==' it= QubeDataSetIterator(ds) it.setIndexIteratorFactory(0,QubeDataSetIterator.StartStopStepIteratorFactory(0,3,1) ) print 'it.rank()=', it.rank(), ' the rank of the result' while it.hasNext(): it.next() print it, it.getValue(ds) print '==singleton iterator ds[:,0]==' it= QubeDataSetIterator(ds) it.setIndexIteratorFactory(1,QubeDataSetIterator.SingletonIteratorFactory(0) ) print 'it.rank()=', it.rank(), ' the rank of the result' while it.hasNext(): it.next() print it, it.getValue(ds) print '==singleton iterator ds[:,0]==' it= QubeDataSetIterator(ds) it.setIndexIteratorFactory(1,QubeDataSetIterator.SingletonIteratorFactory(0) ) print 'it.rank()=', it.rank(), ' the rank of the result' print 'it.length(0)=', it.length(0), ' it.length(1)=', it.length(1) while it.hasNext(): it.next() print 'it.index(0)=', it.index(0), ' it.index(1)=', it.index(1) print 'where is length() used?' ds= findgen(3,4,5) print ds it= QubeDataSetIterator(ds) it.setIndexIteratorFactory(1,QubeDataSetIterator.SingletonIteratorFactory(0) ) print it print 'it.rank()=', it.rank(), ' the rank of the result' print 'it.length(0)=', it.length(0), ' it.length(1)=', it.length(1), ' it.length(2)=', it.length(2), 'the number of iterations for each dimension'