Skip to content

Commit f60d81c

Browse files
committed
Simplify masses
1 parent f84f0eb commit f60d81c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

mesaPlot/file_reader.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
from distutils.version import StrictVersion
2828

29-
29+
msun = 1.9892*10**33
3030

3131
#Conviently the index of this list is the proton number
3232
_elementsPretty=['neut','H', 'He', 'Li', 'Be', 'B', 'C', 'N',
@@ -416,8 +416,7 @@ def abunSum(self,iso,mass_min=0.0,mass_max=9999.0):
416416
if 'mass' in self.data_names:
417417
ind=(self.data['mass']>=mass_min)&(self.data['mass']<=mass_max)
418418
mdiff = self._getMdiff()
419-
return np.sum(self.data[iso][ind]*mdiff[ind])*(self.head['star_mass']/
420-
np.minimum(self.head['star_mass'],mass_max-mass_min))
419+
return np.sum(self.data[iso][ind]*mdiff[ind])
421420
else:
422421
return self._getMassHist(iso)
423422

@@ -460,10 +459,14 @@ def mass_star(self):
460459
raise ValueError("No star_mass available")
461460

462461
def _getMdiff(self):
462+
sm = self.head['star_mass']
463+
if 'M_center' in self.head_names:
464+
sm = sm - self.head['M_center']/msun
465+
463466
if 'logdq' in self.data_names:
464-
return 10**(self.data['logdq'])*self.mass_star()
467+
return 10**(self.data['logdq'])*sm
465468
elif 'dq' in self.data_names:
466-
return self.data['dq']*self.mass_star()
469+
return self.data['dq']*sm
467470
elif 'dm' in elf.data_names:
468471
return self.data['dm']
469472
else:

0 commit comments

Comments
 (0)