Skip to content

Commit 992b419

Browse files
authored
Merge pull request #212 from bd-j/young-old
update FSPS and add access to the young and old components of the sed…
2 parents dd9380a + 4060898 commit 992b419

4 files changed

Lines changed: 32 additions & 2 deletions

File tree

src/fsps/fsps.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,19 @@ subroutine get_ssp_weights(n_age, n_z, ssp_wghts_out)
380380

381381
end subroutine
382382

383+
subroutine get_csp_components(ns, csp1, csp2)
384+
385+
! Return the unattenuated 'young' and 'old' stellar continuua
386+
387+
implicit none
388+
integer, intent(in) :: ns
389+
double precision, dimension(ns), intent(inout) :: csp1, csp2
390+
csp1 = spec_young
391+
csp2 = spec_old
392+
393+
end subroutine
394+
395+
383396
subroutine get_ssp_spec(ns,n_age,n_z,ssp_spec_out,ssp_mass_out,ssp_lbol_out)
384397

385398
! Return the contents of the ssp spectral array,

src/fsps/fsps.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,23 @@ def _all_ssp_spec(self, update=True, peraa=False):
781781

782782
return spec, mass, lbol
783783

784+
@property
785+
def _csp_young_old(self):
786+
"""Get the (unattenuated) young and old component spectra of the CSP
787+
788+
:returns young:
789+
The young stellar spectrum
790+
791+
:returns old:
792+
The old stellar spectrum
793+
"""
794+
795+
NS = driver.get_nspec()
796+
young, old = np.zeros(NS), np.zeros(NS)
797+
driver.get_csp_components(young, old)
798+
return young, old
799+
800+
@property
784801
def _ssp_weights(self):
785802
"""Get the weights of the SSPs for the CSP
786803

src/fsps/libfsps

tests/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def test_ssp_weights(pop_and_params):
394394

395395
wave, spec = pop.get_spectrum(tage=age.max())
396396
mstar = pop.stellar_mass
397-
wght = pop._ssp_weights()
397+
wght = pop._ssp_weights
398398
ssp, smass, slbol = pop._all_ssp_spec()
399399

400400
assert np.allclose((smass[:, zind] * wght[:, 0]).sum(), mstar)

0 commit comments

Comments
 (0)