17 import builtins
as __builtin__
21 strthis =
"proxy of " + self.this.__repr__()
22 except __builtin__.Exception:
24 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
27 def _swig_setattr_nondynamic_instance_variable(set):
28 def set_instance_attr(self, name, value):
30 set(self, name, value)
31 elif name ==
"thisown":
33 elif hasattr(self, name)
and isinstance(getattr(type(self), name), property):
34 set(self, name, value)
36 raise AttributeError(
"You cannot add instance attributes to %s" % self)
37 return set_instance_attr
40 def _swig_setattr_nondynamic_class_variable(set):
41 def set_class_attr(cls, name, value):
42 if hasattr(cls, name)
and not isinstance(getattr(cls, name), property):
45 raise AttributeError(
"You cannot add class attributes to %s" % cls)
49 class _SwigNonDynamicMeta(type):
50 """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
51 __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
56 class IMP_KMEANS_SwigPyIterator(object):
57 r"""Proxy of C++ swig::IMP_KMEANS_SwigPyIterator class."""
59 thisown = property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
"The membership flag")
61 def __init__(self, *args, **kwargs):
62 raise AttributeError(
"No constructor defined - class is abstract")
64 __swig_destroy__ = _IMP_kmeans.delete_IMP_KMEANS_SwigPyIterator
67 r"""value(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
68 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_value(self)
71 r"""incr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator"""
72 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_incr(self, n)
75 r"""decr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator"""
76 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_decr(self, n)
78 def distance(self, x):
79 r"""distance(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t"""
80 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_distance(self, x)
83 r"""equal(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
84 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_equal(self, x)
87 r"""copy(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator"""
88 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_copy(self)
91 r"""__next__(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
92 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___next__(self)
95 r"""previous(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
96 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_previous(self)
99 r"""advance(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
100 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_advance(self, n)
103 r"""__eq__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
104 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___eq__(self, x)
107 r"""__ne__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
108 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___ne__(self, x)
110 def __iadd__(self, n):
111 r"""__iadd__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
112 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___iadd__(self, n)
114 def __isub__(self, n):
115 r"""__isub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
116 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___isub__(self, n)
118 def __add__(self, n):
119 r"""__add__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
120 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___add__(self, n)
122 def __sub__(self, *args):
124 __sub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator
125 __sub__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t
127 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___sub__(self, *args)
132 _IMP_kmeans.IMP_KMEANS_SwigPyIterator_swigregister(IMP_KMEANS_SwigPyIterator)
139 IMP_DEBUG = _IMP_kmeans.IMP_DEBUG
141 IMP_RELEASE = _IMP_kmeans.IMP_RELEASE
143 IMP_SILENT = _IMP_kmeans.IMP_SILENT
145 IMP_PROGRESS = _IMP_kmeans.IMP_PROGRESS
147 IMP_TERSE = _IMP_kmeans.IMP_TERSE
149 IMP_VERBOSE = _IMP_kmeans.IMP_VERBOSE
151 IMP_MEMORY = _IMP_kmeans.IMP_MEMORY
153 IMP_NONE = _IMP_kmeans.IMP_NONE
155 IMP_USAGE = _IMP_kmeans.IMP_USAGE
157 IMP_INTERNAL = _IMP_kmeans.IMP_INTERNAL
159 IMP_KERNEL_HAS_LOG4CXX = _IMP_kmeans.IMP_KERNEL_HAS_LOG4CXX
161 IMP_COMPILER_HAS_CEREAL_RAW_POINTER = _IMP_kmeans.IMP_COMPILER_HAS_CEREAL_RAW_POINTER
163 IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_kmeans.IMP_COMPILER_HAS_DEBUG_VECTOR
165 IMP_COMPILER_HAS_RANDOM_SHUFFLE = _IMP_kmeans.IMP_COMPILER_HAS_RANDOM_SHUFFLE
167 IMP_COMPILER_HAS_THREE_WAY = _IMP_kmeans.IMP_COMPILER_HAS_THREE_WAY
169 IMP_KERNEL_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KERNEL_HAS_BOOST_RANDOM
171 IMP_KERNEL_HAS_NUMPY = _IMP_kmeans.IMP_KERNEL_HAS_NUMPY
173 IMP_KERNEL_HAS_BOOST_SYSTEM = _IMP_kmeans.IMP_KERNEL_HAS_BOOST_SYSTEM
175 IMP_KERNEL_HAS_GPERFTOOLS = _IMP_kmeans.IMP_KERNEL_HAS_GPERFTOOLS
177 IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER = _IMP_kmeans.IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER
179 IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER = _IMP_kmeans.IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER
181 IMPKERNEL_SHOW_WARNINGS = _IMP_kmeans.IMPKERNEL_SHOW_WARNINGS
185 class _DirectorObjects:
186 """@internal Simple class to keep references to director objects
187 to prevent premature deletion."""
190 def register(self, obj):
191 """Take a reference to a director object; will only work for
192 refcounted C++ classes"""
193 if hasattr(obj,
'get_ref_count'):
194 self._objects.append(obj)
196 """Only drop our reference and allow cleanup by Python if no other
197 Python references exist (we hold 3 references: one in self._objects,
198 one in x, and one in the argument list for getrefcount) *and* no
199 other C++ references exist (the Python object always holds one)"""
200 objs = [x
for x
in self._objects
if sys.getrefcount(x) > 3 \
201 or x.get_ref_count() > 1]
205 def get_object_count(self):
206 """Get number of director objects (useful for testing only)"""
207 return len(self._objects)
208 _director_objects = _DirectorObjects()
210 class _ostream(object):
211 r"""Proxy of C++ std::ostream class."""
213 thisown = property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
"The membership flag")
215 def __init__(self, *args, **kwargs):
216 raise AttributeError(
"No constructor defined")
217 __repr__ = _swig_repr
219 def write(self, osa_buf):
220 r"""write(_ostream self, char const * osa_buf)"""
221 return _IMP_kmeans._ostream_write(self, osa_buf)
224 _IMP_kmeans._ostream_swigregister(_ostream)
225 IMP_C_OPEN_BINARY = _IMP_kmeans.IMP_C_OPEN_BINARY
228 IMP_KMEANS_HAS_BOOST_FILESYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_FILESYSTEM
230 IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS
232 IMP_KMEANS_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_RANDOM
234 IMP_KMEANS_HAS_NUMPY = _IMP_kmeans.IMP_KMEANS_HAS_NUMPY
236 IMPKMEANS_SHOW_WARNINGS = _IMP_kmeans.IMPKMEANS_SHOW_WARNINGS
239 _object_types.append(
"KMeans")
242 def _object_cast_to_KMeans(o):
243 r"""_object_cast_to_KMeans(Object o) -> KMeans"""
244 return _IMP_kmeans._object_cast_to_KMeans(o)
245 KM_LLOYDS = _IMP_kmeans.KM_LLOYDS
247 KM_LOCAL_SWAP = _IMP_kmeans.KM_LOCAL_SWAP
249 KM_LOCAL_EZ_HYBRID = _IMP_kmeans.KM_LOCAL_EZ_HYBRID
251 KM_HYBRID = _IMP_kmeans.KM_HYBRID
254 r"""Proxy of C++ IMP::kmeans::KMeans class."""
256 thisown = property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
"The membership flag")
258 def __init__(self, *args):
260 __init__(KMeans self, std::string const & fname_data, int dim, unsigned int max_nPts) -> KMeans
261 __init__(KMeans self) -> KMeans
263 _IMP_kmeans.KMeans_swiginit(self, _IMP_kmeans.new_KMeans(*args))
266 r"""get_version_info(KMeans self) -> VersionInfo"""
267 return _IMP_kmeans.KMeans_get_version_info(self)
268 __swig_destroy__ = _IMP_kmeans.delete_KMeans
270 def execute(self, *args):
271 r"""execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS, int stages=100)"""
272 return _IMP_kmeans.KMeans_execute(self, *args)
274 def add_data_pt(self, p):
275 r"""add_data_pt(KMeans self, IMP::Floats const & p)"""
276 return _IMP_kmeans.KMeans_add_data_pt(self, p)
278 def clear_data(self):
279 r"""clear_data(KMeans self)"""
280 return _IMP_kmeans.KMeans_clear_data(self)
282 def get_data_point(self, i):
283 r"""get_data_point(KMeans self, unsigned int i) -> IMP::Floats const &"""
284 return _IMP_kmeans.KMeans_get_data_point(self, i)
286 def get_number_of_data_points(self):
287 r"""get_number_of_data_points(KMeans self) -> unsigned int"""
288 return _IMP_kmeans.KMeans_get_number_of_data_points(self)
290 def print_centers(self, *args):
291 r"""print_centers(KMeans self, IMP::LogLevel ll=PROGRESS)"""
292 return _IMP_kmeans.KMeans_print_centers(self, *args)
294 def get_center(self, i):
295 r"""get_center(KMeans self, unsigned int i) -> IMP::Floats"""
296 return _IMP_kmeans.KMeans_get_center(self, i)
298 def get_assignments(self):
299 r"""get_assignments(KMeans self) -> IMP::Ints"""
300 return _IMP_kmeans.KMeans_get_assignments(self)
302 def get_squared_distance_to_centers(self):
303 r"""get_squared_distance_to_centers(KMeans self) -> IMP::Floats"""
304 return _IMP_kmeans.KMeans_get_squared_distance_to_centers(self)
306 def get_number_of_centers(self):
307 r"""get_number_of_centers(KMeans self) -> unsigned int"""
308 return _IMP_kmeans.KMeans_get_number_of_centers(self)
311 r"""__str__(KMeans self) -> std::string"""
312 return _IMP_kmeans.KMeans___str__(self)
315 r"""__repr__(KMeans self) -> std::string"""
316 return _IMP_kmeans.KMeans___repr__(self)
320 return _object_cast_to_KMeans(o)
324 _IMP_kmeans.KMeans_swigregister(KMeans)
326 def get_module_name():
327 r"""get_module_name() -> std::string const"""
328 return _IMP_kmeans.get_module_name()
331 r"""get_module_version() -> std::string const"""
332 return _IMP_kmeans.get_module_version()
335 r"""get_example_path(std::string fname) -> std::string"""
336 return _IMP_kmeans.get_example_path(fname)
339 r"""get_data_path(std::string fname) -> std::string"""
340 return _IMP_kmeans.get_data_path(fname)
342 from .
import _version_check
Common base class for heavy weight IMP objects.
std::string get_module_version()
Return the version of this module, as a string.
virtual VersionInfo get_version_info() const
Get information about the module and version of the object.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
std::string get_data_path(std::string file_name)
Return the full path to one of this module's data files.