@@ -0,0 +1,1535 @@
+# Licensed under a 3-clause BSD style license - see LICENSES%0A%0Aimport numpy as np%0Afrom numpy.testing import assert_allclose, assert_almost_equal%0A%0Afrom astropy.table import Table%0A%0Aimport sncosmo%0A%0Aclass TestFitting:%0A    def setup_class(self):%0A        model = sncosmo.Model(source='hsiao-subsampled')%0A        params = %7B't0': 56000., 'amplitude': 1.e-7, 'z': 0.1%7D%0A        %0A        # generate fake data with no errors%0A        points_per_band = 12%0A        bands = points_per_band * %5B'desg', 'desr', 'desi', 'desz'%5D%0A        times = params%5B't0'%5D + np.linspace(-10., 60., len(bands))%0A        zp = len(bands) * %5B25.%5D%0A        zpsys = len(bands) * %5B'ab'%5D%0A        model.set(**params)%0A        flux = model.bandflux(bands, times, zp=zp, zpsys=zpsys)%0A        fluxerr = len(bands) * %5B0.1 * np.max(flux)%5D%0A        data = Table(%7B'time': times,%0A                      'band': bands,%0A                      'flux': flux,%0A                      'fluxerr': fluxerr,%0A                      'zp': zp,%0A                      'zpsys': zpsys%7D)%0A%0A        # reset parameters%0A        model.set(z=0., t0=0., amplitude=1.)%0A%0A        self.model = model%0A        self.data = data%0A        self.params = params%0A%0A    def test_fit_lc(self):%0A        res, fitmodel = sncosmo.fit_lc(self.data, self.model,%0A                                       %5B'z', 't0', 'amplitude'%5D,%0A                                       bounds=%7B'z':(0., 1.0)%7D)%0A%0A        # set model to true parameters%0A        self.model.set(**self.params)%0A        assert_allclose(res.parameters, self.model.parameters, rtol=1.e-3)%0A

add test for fit_lc()