How to use the fsps._fsps.driver.get_nz 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
def check_params(self):
        NZ = driver.get_nz()
        assert self._params["zmet"] in range(1, NZ + 1), \
            "zmet={0} out of range [1, {1}]".format(self._params["zmet"], NZ)
        assert self._params["dust_type"] in range(5), \
            "dust_type={0} out of range [0, 4]".format(
                self._params["dust_type"])
        assert self._params["imf_type"] in range(6), \
            "imf_type={0} out of range [0, 5]".format(self._params["imf_type"])
        assert (self._params["tage"] <= 0) | (self._params["tage"] > self._params["sf_start"]), \
            "sf_start={0} is greater than tage={1}".format(
                self._params["sf_start"], self._params["tage"])
        assert (self._params["const"]+self._params["fburst"]) <= 1, \
            "const + fburst > 1"
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 zlegend(self):
        """The available metallicities.
        """
        if self._zlegend is None:
            NZ = driver.get_nz()
            self._zlegend = driver.get_zlegend(NZ)
        return self._zlegend