def test_refpts_iterator(simple_ring): assert (list(refpts_iterator(simple_ring, [0, 1, 2, 3, 4, 5])) == simple_ring) assert (list(refpts_iterator(simple_ring, numpy.ones(6, dtype=bool))) == simple_ring) assert list(refpts_iterator(simple_ring, [1])) == [simple_ring[1]] a = numpy.array([False, True, False, False, False, False]) assert list(refpts_iterator(simple_ring, a)) == [simple_ring[1]]
def getfun(ring): values = np.array([ getf(elem, attname) for elem in refpts_iterator(ring, refpts) ]) return np.average(values)
def setfun(ring, value): for elem in refpts_iterator(ring, refpts): setf(elem, attname, value)