How to use the sncosmo.Model function in sncosmo

To help you get started, we’ve selected a few sncosmo 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 Samreay / SurveyVisualiser / surveyvis / surveys.py View on Github external
def get_colors(self, time, style="ivu3", layers=1):
        import sncosmo
        model = sncosmo.Model(source='salt2')

        # Get band filter name to work with sncosmo
        bands = ["bessellr", "bessellv", "bessellb", "besselli", "bessellux"]

        colours = []
        for x0, x1, c, t, z in zip(self.x0s, self.x1s, self.cs, self.ts, self.z):
            if not self.redshift:
                z = 0.2
            # z = 0.05
            model.set(z=z, t0=t, x0=x0, x1=x1, c=c)
            fluxes = []
            for b in bands:
                try:
                    flux = model.bandflux(b, time)
                except ValueError:
                    flux = 0

sncosmo

Package for supernova cosmology based on astropy

BSD-3-Clause
Latest version published 7 days ago

Package Health Score

84 / 100
Full package analysis

Similar packages