11 from sys
import version_info
12 if version_info >= (2,6,0):
13 def swig_import_helper():
14 from os.path
import dirname
18 fp, pathname, description = imp.find_module(
'_IMP_kmeans', [dirname(__file__)])
24 _mod = imp.load_module(
'_IMP_kmeans', fp, pathname, description)
28 _IMP_kmeans = swig_import_helper()
29 del swig_import_helper
34 _swig_property = property
37 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
38 if (name ==
"thisown"):
return self.this.own(value)
40 if type(value).__name__ ==
'SwigPyObject':
41 self.__dict__[name] = value
43 method = class_type.__swig_setmethods__.get(name,
None)
44 if method:
return method(self,value)
46 self.__dict__[name] = value
48 raise AttributeError(
"You cannot add attributes to %s" % self)
50 def _swig_setattr(self,class_type,name,value):
51 return _swig_setattr_nondynamic(self,class_type,name,value,0)
53 def _swig_getattr(self,class_type,name):
54 if (name ==
"thisown"):
return self.this.own()
55 method = class_type.__swig_getmethods__.get(name,
None)
56 if method:
return method(self)
57 raise AttributeError(name)
60 try: strthis =
"proxy of " + self.this.__repr__()
62 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
67 except AttributeError:
74 weakref_proxy = weakref.proxy
76 weakref_proxy =
lambda x: x
79 class IMP_KMEANS_SwigPyIterator(_object):
80 """Proxy of C++ swig::IMP_KMEANS_SwigPyIterator class"""
81 __swig_setmethods__ = {}
82 __setattr__ =
lambda self, name, value: _swig_setattr(self, IMP_KMEANS_SwigPyIterator, name, value)
83 __swig_getmethods__ = {}
84 __getattr__ =
lambda self, name: _swig_getattr(self, IMP_KMEANS_SwigPyIterator, name)
85 def __init__(self, *args, **kwargs):
raise AttributeError(
"No constructor defined - class is abstract")
87 __swig_destroy__ = _IMP_kmeans.delete_IMP_KMEANS_SwigPyIterator
88 __del__ =
lambda self :
None;
90 """value(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
91 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_value(self)
95 incr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator
96 incr(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator
98 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_incr(self, n)
102 decr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator
103 decr(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator
105 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_decr(self, n)
107 def distance(self, *args):
108 """distance(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t"""
109 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_distance(self, *args)
111 def equal(self, *args):
112 """equal(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
113 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_equal(self, *args)
116 """copy(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator"""
117 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_copy(self)
120 """next(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
121 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_next(self)
124 """__next__(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
125 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___next__(self)
128 """previous(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
129 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_previous(self)
131 def advance(self, *args):
132 """advance(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
133 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_advance(self, *args)
135 def __eq__(self, *args):
136 """__eq__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
137 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___eq__(self, *args)
139 def __ne__(self, *args):
140 """__ne__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
141 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___ne__(self, *args)
143 def __iadd__(self, *args):
144 """__iadd__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
145 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___iadd__(self, *args)
147 def __isub__(self, *args):
148 """__isub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
149 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___isub__(self, *args)
151 def __add__(self, *args):
152 """__add__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
153 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___add__(self, *args)
155 def __sub__(self, *args):
157 __sub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator
158 __sub__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t
160 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___sub__(self, *args)
162 def __iter__(self):
return self
163 IMP_KMEANS_SwigPyIterator_swigregister = _IMP_kmeans.IMP_KMEANS_SwigPyIterator_swigregister
164 IMP_KMEANS_SwigPyIterator_swigregister(IMP_KMEANS_SwigPyIterator)
171 IMP_DEBUG = _IMP_kmeans.IMP_DEBUG
172 IMP_RELEASE = _IMP_kmeans.IMP_RELEASE
173 IMP_SILENT = _IMP_kmeans.IMP_SILENT
174 IMP_PROGRESS = _IMP_kmeans.IMP_PROGRESS
175 IMP_TERSE = _IMP_kmeans.IMP_TERSE
176 IMP_VERBOSE = _IMP_kmeans.IMP_VERBOSE
177 IMP_MEMORY = _IMP_kmeans.IMP_MEMORY
178 IMP_NONE = _IMP_kmeans.IMP_NONE
179 IMP_USAGE = _IMP_kmeans.IMP_USAGE
180 IMP_INTERNAL = _IMP_kmeans.IMP_INTERNAL
181 IMP_BASE_HAS_LOG4CXX = _IMP_kmeans.IMP_BASE_HAS_LOG4CXX
182 IMP_COMPILER_HAS_AUTO = _IMP_kmeans.IMP_COMPILER_HAS_AUTO
183 IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_kmeans.IMP_COMPILER_HAS_DEBUG_VECTOR
184 IMP_BASE_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_BASE_HAS_BOOST_RANDOM
185 IMP_BASE_HAS_GPERFTOOLS = _IMP_kmeans.IMP_BASE_HAS_GPERFTOOLS
186 IMP_BASE_HAS_TCMALLOC_HEAPCHECKER = _IMP_kmeans.IMP_BASE_HAS_TCMALLOC_HEAPCHECKER
187 IMP_BASE_HAS_TCMALLOC_HEAPPROFILER = _IMP_kmeans.IMP_BASE_HAS_TCMALLOC_HEAPPROFILER
188 IMPBASE_SHOW_WARNINGS = _IMP_kmeans.IMPBASE_SHOW_WARNINGS
190 class _DirectorObjects(object):
191 """@internal Simple class to keep references to director objects
192 to prevent premature deletion."""
195 def register(self, obj):
196 """Take a reference to a director object; will only work for
197 refcounted C++ classes"""
198 if hasattr(obj,
'get_ref_count'):
199 self._objects.append(obj)
201 """Only drop our reference and allow cleanup by Python if no other
202 Python references exist (we hold 3 references: one in self._objects,
203 one in x, and one in the argument list for getrefcount) *and* no
204 other C++ references exist (the Python object always holds one)"""
205 objs = [x
for x
in self._objects
if sys.getrefcount(x) > 3 \
206 or x.get_ref_count() > 1]
210 def get_object_count(self):
211 """Get number of director objects (useful for testing only)"""
212 return len(self._objects)
213 _director_objects = _DirectorObjects()
215 DEFAULT_CHECK = _IMP_kmeans.DEFAULT_CHECK
216 NONE = _IMP_kmeans.NONE
217 USAGE = _IMP_kmeans.USAGE
218 USAGE_AND_INTERNAL = _IMP_kmeans.USAGE_AND_INTERNAL
221 """set_check_level(IMP::base::CheckLevel tf)"""
222 return _IMP_kmeans.set_check_level(*args)
225 """get_check_level() -> IMP::base::CheckLevel"""
226 return _IMP_kmeans.get_check_level()
227 class _ostream(_object):
228 """Proxy of C++ std::ostream class"""
229 __swig_setmethods__ = {}
230 __setattr__ =
lambda self, name, value: _swig_setattr(self, _ostream, name, value)
231 __swig_getmethods__ = {}
232 __getattr__ =
lambda self, name: _swig_getattr(self, _ostream, name)
233 def __init__(self, *args, **kwargs):
raise AttributeError(
"No constructor defined")
234 __repr__ = _swig_repr
235 def write(self, *args):
236 """write(_ostream self, char const * osa_buf)"""
237 return _IMP_kmeans._ostream_write(self, *args)
239 _ostream_swigregister = _IMP_kmeans._ostream_swigregister
240 _ostream_swigregister(_ostream)
242 IMP_COMPILER_HAS_OVERRIDE = _IMP_kmeans.IMP_COMPILER_HAS_OVERRIDE
243 IMP_COMPILER_HAS_FINAL = _IMP_kmeans.IMP_COMPILER_HAS_FINAL
244 IMP_HAS_NOEXCEPT = _IMP_kmeans.IMP_HAS_NOEXCEPT
246 IMP_KMEANS_HAS_BOOST_FILESYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_FILESYSTEM
247 IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS
248 IMP_KMEANS_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_RANDOM
249 IMP_KMEANS_HAS_BOOST_SYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_SYSTEM
250 IMPKMEANS_SHOW_WARNINGS = _IMP_kmeans.IMPKMEANS_SHOW_WARNINGS
251 _object_types.append(
"KMeans")
254 def _object_cast_to_KMeans(*args):
255 """_object_cast_to_KMeans(Object o) -> KMeans"""
256 return _IMP_kmeans._object_cast_to_KMeans(*args)
257 KM_LLOYDS = _IMP_kmeans.KM_LLOYDS
258 KM_LOCAL_SWAP = _IMP_kmeans.KM_LOCAL_SWAP
259 KM_LOCAL_EZ_HYBRID = _IMP_kmeans.KM_LOCAL_EZ_HYBRID
260 KM_HYBRID = _IMP_kmeans.KM_HYBRID
262 """Proxy of C++ IMP::kmeans::KMeans class"""
263 __swig_setmethods__ = {}
264 for _s
in [
IMP.base.Object]: __swig_setmethods__.update(getattr(_s,
'__swig_setmethods__',{}))
265 __setattr__ =
lambda self, name, value: _swig_setattr(self, KMeans, name, value)
266 __swig_getmethods__ = {}
267 for _s
in [
IMP.base.Object]: __swig_getmethods__.update(getattr(_s,
'__swig_getmethods__',{}))
268 __getattr__ =
lambda self, name: _swig_getattr(self, KMeans, name)
269 def __init__(self, *args):
271 __init__(IMP::kmeans::KMeans self, std::string const & fname_data, int dim, unsigned int max_nPts) -> KMeans
272 __init__(IMP::kmeans::KMeans self) -> KMeans
274 this = _IMP_kmeans.new_KMeans(*args)
275 try: self.this.append(this)
276 except: self.this = this
277 def get_version_info(self):
278 """get_version_info(KMeans self) -> VersionInfo"""
279 return _IMP_kmeans.KMeans_get_version_info(self)
281 def execute(self, *args):
283 execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS, int stages=100)
284 execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS)
285 execute(KMeans self, unsigned int k)
287 return _IMP_kmeans.KMeans_execute(self, *args)
289 def add_data_pt(self, *args):
290 """add_data_pt(KMeans self, IMP::Floats const & p)"""
291 return _IMP_kmeans.KMeans_add_data_pt(self, *args)
293 def clear_data(self):
294 """clear_data(KMeans self)"""
295 return _IMP_kmeans.KMeans_clear_data(self)
297 def get_data_point(self, *args):
298 """get_data_point(KMeans self, unsigned int i) -> IMP::Floats const &"""
299 return _IMP_kmeans.KMeans_get_data_point(self, *args)
301 def get_number_of_data_points(self):
302 """get_number_of_data_points(KMeans self) -> unsigned int"""
303 return _IMP_kmeans.KMeans_get_number_of_data_points(self)
305 def print_centers(self, *args):
307 print_centers(KMeans self, IMP::base::LogLevel ll=PROGRESS)
308 print_centers(KMeans self)
310 return _IMP_kmeans.KMeans_print_centers(self, *args)
312 def get_center(self, *args):
313 """get_center(KMeans self, unsigned int i) -> IMP::Floats"""
314 return _IMP_kmeans.KMeans_get_center(self, *args)
316 def get_assignments(self):
317 """get_assignments(KMeans self) -> IMP::Ints"""
318 return _IMP_kmeans.KMeans_get_assignments(self)
320 def get_squared_distance_to_centers(self):
321 """get_squared_distance_to_centers(KMeans self) -> IMP::Floats"""
322 return _IMP_kmeans.KMeans_get_squared_distance_to_centers(self)
324 def get_number_of_centers(self):
325 """get_number_of_centers(KMeans self) -> unsigned int"""
326 return _IMP_kmeans.KMeans_get_number_of_centers(self)
329 """__str__(KMeans self) -> std::string"""
330 return _IMP_kmeans.KMeans___str__(self)
333 """__repr__(KMeans self) -> std::string"""
334 return _IMP_kmeans.KMeans___repr__(self)
337 return _object_cast_to_KMeans(o)
338 get_from = staticmethod(get_from)
340 KMeans_swigregister = _IMP_kmeans.KMeans_swigregister
341 KMeans_swigregister(KMeans)
344 def get_module_version():
345 """get_module_version() -> std::string const"""
346 return _IMP_kmeans.get_module_version()
349 """get_example_path(std::string fname) -> std::string"""
350 return _IMP_kmeans.get_example_path(*args)
353 """get_data_path(std::string fname) -> std::string"""
354 return _IMP_kmeans.get_data_path(*args)
355 import _version_check
356 _version_check.check_version(get_module_version())
void set_check_level(CheckLevel tf)
Control runtime checks in the code.
See IMP.base for more information.
std::string get_data_path(std::string file_name)
Return the full path to installed data.
Common base class for heavy weight IMP objects.
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
CheckLevel get_check_level()
Get the current audit mode.