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:
72 def _swig_setattr_nondynamic_method(set):
73 def set_attr(self,name,value):
74 if (name ==
"thisown"):
return self.this.own(value)
75 if hasattr(self,name)
or (name ==
"this"):
78 raise AttributeError(
"You cannot add attributes to %s" % self)
84 weakref_proxy = weakref.proxy
86 weakref_proxy =
lambda x: x
89 class IMP_KMEANS_SwigPyIterator(object):
90 """Proxy of C++ swig::IMP_KMEANS_SwigPyIterator class"""
91 thisown = _swig_property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
'The membership flag')
92 def __init__(self, *args, **kwargs):
raise AttributeError(
"No constructor defined - class is abstract")
94 __swig_destroy__ = _IMP_kmeans.delete_IMP_KMEANS_SwigPyIterator
95 __del__ =
lambda self :
None;
97 """value(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
98 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_value(self)
102 incr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator
103 incr(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator
105 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_incr(self, n)
109 decr(IMP_KMEANS_SwigPyIterator self, size_t n=1) -> IMP_KMEANS_SwigPyIterator
110 decr(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator
112 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_decr(self, n)
114 def distance(self, *args):
115 """distance(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t"""
116 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_distance(self, *args)
118 def equal(self, *args):
119 """equal(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
120 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_equal(self, *args)
123 """copy(IMP_KMEANS_SwigPyIterator self) -> IMP_KMEANS_SwigPyIterator"""
124 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_copy(self)
127 """next(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
128 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_next(self)
131 """__next__(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
132 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___next__(self)
135 """previous(IMP_KMEANS_SwigPyIterator self) -> PyObject *"""
136 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_previous(self)
138 def advance(self, *args):
139 """advance(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
140 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator_advance(self, *args)
142 def __eq__(self, *args):
143 """__eq__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
144 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___eq__(self, *args)
146 def __ne__(self, *args):
147 """__ne__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> bool"""
148 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___ne__(self, *args)
150 def __iadd__(self, *args):
151 """__iadd__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
152 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___iadd__(self, *args)
154 def __isub__(self, *args):
155 """__isub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
156 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___isub__(self, *args)
158 def __add__(self, *args):
159 """__add__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator"""
160 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___add__(self, *args)
162 def __sub__(self, *args):
164 __sub__(IMP_KMEANS_SwigPyIterator self, ptrdiff_t n) -> IMP_KMEANS_SwigPyIterator
165 __sub__(IMP_KMEANS_SwigPyIterator self, IMP_KMEANS_SwigPyIterator x) -> ptrdiff_t
167 return _IMP_kmeans.IMP_KMEANS_SwigPyIterator___sub__(self, *args)
169 def __iter__(self):
return self
170 IMP_KMEANS_SwigPyIterator_swigregister = _IMP_kmeans.IMP_KMEANS_SwigPyIterator_swigregister
171 IMP_KMEANS_SwigPyIterator_swigregister(IMP_KMEANS_SwigPyIterator)
178 IMP_DEBUG = _IMP_kmeans.IMP_DEBUG
179 IMP_RELEASE = _IMP_kmeans.IMP_RELEASE
180 IMP_SILENT = _IMP_kmeans.IMP_SILENT
181 IMP_PROGRESS = _IMP_kmeans.IMP_PROGRESS
182 IMP_TERSE = _IMP_kmeans.IMP_TERSE
183 IMP_VERBOSE = _IMP_kmeans.IMP_VERBOSE
184 IMP_MEMORY = _IMP_kmeans.IMP_MEMORY
185 IMP_NONE = _IMP_kmeans.IMP_NONE
186 IMP_USAGE = _IMP_kmeans.IMP_USAGE
187 IMP_INTERNAL = _IMP_kmeans.IMP_INTERNAL
188 IMP_BASE_HAS_LOG4CXX = _IMP_kmeans.IMP_BASE_HAS_LOG4CXX
189 IMP_COMPILER_HAS_AUTO = _IMP_kmeans.IMP_COMPILER_HAS_AUTO
190 IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_kmeans.IMP_COMPILER_HAS_DEBUG_VECTOR
191 IMP_BASE_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_BASE_HAS_BOOST_RANDOM
192 IMP_BASE_HAS_GPERFTOOLS = _IMP_kmeans.IMP_BASE_HAS_GPERFTOOLS
193 IMP_BASE_HAS_TCMALLOC_HEAPCHECKER = _IMP_kmeans.IMP_BASE_HAS_TCMALLOC_HEAPCHECKER
194 IMP_BASE_HAS_TCMALLOC_HEAPPROFILER = _IMP_kmeans.IMP_BASE_HAS_TCMALLOC_HEAPPROFILER
195 IMPBASE_SHOW_WARNINGS = _IMP_kmeans.IMPBASE_SHOW_WARNINGS
197 class _DirectorObjects(object):
198 """@internal Simple class to keep references to director objects
199 to prevent premature deletion."""
202 def register(self, obj):
203 """Take a reference to a director object; will only work for
204 refcounted C++ classes"""
205 if hasattr(obj,
'get_ref_count'):
206 self._objects.append(obj)
208 """Only drop our reference and allow cleanup by Python if no other
209 Python references exist (we hold 3 references: one in self._objects,
210 one in x, and one in the argument list for getrefcount) *and* no
211 other C++ references exist (the Python object always holds one)"""
212 objs = [x
for x
in self._objects
if sys.getrefcount(x) > 3 \
213 or x.get_ref_count() > 1]
217 def get_object_count(self):
218 """Get number of director objects (useful for testing only)"""
219 return len(self._objects)
220 _director_objects = _DirectorObjects()
222 class _ostream(object):
223 """Proxy of C++ std::ostream class"""
224 thisown = _swig_property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
'The membership flag')
225 def __init__(self, *args, **kwargs):
raise AttributeError(
"No constructor defined")
226 __repr__ = _swig_repr
227 def write(self, *args):
228 """write(_ostream self, char const * osa_buf)"""
229 return _IMP_kmeans._ostream_write(self, *args)
231 _ostream_swigregister = _IMP_kmeans._ostream_swigregister
232 _ostream_swigregister(_ostream)
234 IMP_COMPILER_HAS_OVERRIDE = _IMP_kmeans.IMP_COMPILER_HAS_OVERRIDE
235 IMP_COMPILER_HAS_FINAL = _IMP_kmeans.IMP_COMPILER_HAS_FINAL
236 IMP_HAS_NOEXCEPT = _IMP_kmeans.IMP_HAS_NOEXCEPT
238 IMP_KMEANS_HAS_BOOST_FILESYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_FILESYSTEM
239 IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_PROGRAMOPTIONS
240 IMP_KMEANS_HAS_BOOST_RANDOM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_RANDOM
241 IMP_KMEANS_HAS_BOOST_SYSTEM = _IMP_kmeans.IMP_KMEANS_HAS_BOOST_SYSTEM
242 IMPKMEANS_SHOW_WARNINGS = _IMP_kmeans.IMPKMEANS_SHOW_WARNINGS
243 _object_types.append(
"KMeans")
246 def _object_cast_to_KMeans(*args):
247 """_object_cast_to_KMeans(Object o) -> KMeans"""
248 return _IMP_kmeans._object_cast_to_KMeans(*args)
249 KM_LLOYDS = _IMP_kmeans.KM_LLOYDS
250 KM_LOCAL_SWAP = _IMP_kmeans.KM_LOCAL_SWAP
251 KM_LOCAL_EZ_HYBRID = _IMP_kmeans.KM_LOCAL_EZ_HYBRID
252 KM_HYBRID = _IMP_kmeans.KM_HYBRID
254 """Proxy of C++ IMP::kmeans::KMeans class"""
255 thisown = _swig_property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
'The membership flag')
256 def __init__(self, *args):
258 __init__(IMP::kmeans::KMeans self, std::string const & fname_data, int dim, unsigned int max_nPts) -> KMeans
259 __init__(IMP::kmeans::KMeans self) -> KMeans
261 this = _IMP_kmeans.new_KMeans(*args)
262 try: self.this.append(this)
263 except: self.this = this
264 def get_version_info(self):
265 """get_version_info(KMeans self) -> VersionInfo"""
266 return _IMP_kmeans.KMeans_get_version_info(self)
268 def execute(self, *args):
270 execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS, int stages=100)
271 execute(KMeans self, unsigned int k, IMP::kmeans::KM_ALG_TYPE alg_type=KM_LLOYDS)
272 execute(KMeans self, unsigned int k)
274 return _IMP_kmeans.KMeans_execute(self, *args)
276 def add_data_pt(self, *args):
277 """add_data_pt(KMeans self, IMP::Floats const & p)"""
278 return _IMP_kmeans.KMeans_add_data_pt(self, *args)
280 def clear_data(self):
281 """clear_data(KMeans self)"""
282 return _IMP_kmeans.KMeans_clear_data(self)
284 def get_data_point(self, *args):
285 """get_data_point(KMeans self, unsigned int i) -> IMP::Floats const &"""
286 return _IMP_kmeans.KMeans_get_data_point(self, *args)
288 def get_number_of_data_points(self):
289 """get_number_of_data_points(KMeans self) -> unsigned int"""
290 return _IMP_kmeans.KMeans_get_number_of_data_points(self)
292 def print_centers(self, *args):
294 print_centers(KMeans self, IMP::base::LogLevel ll=PROGRESS)
295 print_centers(KMeans self)
297 return _IMP_kmeans.KMeans_print_centers(self, *args)
299 def get_center(self, *args):
300 """get_center(KMeans self, unsigned int i) -> IMP::Floats"""
301 return _IMP_kmeans.KMeans_get_center(self, *args)
303 def get_assignments(self):
304 """get_assignments(KMeans self) -> IMP::Ints"""
305 return _IMP_kmeans.KMeans_get_assignments(self)
307 def get_squared_distance_to_centers(self):
308 """get_squared_distance_to_centers(KMeans self) -> IMP::Floats"""
309 return _IMP_kmeans.KMeans_get_squared_distance_to_centers(self)
311 def get_number_of_centers(self):
312 """get_number_of_centers(KMeans self) -> unsigned int"""
313 return _IMP_kmeans.KMeans_get_number_of_centers(self)
316 """__str__(KMeans self) -> std::string"""
317 return _IMP_kmeans.KMeans___str__(self)
320 """__repr__(KMeans self) -> std::string"""
321 return _IMP_kmeans.KMeans___repr__(self)
324 return _object_cast_to_KMeans(o)
325 get_from = staticmethod(get_from)
327 KMeans_swigregister = _IMP_kmeans.KMeans_swigregister
328 KMeans_swigregister(KMeans)
331 def get_module_version():
332 """get_module_version() -> std::string const"""
333 return _IMP_kmeans.get_module_version()
336 """get_example_path(std::string fname) -> std::string"""
337 return _IMP_kmeans.get_example_path(*args)
340 """get_data_path(std::string fname) -> std::string"""
341 return _IMP_kmeans.get_data_path(*args)
342 from .
import _version_check
343 _version_check.check_version(get_module_version())
Low level functionality (logging, error handling, profiling, command line flags etc) that is used by ...
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.