How to use the fsps._fsps.driver.get_nbands 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 filter_data(self):
        """
        Return effective wavelengths, and vega and solar magnitudes
        of all filters.

        :returns lambda_eff:
            Effective wavelength of each filter.

        :returns magvega:
            The AB magnitude of Vega (used to convert between AB and Vega
            systems).

        :returns magsun:
            The AB absolute magnitude of the Sun.
        """
        NBANDS = driver.get_nbands()
        lambda_eff, magvega, magsun = driver.get_filter_data(NBANDS)
        return lambda_eff, magvega, magsun
github dfm / python-fsps / fsps / fsps.py View on Github external
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]
            else: