Ejemplo n.º 1
0
from astropy.time import Time
from astropy import units as u
from astropy import constants as c

import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.collections import PatchCollection

## Mission constants ##

# Kepler
Kepler_lamda = c.Constant(
    'Kepler_lamda',
    "Kepler bandpass central wavelength",
    6400,
    'angstrom',
    0.0,
    system='cgs',
    reference="http://stev.oapd.inaf.it/~lgirardi/cmd_2.7/photsys.html")

Kepler_fwhm = c.Constant(
    'Kepler_fwhm',
    "Kepler bandpass fwhm",
    4000,
    'angstrom',
    0.0,
    system='cgs',
    reference="https://archive.stsci.edu/kepler/manuals/KSCI-19033-001.pdf")

Kepler_zeropt = c.Constant(
    'Kepler_zeropt',
Ejemplo n.º 2
0
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import pytest

from astropy import constants as const
from astropy.tests.helper import pickle_protocol, check_pickling_recovery  # noqa

originals = [
    const.Constant('h_fake',
                   'Not Planck',
                   0.0,
                   'J s',
                   0.0,
                   'fakeref',
                   system='si'), const.h, const.e
]
xfails = [True, True, True]


@pytest.mark.parametrize(("original", "xfail"), zip(originals, xfails))
def test_new_constant(pickle_protocol, original, xfail):
    if xfail:
        pytest.xfail()
    check_pickling_recovery(original, pickle_protocol)
Ejemplo n.º 3
0
import astropy.units as u
import numpy as np
from astropy import constants

c = constants.c
G = constants.G
eps0 = constants.eps0
coulombs_const = 1 / (4 * np.pi * eps0)

Cosmo_Const_base = constants.Constant(
    "lambda",
    "Cosmological Constant",
    2.036e-35,
    "1 / s2",
    0.000081e-35,
    "Wikipedia",
    system="si",
)

Cosmo_Const = Cosmo_Const_base.value * (u.s**-2)

Solar_Mass = 1.9891e30 * u.kg
R_sun = 695510 * u.km
Ejemplo n.º 4
0
import numpy
from astropy import units as u
from astropy import constants as const
"""
Library of Physical Constants. May be updated/added to as necessary
"""

# Constants

# Coulomb constant = 1/4.pi.eps0, use existing value of eps0
k_e = const.Constant("k_e",
                     "Coulomb constant",
                     1 / (4 * numpy.pi * (const.eps0).to(u.F / u.m).value),
                     "m / F",
                     0.0,
                     system="si",
                     reference=const.eps0.reference)

# Fermi constant cited by PDG in GeV-2/(hbar.c)3,
# here convert to Jm3 during definition
G_F = const.Constant("G_F",
                     "Fermi constant",
                     1.1663787e-5 * (u.GeV**(-2)).to(u.J**(-2)) *
                     ((const.hbar * const.c)**3).to((u.J * u.m)**3).value,
                     "J * m**3",
                     6e-07 * 1e-5 * (u.GeV**(-2)).to(u.J**(-2)) *
                     ((const.hbar * const.c)**3).to((u.J * u.m)**3).value,
                     system="si",
                     reference="CODATA2019")

from astropy.constants import *  # noqa