How to use the fsps._fsps.driver.get_mags 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 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:
                return mags[0, :]
        else:
            if bands is not None:
                return mags[:, user_sorted_inds]
            else:
                return mags