Ejemplo n.º 1
0
    def fit(self, iters=1):
        """tempopulsar.fit(iters=1)

        Runs `iters` iterations of the tempo2 fit, recomputing
        barycentric TOAs and residuals each time."""
        f = fitter.wls_fitter(toas=self.t, model=self.model)

        for ii in range(iters + 1):
            f.call_minimize()

        fitp = f.model.get_params_dict("free", "quantity")
        # TODO: handle these units correctly
        for p, val in zip(fitp.keys(), fitp.values()):
            modval = getattr(f.model, p).value

            if (not has_astropy_unit(val)) and has_astropy_unit(modval):
                if type(modval) is ang.Angle:
                    val = ang.Angle(val, unit=modval.unit)
                else:
                    val = val * modval.unit

            self[p].val = val
Ejemplo n.º 2
0
    def fit(self,iters=1):
        """tempopulsar.fit(iters=1)

        Runs `iters` iterations of the tempo2 fit, recomputing
        barycentric TOAs and residuals each time."""
        f = fitter.wls_fitter(toas=self.t, model=self.model)

        for ii in range(iters+1):
            f.call_minimize()

        fitp = f.get_fitparams()
        # TODO: handle these units correctly
        for p, val in zip(fitp.keys(), fitp.values()):
            modval = getattr(f.model, p).value

            if (not has_astropy_unit(val)) and has_astropy_unit(modval):
                if type(modval) is ang.Angle:
                    val = ang.Angle(val, unit=modval.unit)
                else:
                    val = val * modval.unit

            self[p].val = val