How to use the pint.toa.TOA function in Pint

To help you get started, we’ve selected a few Pint 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 nanograv / PINT / tests / test_toa.py View on Github external
def test_units(self):
        with self.assertRaises(u.UnitConversionError):
            t = TOA(self.MJD * u.m)
        with self.assertRaises(u.UnitConversionError):
            t = TOA((self.MJD * u.m, 0))
        t = TOA((self.MJD * u.day).to(u.s))
        with self.assertRaises(u.UnitConversionError):
            t = TOA((self.MJD * u.day, 0))
        t = TOA((self.MJD * u.day, 0 * u.day))
        with self.assertRaises(u.UnitConversionError):
            t = TOA(self.MJD, error=1 * u.m)
        t = TOA(self.MJD, freq=100 * u.kHz)
        with self.assertRaises(u.UnitConversionError):
            t = TOA(self.MJD, freq=100 * u.s)
github nanograv / PINT / src / pint / fermi_toas.py View on Github external
fermiobs = get_observatory("Fermi")
            except KeyError:
                log.error(
                    "Fermi observatory not defined. Make sure you have specified an FT2 file!"
                )
                raise

            try:
                if weightcolumn is None:
                    toalist = [
                        toa.TOA(m, obs="Fermi", scale="tt", energy=e, error=1.0 * u.us)
                        for m, e in zip(mjds, energies)
                    ]
                else:
                    toalist = [
                        toa.TOA(
                            m,
                            obs="Fermi",
                            scale="tt",
                            energy=e,
                            weight=w,
                            error=1.0 * u.us,
                        )
                        for m, e, w in zip(mjds, energies, weights)
                    ]
            except KeyError:
                log.error(
                    "Error processing Fermi TOAs. You may have forgotten to specify an FT2 file with --ft2"
                )
                raise
        else:
            log.info("Building geocentered TOAs")
github nanograv / PINT / src / pint / fermi_toas.py View on Github external
mjds[0], mjds[-1]
                )
            )
            assert timesys == "TT"
            try:
                fermiobs = get_observatory("Fermi")
            except KeyError:
                log.error(
                    "Fermi observatory not defined. Make sure you have specified an FT2 file!"
                )
                raise

            try:
                if weightcolumn is None:
                    toalist = [
                        toa.TOA(m, obs="Fermi", scale="tt", energy=e, error=1.0 * u.us)
                        for m, e in zip(mjds, energies)
                    ]
                else:
                    toalist = [
                        toa.TOA(
                            m,
                            obs="Fermi",
                            scale="tt",
                            energy=e,
                            weight=w,
                            error=1.0 * u.us,
                        )
                        for m, e, w in zip(mjds, energies, weights)
                    ]
            except KeyError:
                log.error(
github nanograv / PINT / pint / event_toas.py View on Github external
new_kwargs = _get_columns_from_fits(hdulist[1],
                                        mission_config[mission]["fits_columns"])

    hdulist.close()

    if weights is not None:
        new_kwargs["weights"] = weights

    toalist = [None] * len(mjds)
    kw = {}
    for i in range(len(mjds)):
        # Create TOA list
        for key in new_kwargs.keys():
            kw[key] = new_kwargs[key][i]
        toalist[i] = toa.TOA(mjds[i], obs=obs, scale=scale, **kw)

    return toalist
github nanograv / PINT / src / pint / event_toas.py View on Github external
new_kwargs = _get_columns_from_fits(
        hdulist[1], mission_config[mission]["fits_columns"]
    )

    hdulist.close()

    if weights is not None:
        new_kwargs["weights"] = weights

    toalist = [None] * len(mjds)
    kw = {}
    for i in range(len(mjds)):
        # Create TOA list
        for key in new_kwargs.keys():
            kw[key] = new_kwargs[key][i]
        toalist[i] = toa.TOA(mjds[i], obs=obs, scale=scale, **kw)

    return toalist