# demos a bug where imin was rank 0 dataset, and it could not be used to
# index another dataset because of __getitem__.

xxs= linspace( PI, 2*PI, 101 )
xxs.putProperty( QDataSet.NAME, 'xxs' )  # for debugging.

yys= sin( xxs )
yys.putProperty( QDataSet.NAME, 'yys' )

plot(xxs,yys)

mn= reduceMin( yys, 0 )
mn.putProperty( QDataSet.NAME, 'mn' )

imin= where( yys.eq(mn) )
imin.putProperty( QDataSet.NAME, 'imin' )

print 1, imin
print 2, imin[0]
print 3, xxs[imin]
print 4, xxs[0].rank()
print 15, imin
print 5, imin[0].rank()
imin0= imin[0]
print 6, xxs[imin0].rank()
