9 from sys
import version_info
10 if version_info >= (2,6,0):
11 def swig_import_helper():
12 from os.path
import dirname
16 fp, pathname, description = imp.find_module(
'_IMP_kmeans', [dirname(__file__)])
22 _mod = imp.load_module(
'_IMP_kmeans', fp, pathname, description)
26 _IMP_kmeans = swig_import_helper()
27 del swig_import_helper
32 _swig_property = property
35 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
36 if (name ==
"thisown"):
return self.this.own(value)
38 if type(value).__name__ ==
'SwigPyObject':
39 self.__dict__[name] = value
41 method = class_type.__swig_setmethods__.get(name,
None)
42 if method:
return method(self,value)
44 self.__dict__[name] = value
46 raise AttributeError(
"You cannot add attributes to %s" % self)
48 def _swig_setattr(self,class_type,name,value):
49 return _swig_setattr_nondynamic(self,class_type,name,value,0)
51 def _swig_getattr(self,class_type,name):
52 if (name ==
"thisown"):
return self.this.own()
53 method = class_type.__swig_getmethods__.get(name,
None)
54 if method:
return method(self)
55 raise AttributeError(name)
58 try: strthis =
"proxy of " + self.this.__repr__()
60 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
65 except AttributeError:
72 weakref_proxy = weakref.proxy
74 weakref_proxy =
lambda x: x
77 class IMP_KMEANS_SwigPyIterator(_object):
78 """Proxy of C++ swig::IMP_KMEANS_SwigPyIterator class"""
79 __swig_setmethods__ = {}
80 __setattr__ =
lambda self, name, value: _swig_setattr(self, IMP_KMEANS_SwigPyIterator, name, value)
81 __swig_getmethods__ = {}
82 __getattr__ =
lambda self, name: _swig_getattr(self, IMP_KMEANS_SwigPyIterator, name)
83 def __init__(self, *args, **kwargs):
raise AttributeError(
"No constructor defined - class is abstract")
85 __swig_destroy__ = _IMP_kmeans.delete_IMP_KMEANS_SwigPyIterator
86 __del__ =
lambda self :
None;
88 """value(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
89 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_value(self)
93 incr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator
94 incr(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator
96 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_incr(self, n)
100 decr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator
101 decr(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator
103 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_decr(self, n)
105 def distance(self, *args):
106 """distance(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t"""
107 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_distance(self, *args)
109 def equal(self, *args):
110 """equal(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
111 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_equal(self, *args)
114 """copy(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator"""
115 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_copy(self)
118 """next(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
119 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_next(self)
122 """__next__(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
123 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___next__(self)
126 """previous(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
127 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_previous(self)
129 def advance(self, *args):
130 """advance(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
131 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_advance(self, *args)
133 def __eq__(self, *args):
134 """__eq__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
135 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___eq__(self, *args)
137 def __ne__(self, *args):
138 """__ne__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
139 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___ne__(self, *args)
141 def __iadd__(self, *args):
142 """__iadd__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
143 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___iadd__(self, *args)
145 def __isub__(self, *args):
146 """__isub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
147 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___isub__(self, *args)
149 def __add__(self, *args):
150 """__add__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
151 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___add__(self, *args)
153 def __sub__(self, *args):
155 __sub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator
156 __sub__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t
158 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___sub__(self, *args)
160 def __iter__(self):
return self
161 IMP_KMEANS_SwigPyIterator_swigregister = _IMP_kmeans.IMP_KMEANS_SwigPyIterator_swigregister
162 IMP_KMEANS_SwigPyIterator_swigregister(IMP_KMEANS_SwigPyIterator)
169 IMP_HAS_DEPRECATED = _IMP_kmeans.IMP_HAS_DEPRECATED
170 IMP_DEBUG = _IMP_kmeans.IMP_DEBUG
171 IMP_RELEASE = _IMP_kmeans.IMP_RELEASE
172 IMP_SILENT = _IMP_kmeans.IMP_SILENT
173 IMP_PROGRESS = _IMP_kmeans.IMP_PROGRESS
174 IMP_TERSE = _IMP_kmeans.IMP_TERSE
175 IMP_VERBOSE = _IMP_kmeans.IMP_VERBOSE
176 IMP_NONE = _IMP_kmeans.IMP_NONE
177 IMP_USAGE = _IMP_kmeans.IMP_USAGE
178 IMP_INTERNAL = _IMP_kmeans.IMP_INTERNAL
179 IMP_COMPILER_HAS_AUTO = _IMP_kmeans.IMP_COMPILER_HAS_AUTO
180 IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_kmeans.IMP_COMPILER_HAS_DEBUG_VECTOR
181 IMP_COMPILER_HAS_NULLPTR = _IMP_kmeans.IMP_COMPILER_HAS_NULLPTR
182 IMP_BASE_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_BASE_HAS_BOOST_RANDOM
183 IMP_BASE_HAS_GPERFTOOLS = _IMP_kmeans.IMP_BASE_HAS_GPERFTOOLS
184 IMP_BASE_HAS_LOG4CXX = _IMP_kmeans.IMP_BASE_HAS_LOG4CXX
185 IMP_BASE_HAS_TCMALLOC_HEAPCHECKER = _IMP_kmeans.IMP_BASE_HAS_TCMALLOC_HEAPCHECKER
186 IMP_BASE_HAS_TCMALLOC_HEAPPROFILER = _IMP_kmeans.IMP_BASE_HAS_TCMALLOC_HEAPPROFILER
188 class _DirectorObjects(object):
189 """@internal Simple class to keep references to director objects
190 to prevent premature deletion."""
193 def register(self, obj):
194 """Take a reference to a director object; will only work for
195 refcounted C++ classes"""
196 if hasattr(obj,
'get_ref_count'):
197 self._objects.append(obj)
199 """Only drop our reference and allow cleanup by Python if no other
200 Python references exist (we hold 3 references: one in self._objects,
201 one in x, and one in the argument list for getrefcount) *and* no
202 other C++ references exist (the Python object always holds one)"""
203 objs = [x
for x
in self._objects
if sys.getrefcount(x) > 3 \
204 or x.get_ref_count() > 1]
208 def get_object_count(self):
209 """Get number of director objects (useful for testing only)"""
210 return len(self._objects)
211 _director_objects = _DirectorObjects()
213 DEFAULT_CHECK = _IMP_kmeans.DEFAULT_CHECK
214 NONE = _IMP_kmeans.NONE
215 USAGE = _IMP_kmeans.USAGE
216 USAGE_AND_INTERNAL = _IMP_kmeans.USAGE_AND_INTERNAL
219 """set_check_level(IMP::base::CheckLevel tf)"""
220 return _IMP_kmeans.set_check_level(*args)
223 """get_check_level() -> IMP::base::CheckLevel"""
224 return _IMP_kmeans.get_check_level()
225 class _ostream(_object):
226 """Proxy of C++ std::ostream class"""
227 __swig_setmethods__ = {}
228 __setattr__ =
lambda self, name, value: _swig_setattr(self, _ostream, name, value)
229 __swig_getmethods__ = {}
230 __getattr__ =
lambda self, name: _swig_getattr(self, _ostream, name)
231 def __init__(self, *args, **kwargs):
raise AttributeError(
"No constructor defined")
232 __repr__ = _swig_repr
233 def write(self, *args):
234 """write(_ostream self, char const * osa_buf)"""
235 return _IMP_kmeans._ostream_write(self, *args)
237 _ostream_swigregister = _IMP_kmeans._ostream_swigregister
238 _ostream_swigregister(_ostream)
240 IMP_COMPILER_HAS_OVERRIDE = _IMP_kmeans.IMP_COMPILER_HAS_OVERRIDE
241 IMP_COMPILER_HAS_FINAL = _IMP_kmeans.IMP_COMPILER_HAS_FINAL
243 IMP_KMEANS_HAS_BOOST_FILESYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_FILESYSTEM
244 IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS
245 IMP_KMEANS_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_RANDOM
246 IMP_KMEANS_HAS_BOOST_SYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_SYSTEM
247 _object_types.append(
"KMeans")
250 def _object_cast_to_KMeans(*args):
251 """_object_cast_to_KMeans(Object o) -> KMeans"""
252 return _IMP_kmeans._object_cast_to_KMeans(*args)
253 KM_LLOYDS = _IMP_kmeans.KM_LLOYDS
254 KM_LOCAL_SWAP = _IMP_kmeans.KM_LOCAL_SWAP
255 KM_LOCAL_EZ_HYBRID = _IMP_kmeans.KM_LOCAL_EZ_HYBRID
256 KM_HYBRID = _IMP_kmeans.KM_HYBRID
258 """Proxy of C++ IMP::kmeans::KMeans class"""
259 __swig_setmethods__ = {}
260 for _s
in [
IMP.base.Object]: __swig_setmethods__.update(getattr(_s,
'__swig_setmethods__',{}))
261 __setattr__ =
lambda self, name, value: _swig_setattr(self, KMeans, name, value)
262 __swig_getmethods__ = {}
263 for _s
in [
IMP.base.Object]: __swig_getmethods__.update(getattr(_s,
'__swig_getmethods__',{}))
264 __getattr__ =
lambda self, name: _swig_getattr(self, KMeans, name)
265 def __init__(self, *args):
267 __init__(IMP::kmeans::KMeans self, std::string const & fname_data, int dim, unsigned int max_nPts) -> KMeans
268 __init__(IMP::kmeans::KMeans self) -> KMeans
270 this = _IMP_kmeans.new_KMeans(*args)
271 try: self.this.append(this)
272 except: self.this = this
273 def get_version_info(self):
274 """get_version_info(KMeans self) -> VersionInfo"""
275 return _IMP_kmeans.KMeans_get_version_info(self)
277 __swig_destroy__ = _IMP_kmeans.delete_KMeans
278 __del__ =
lambda self :
None;
279 def execute(self, *args):
281 execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS, int stages=100)
282 execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS)
283 execute(KMeans self, unsigned int k)
285 return _IMP_kmeans.KMeans_execute(self, *args)
287 def add_data_pt(self, *args):
288 """add_data_pt(KMeans self, IMP::Floats const & p)"""
289 return _IMP_kmeans.KMeans_add_data_pt(self, *args)
291 def clear_data(self):
292 """clear_data(KMeans self)"""
293 return _IMP_kmeans.KMeans_clear_data(self)
295 def get_data_point(self, *args):
296 """get_data_point(KMeans self, unsigned int i) -> IMP::Floats const &"""
297 return _IMP_kmeans.KMeans_get_data_point(self, *args)
299 def get_number_of_data_points(self):
300 """get_number_of_data_points(KMeans self) -> unsigned int"""
301 return _IMP_kmeans.KMeans_get_number_of_data_points(self)
303 def print_centers(self):
304 """print_centers(KMeans self)"""
305 return _IMP_kmeans.KMeans_print_centers(self)
307 def get_center(self, *args):
308 """get_center(KMeans self, unsigned int i) -> IMP::Floats"""
309 return _IMP_kmeans.KMeans_get_center(self, *args)
311 def get_assignments(self):
312 """get_assignments(KMeans self) -> IMP::Ints"""
313 return _IMP_kmeans.KMeans_get_assignments(self)
315 def get_squared_distance_to_centers(self):
316 """get_squared_distance_to_centers(KMeans self) -> IMP::Floats"""
317 return _IMP_kmeans.KMeans_get_squared_distance_to_centers(self)
319 def get_number_of_centers(self):
320 """get_number_of_centers(KMeans self) -> unsigned int"""
321 return _IMP_kmeans.KMeans_get_number_of_centers(self)
324 """__str__(KMeans self) -> std::string"""
325 return _IMP_kmeans.KMeans___str__(self)
328 """__repr__(KMeans self) -> std::string"""
329 return _IMP_kmeans.KMeans___repr__(self)
332 return _object_cast_to_KMeans(o)
333 get_from = staticmethod(get_from)
335 KMeans_swigregister = _IMP_kmeans.KMeans_swigregister
336 KMeans_swigregister(KMeans)
339 def get_module_version():
340 """get_module_version() -> std::string const"""
341 return _IMP_kmeans.get_module_version()
344 """get_example_path(std::string fname) -> std::string"""
345 return _IMP_kmeans.get_example_path(*args)
348 """get_data_path(std::string fname) -> std::string"""
349 return _IMP_kmeans.get_data_path(*args)
350 import _version_check
351 _version_check.check_version(get_module_version())