示例#1
0
    def sanity_SpecTypeDeJagerExample1(self):
        """
        Sanity of example 1 (SpecTypeDeJager)
        """
        from PyAstronomy import pyasl

        # Instantiate class object
        sdj = pyasl.SpecTypeDeJager()

        llum, lteff = sdj.lumAndTeff("K0", "V")

        print("Luminosity = {0:4.2f} Lsun".format(10.0**llum))
        print("Effective temperature = {0:6.1f} K".format(10.0**lteff))
示例#2
0
    def sanity_SpecTypeDeJagerSanity(self):
        """
        Sanity of SpecTypeDeJager
        """
        from PyAstronomy import pyasl

        # Instantiate class object
        sdj = pyasl.SpecTypeDeJager()

        llum, lteff = sdj.lumAndTeff("K0", "V")
        self.assertAlmostEqual(10.0**(lteff - 3.712),
                               1.,
                               delta=0.05,
                               msg="Mismatch K0 V (teff)")
        self.assertAlmostEqual(10.0**(llum + 0.258),
                               1.,
                               delta=0.2,
                               msg="Mismatch K0 V (lum)")

        llum, lteff = sdj.lumAndTeff("B7", "Ia")
        self.assertAlmostEqual(10.0**(lteff - 4.072),
                               1.,
                               delta=0.05,
                               msg="Mismatch B7 Ia (teff)")
        self.assertAlmostEqual(10.0**(llum - 5.123),
                               1.,
                               delta=0.2,
                               msg="Mismatch B7 Ia (lum)")

        llum, lteff = sdj.lumAndTeff("G4", "IV")
        self.assertAlmostEqual(10.0**(lteff - 3.723),
                               1.,
                               delta=0.05,
                               msg="Mismatch G4 IV (teff)")
        self.assertAlmostEqual(10.0**(llum - 0.802),
                               1.,
                               delta=0.2,
                               msg="Mismatch G4 IV (lum)")

        llum1, lteff1 = sdj.lumAndTeff("G4", "V")
        llum2, lteff2 = sdj.lumAndTeff("G4.5", "V")
        llum3, lteff3 = sdj.lumAndTeff("G5", "V")
        self.assertTrue(llum1 > llum2 > llum3,
                        msg="Float subtype, wrong order of luminosities")
        self.assertTrue(lteff1 > lteff2 > lteff3,
                        msg="Float subtype, wrong order of luminosities")
示例#3
0
    def sanity_SpecTypeDeJagerExample2(self):
        """
        Sanity of example 2 (SpecTypeDeJager)
        """
        #     from __future__ import print_function
        from PyAstronomy import pyasl
        import matplotlib.pylab as plt

        # Instantiate class object
        sdj = pyasl.SpecTypeDeJager()

        # Set luminosity class
        lk = "V"

        # Save spectral types, log(teff), and log(luminosity)
        spts = []
        lteffs = []
        llums = []

        # Save information to annotate abscissa
        xt = []
        xtl = []

        for t in "OBAFGKM":
            for n in range(10):
                if (t == "O") and (n == 0):
                    # Skip the invalid "O0" type
                    continue

                # Save the spectral type
                spts.append(t + str(n))

                # Get log10 of luminosity and effective temperature
                ll, lt = sdj.lumAndTeff(spts[-1], lk)
                # and save to lists
                llums.append(ll)
                lteffs.append(lt)

                # Save location (i.e., number in the list) and
                # spectral for annotating the abscissa
                if (n == 0) or (n == 5):
                    xt.append(len(spts) - 1)
                    xtl.append(spts[-1])