Skip to content

Commit

Permalink
Simplify masses
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfarmer committed Jan 12, 2021
1 parent f84f0eb commit f60d81c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mesaPlot/file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from distutils.version import StrictVersion


msun = 1.9892*10**33

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

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

def _getMdiff(self):
sm = self.head['star_mass']
if 'M_center' in self.head_names:
sm = sm - self.head['M_center']/msun

if 'logdq' in self.data_names:
return 10**(self.data['logdq'])*self.mass_star()
return 10**(self.data['logdq'])*sm
elif 'dq' in self.data_names:
return self.data['dq']*self.mass_star()
return self.data['dq']*sm
elif 'dm' in elf.data_names:
return self.data['dm']
else:
Expand Down

0 comments on commit f60d81c

Please sign in to comment.