>>> class Hooke (object):
... pass
>>> h = Hooke()
+ >>> d = Data(shape=(3,2), info={'columns':['distance (m)', 'force (N)']})
+ >>> for i in range(3): # initialize d
+ ... for j in range(2):
+ ... d[i,j] = i*10 + j
>>> c = Curve(None)
+ >>> c.data = [d]
>>> c.set_hooke(h)
>>> c._hooke # doctest: +ELLIPSIS
<hooke.curve.Hooke object at 0x...>
<hooke.curve.Hooke object at 0x...>
>>> c2._hooke == h
True
+ >>> c2.data
+ [Data([[ 0., 1.],
+ [ 10., 11.],
+ [ 20., 21.]])]
+ >>> d.info
+ {'columns': ['distance (m)', 'force (N)']}
+ >>> id(c2.data[0]) == id(d)
+ True
"""
copier = _copy_dispatch.get(type(self))
if copier:
>>> class Hooke (object):
... pass
>>> h = Hooke()
+ >>> d = Data(shape=(3,2), info={'columns':['distance (m)', 'force (N)']})
+ >>> for i in range(3): # initialize d
+ ... for j in range(2):
+ ... d[i,j] = i*10 + j
>>> c = Curve(None)
+ >>> c.data = [d]
>>> c.set_hooke(h)
>>> c._hooke # doctest: +ELLIPSIS
<hooke.curve.Hooke object at 0x...>
<hooke.curve.Hooke object at 0x...>
>>> c2._hooke == h
True
+ >>> c2.data
+ [Data([[ 0., 1.],
+ [ 10., 11.],
+ [ 20., 21.]])]
+ >>> d.info
+ {'columns': ['distance (m)', 'force (N)']}
+ >>> id(c2.data[0]) == id(d)
+ False
"""
reductor = dispatch_table.get(type(self))
if reductor: