mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 22:58:02 +00:00
add center of mass
This commit is contained in:
parent
161c27d995
commit
9fe745b0b4
1 changed files with 12 additions and 2 deletions
|
@ -425,8 +425,7 @@ class Clump:
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
m : 1-dimensional array
|
m : 1-dimensional array of shape `(n_particles, )`
|
||||||
Array of shape `(n_particles, )`.
|
|
||||||
"""
|
"""
|
||||||
return self._m
|
return self._m
|
||||||
|
|
||||||
|
@ -437,6 +436,17 @@ class Clump:
|
||||||
raise TypeError("`r` and `m` must be equal size 1-dim arrays.")
|
raise TypeError("`r` and `m` must be equal size 1-dim arrays.")
|
||||||
self._m = m
|
self._m = m
|
||||||
|
|
||||||
|
@property
|
||||||
|
def center_mass(self):
|
||||||
|
"""
|
||||||
|
Clump center of mass.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
cm : 1-dimensional array
|
||||||
|
"""
|
||||||
|
return numpy.average(self.pos, axis=0, weights=self.m)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def index(self):
|
def index(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue