#NEWLINE# @ classmethod #NEWLINE# def add_numpy_methods( cls ) : #NEWLINE# #INDENT# 'Adds numpy operator methods (+, -, etc.) to this class to allow\n        simple manipulation of the data, e.g. with VolumeData v:\n        v + 1 # Returns new VolumeData with 1 added to data\n        v ** 2 # Returns new VolumeData with data squared\n        ' #NEWLINE# npops = [ '__add__' , '__sub__' , '__mul__' , '__div__' , '__pow__' , '__neg__' , '__abs__' ] #NEWLINE# def make_opfun( op ) : #NEWLINE# #INDENT# def opfun( self , * args ) : #NEWLINE# #INDENT# return self . copy ( getattr ( self . data , op ) ( * args ) ) #NEWLINE# #UNINDENT# return opfun #NEWLINE# #UNINDENT# for op in npops : #NEWLINE# #INDENT# opfun = make_opfun ( op ) #NEWLINE# opfun . __name__ = op #NEWLINE# setattr ( cls , opfun . __name__ , opfun )