Skip to content

Commit 3297748

Browse files
authored
Merge pull request #182 from bd-j/zsol_and_docs
Zsol and docs
2 parents 5c66529 + 2fadb3c commit 3297748

2 files changed

Lines changed: 29 additions & 7 deletions

File tree

src/fsps/fsps.f90

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ subroutine interp_ssp(ns,zpos,tpos,spec,mass,lbol)
336336

337337
end subroutine
338338

339-
subroutine smooth_spectrum(ns,wave,spec,sigma_broad,minw,maxw)
339+
340+
subroutine smooth_spectrum(ns,wave,spec,sigma_broad,minw,maxw)
340341

341342
! Smooth the spectrum by a gaussian of width sigma_broad
342343

@@ -442,6 +443,15 @@ subroutine get_zlegend(n_z,z_legend)
442443

443444
end subroutine
444445

446+
subroutine get_zsol(z_sol)
447+
448+
! Get the definition of solar metallicity.
449+
implicit none
450+
double precision, intent(out) :: z_sol
451+
z_sol = zsol
452+
453+
end subroutine
454+
445455
subroutine get_timefull(n_age,timefull)
446456

447457
! Get the actual time steps of the SSPs.

src/fsps/fsps.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class StellarPopulation(object):
283283
284284
:param tau: (default: 1.0)
285285
Defines e-folding time for the SFH, in Gyr. Only used if ``sfh=1`` or
286-
``sfh=4``. The range is :math:`0.1 < \tau < 10^2`.
286+
``sfh=4``.
287287
288288
:param const: (default: 0.0)
289289
Defines the constant component of the SFH. This quantity is defined as
@@ -363,9 +363,10 @@ class StellarPopulation(object):
363363
component (i.e. that is not affected by ``dust2``).
364364
365365
:param frac_obrun: (default: 0.0)
366-
Fraction of the young stars (age < dust_tesc) that are not attenuated
367-
by ``dust1``, representing runaway OB stars. These stars are still
368-
attenuated by ``dust2``.
366+
Fraction of the young stars (age < dust_tesc) that are not attenuated by
367+
``dust1`` and that do not contribute to any nebular emission,
368+
representing runaway OB stars or escaping ionizing radiation. These
369+
stars are still attenuated by ``dust2``.
369370
370371
:param dust_index: (default: -0.7)
371372
Power law index of the attenuation curve. Only used when
@@ -537,6 +538,7 @@ def __init__(
537538
self._wavelengths = None
538539
self._emwavelengths = None
539540
self._zlegend = None
541+
self._solar_metallicity = None
540542
self._ssp_ages = None
541543
self._stats = None
542544
self._libraries = None
@@ -837,7 +839,7 @@ def isochrones(self, outfile="pyfsps_tmp"):
837839
Write the isochrone data (age, mass, weights, phases, magnitudes, etc.)
838840
to a .cmd file, then read it into a huge numpy array. Only parameters
839841
listed in ``StellarPopulation.params.ssp_params`` affect the output of
840-
this method.
842+
this method. This method does not work for the BPASS isochrones.
841843
842844
:param outfile: (default: 'pyfsps_tmp')
843845
The file root name of the .cmd file, which will be placed in the
@@ -859,6 +861,9 @@ def isochrones(self, outfile="pyfsps_tmp"):
859861
* log(weight): IMF weight corresponding to a total of 1 Msol formed.
860862
* log(mdot): mass loss rate (Msol/yr)
861863
"""
864+
if self.isoc_library.decode("utf-8") == "bpss":
865+
raise ValueError("CMDs cannot be generated for the BPASS isochrones.")
866+
862867
if self.params.dirty:
863868
self._compute_csp()
864869

@@ -1044,6 +1049,14 @@ def zlegend(self):
10441049
self._zlegend = driver.get_zlegend(NZ)
10451050
return self._zlegend
10461051

1052+
@property
1053+
def solar_metallicity(self):
1054+
r"""The definition of solar metallicity, as a mass fraction.
1055+
E.g. Z_sol \sim 0.014-0.02"""
1056+
if self._solar_metallicity is None:
1057+
self._solar_metallicity = driver.get_zsol()
1058+
return self._solar_metallicity
1059+
10471060
@property
10481061
def ssp_ages(self):
10491062
r"""The age grid of the SSPs, in log(years), used by FSPS."""
@@ -1184,7 +1197,6 @@ def duste_library(self):
11841197
r"""The name of the dust emission SED library being used in FSPS."""
11851198
return self.libraries[2]
11861199

1187-
11881200
@property
11891201
def libraries(self):
11901202
if self._libraries is None:

0 commit comments

Comments
 (0)