Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/fsps/fsps.f90
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,19 @@ subroutine get_ssp_weights(n_age, n_z, ssp_wghts_out)

end subroutine

subroutine get_csp_components(ns, csp1, csp2)

! Return the unattenuated 'young' and 'old' stellar continuua

implicit none
integer, intent(in) :: ns
double precision, dimension(ns), intent(inout) :: csp1, csp2
csp1 = spec_young
csp2 = spec_old

end subroutine


subroutine get_ssp_spec(ns,n_age,n_z,ssp_spec_out,ssp_mass_out,ssp_lbol_out)

! Return the contents of the ssp spectral array,
Expand Down
17 changes: 17 additions & 0 deletions src/fsps/fsps.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,23 @@ def _all_ssp_spec(self, update=True, peraa=False):

return spec, mass, lbol

@property
def _csp_young_old(self):
"""Get the (unattenuated) young and old component spectra of the CSP

:returns young:
The young stellar spectrum

:returns old:
The old stellar spectrum
"""

NS = driver.get_nspec()
young, old = np.zeros(NS), np.zeros(NS)
driver.get_csp_components(young, old)
return young, old

@property
def _ssp_weights(self):
"""Get the weights of the SSPs for the CSP

Expand Down
2 changes: 1 addition & 1 deletion src/fsps/libfsps
Submodule libfsps updated 2 files
+11 −9 src/csp_gen.f90
+4 −2 src/sps_vars.f90
2 changes: 1 addition & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def test_ssp_weights(pop_and_params):

wave, spec = pop.get_spectrum(tage=age.max())
mstar = pop.stellar_mass
wght = pop._ssp_weights()
wght = pop._ssp_weights
ssp, smass, slbol = pop._all_ssp_spec()

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