[Numpy-discussion] dtype "reduction"

Nicolas Rougier Nicolas.Rougier at inria.fr
Wed Dec 26 15:09:23 EST 2012

Hi all,

I'm looking for a way to "reduce" dtype1 into dtype2 (when it is possible of course).
Is there some easy way to do that by any chance ?

dtype1 = np.dtype( [ ('vertex',  [('x', 'f4'),
                                  ('y', 'f4'),
                                  ('z', 'f4')]),
                    ('normal',  [('x', 'f4'),
                                 ('y', 'f4'),
                                 ('z', 'f4')]),
                    ('color',   [('r', 'f4'),
                                 ('g', 'f4'),
                                 ('b', 'f4'),
                                 ('a', 'f4')]) ] )

dtype2 = np.dtype( [ ('vertex',  'f4', 3),
                     ('normal',  'f4', 3),
                     ('color',   'f4', 4)] )


More information about the NumPy-Discussion mailing list