How to use the fsps._fsps.driver.get_ntfull function in fsps

To help you get started, we’ve selected a few fsps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dfm / python-fsps / fsps / fsps.py View on Github external
if self.params.dirty:
            self._compute_csp()

        wavegrid = self.wavelengths
        if peraa:
            factor = 3e18 / wavegrid ** 2

        else:
            factor = np.ones_like(wavegrid)

        NSPEC = driver.get_nspec()
        if (tage > 0.0) or (tage == -99):
            return wavegrid, driver.get_spec(NSPEC, 1)[0] * factor

        NTFULL = driver.get_ntfull()
        return wavegrid, driver.get_spec(NSPEC, NTFULL) * factor[None, :]
github dfm / python-fsps / fsps / fsps.py View on Github external
def _compute_csp(self):
        self._update_params()

        NSPEC = driver.get_nspec()
        NTFULL = driver.get_ntfull()
        driver.compute_zdep(NSPEC, NTFULL, self._zcontinuous)

        self._stats = None
github dfm / python-fsps / fsps / fsps.py View on Github external
:returns spec:
            The spectra of the SSPs, having shape (nspec, ntfull, nz).

        :returns mass:
            The mass of the SSPs, having shape (ntfull, nz).

        :returns lbol:
            The bolometric luminosity of the SSPs, having shape (ntfull, nz).
        """

        if (self.params.dirtiness == 2) and update:
            self._update_params()

        NSPEC = driver.get_nspec()
        NTFULL = driver.get_ntfull()
        NZ = driver.get_nz()
        spec = np.zeros([NSPEC, NTFULL, NZ], order='F')
        mass = np.zeros([NTFULL, NZ], order='F')
        lbol = np.zeros([NTFULL, NZ], order='F')
        driver.get_ssp_spec(spec, mass, lbol)

        if peraa:
            wavegrid = self.wavelengths
            factor = 3e18 / wavegrid ** 2
            spec *= factor[:, None, None]

        return spec, mass, lbol
github dfm / python-fsps / fsps / fsps.py View on Github external
def ssp_ages(self):
        """The age grid of the SSPs, in log(years), used by FSPS.
        """
        if self._ssp_ages is None:
            NTFULL = driver.get_ntfull()
            self._ssp_ages = driver.get_timefull(NTFULL)
        return self._ssp_ages
github dfm / python-fsps / fsps / fsps.py View on Github external
elif (self.params["zred"] > 0) & (redshift != self.params["zred"]):
            zr = redshift
            print("Warning: redshift is different than 'zred'.")
        else:
            zr = redshift
        self.params["tage"] = tage
        if zmet is not None:
            self.params["zmet"] = zmet

        if self.params.dirty:
            self._compute_csp()

        if tage > 0.0:
            NTFULL = 1
        else:
            NTFULL = driver.get_ntfull()
        NBANDS = driver.get_nbands()
        NSPEC = driver.get_nspec()
        band_array = np.ones(NBANDS, dtype=bool)
        if bands is not None:
            user_sorted_inds = np.array([FILTERS[band.lower()].index
                                         for band in bands])
            band_array[np.array([i not in user_sorted_inds
                                 for i in range(NBANDS)],
                                dtype=bool)] = False

        inds = np.array(band_array, dtype=int)
        mags = driver.get_mags(NSPEC, NTFULL, zr, inds)

        if tage > 0.0:
            if bands is not None:
                return mags[0, user_sorted_inds]