-# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
#
# This file is part of Hooke.
#
-# Hooke is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
#
-# Hooke is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
-# Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Hooke. If not, see
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with Hooke. If not, see <http://www.gnu.org/licenses/>.
"""The `curve` module provides :class:`Curve` and :class:`Data` for
storing force curves.
The data-type is also YAMLable (see :mod:`hooke.util.yaml`).
>>> import yaml
- >>> print yaml.dump(d)
+ >>> s = yaml.dump(d)
+ >>> print s
!hooke.curve.DataInfo
columns: [distance (m), force (N)]
<BLANKLINE>
+ >>> z = yaml.load(s)
+ >>> z
+ Data([], shape=(0, 0), dtype=float32)
"""
def __new__(subtype, shape, dtype=numpy.float, buffer=None, offset=0,
strides=None, order=None, info=None):
return self.__str__()
def set_path(self, path):
+ if path != None:
+ path = os.path.expanduser(path)
self.path = path
if self.name == None and path != None:
self.name = os.path.basename(path)