Beispiel #1
0
def NASelement(name, symbol, Z, A, isos=None, abundance=None, melt=None, boil=None, **what):
    """Create an Element based on my Nuffield Advanced Data book's data.

    Required arguments:
      name -- string giving the full name of the element.
      symbol -- string giving the (one or two letter) symbol of the element.
      Z -- atomic number.

    Optional arguments:
      A -- molar mass * mol / g; a.k.a. atomic mass / AMU (default, None, means
           unknown).
      isos -- description of isotopes (see below); default is None.
      abundance -- relative terrestrial abundance, scaled to make Si score 100;
                   default is None, indicating an artificial element.
      melt -- melting temperature / K
      boil -- boiling temperature / K

    plus any further keyword arguments, to taste.  See Element's constructor for
    further details; it receives a suitably scaled abundance.

    I have, rather arbitrarily, supposed that the phase change temperatures
    given in the NAS data book generally have an error bar of +/- half a Kelvin,
    except where marked as 'uncertain' (five K) or 'highly uncertain' (fifty K
    if the cited value's last two digits are zeros, otherwise ten K).  Roughly
    as arbitrarily, where several forms of the elment are listed, I've used the
    lowest melting point and highest boiling point, ignoring any phase changes
    between forms and listing any sublimation (typically relevant only to one
    form, not the one whose melting and boiling are used) separately as sublime.

    The description of isotopes, if given, should either be a list of atomic
    mass numbers for which an isotope is known (for artificial elements and
    those natural radioactives whose isotopic composition varies wildly) or a
    mapping from known atomic mass numbers to relative abundances (or to None
    for those radioactive isotopes which normally have negligible abundance).
    If the sum of these relative abundances isn't 1, they'll be (fudged to make
    it 100 - because the NAS book is a bit off on some elements - and then)
    scaled down to make it 1.

    Both the element's terrestrial abundance and the relative abundance of its
    isotopes will be given an error bar, if they don't already have one, to
    accord with the limited precision indicated in the NAS table. """

    if abundance is None:
        what["abundance"] = None  # artificial elements
    else:
        try:
            abundance.width
        except AttributeError:  # need an error bar (guess: two decimal places of precision)
            abundance = Quantity.fromSigFigs(abundance, 2)
        # NAS data book gives abundances relative to Silicon = 100, but notes
        # that Silicon's true abundance is believed to be 27.72 %
        what["abundance"] = abundance * 0.2772

    try:
        A.width
    except AttributeError:  # give it an error bar
        try:
            isos[:]  # radioactive/artificial elements
        except TypeError:
            A = Quantity.fromDecimal(A, 4)  # real ones
        else:
            A = Quantity.within(A, 0.5 * max(1, max(isos) - min(isos)))

    temp = {}
    if melt is not None:
        try:
            melt.width
        except AttributeError:
            melt = Quantity.fromDecimal(melt, 1)
        temp["melt"] = melt * Kelvin

    if boil is not None:
        try:
            boil.width
        except AttributeError:
            boil = Quantity.fromDecimal(boil, 1)
        temp["boil"] = boil * Kelvin

    try:
        temp["sublime"] = what["sublime"]
    except KeyError:
        pass
    else:
        del what["sublime"]
    if temp:
        T = Temperatures(**temp)
    else:
        T = None

    ans = Element(name, symbol, Z, A, T, **what)

    try:
        isos[:]
    except TypeError:
        try:
            isos.update
        except AttributeError:
            pass  # no information
        else:
            # dictionary: { isotope: relative abundance }
            weights = filter(None, isos.values())
            total = sum(weights)
            if total == 1:
                fix, scale = None, 1  # weights given as fractions
            else:
                # Otherwise, assume given as percentages; but the NAS table
                # has several entries that don't sum accurately to 100.
                scale = 0.01
                if total == 100:
                    fix = None
                else:  # bodge: blur the non-tiny weights to make it all sum right ...
                    assert 80 < total < 120, "Perhaps these aren't percentages after all"
                    fix = 1 + (100 - total) * Quantity.below(2) / sum(filter(lambda x: x > 1, weights))

            # Perhaps we can improve on this ...
            for k, v in isos.items():
                iso = Isotope(Z, k - Z)
                if v:
                    unit = 1
                    if v < 1:
                        while unit > v:
                            unit = unit * 0.1
                        unit = unit * 0.1
                    if fix and v > 1:
                        v = v * fix  # bodge
                    v = Quantity.within(v, unit * 0.01)
                    iso.abundance = v * scale
    else:
        # sequence: known isotopes
        for k in isos:
            Isotope(Z, k - Z)

    return ans
Beispiel #2
0
import body
from common import Orbit, Spin, Discovery, Surface, \
     SurfacePart, Ocean, Island, Continent, LandMass

from study.chemy.physics import Cosmos
# some rough data from my Nuffield data book:
Universe = body.Object('Observable Universe', None,
                       """The observable universe

See also chemy.physics.Cosmos
""",
                       mass=1e52 * kg, radius=3e26 * metre,
                       # some slightly more definite data:
                       age = Quantity.within(1, .01, 13.7 * giga * year,
                                             """The age of our universe.

This is only about 60 mega years short of 2**201 Planck times.  Compare with
Hubble's constant (q.v.) and note that multiplying the two together gives an
answer just a little bit less than 1.\n"""),
                       temperature = Cosmos.temperature,
                       composition = { 'dark energy': .73,
                                       'cold dark matter': .23,
                                       'atoms': .04 },
                       # microwave background: mass density and number density:
                       photon = Object(mass = 4.68e-31 * kg / metre**3,
                                       number = 413e6 / metre**3))
del Cosmos

# See also: http://www.daviddarling.info/encyclopedia/L/LocalGroup.html
# Data from apod:
LocalGroup = body.Group("The Local Group",
                        # Error bar is a wild guess, based on MilkyWay.orbit.speed
Beispiel #3
0
        # sequence: known isotopes
        for k in isos:
            Isotope(Z, k - Z)

    return ans


Float, About = Quantity.fromDecimal, Quantity.within

atom(
    1,
    0,
    "Hydrogen",
    "H",
    "The simplest atom; the most abundant form of matter",
    mass=Quantity.within(1673.43, 0.08, harpo * gram),
    nucleus=proton,
)
atom(
    1,
    1,
    "Deuterium",
    "D",
    "(Ordinary) Heavy Hydrogen",
    nucleus=nucleus(
        1,
        1,
        "deuteron",
        doc="Deuterium's nucleus",
        # roughly the sum of proton and neutron:
        mass=2.01355321271 * AMU,
Beispiel #4
0
import body
from common import Orbit, Spin, Discovery, Surface, \
     SurfacePart, Ocean, Island, Continent, LandMass

from study.chemy.physics import Cosmos
# some rough data from my Nuffield data book:
Universe = body.Object('Observable Universe', None,
                       """The observable universe

See also chemy.physics.Cosmos
""",
                       mass=1e52 * kg, radius=3e26 * metre,
                       # some slightly more definite data:
                       age = Quantity.within(1, .01, 13.7 * giga * year,
                                             """The age of our universe.

This is only about 60 mega years short of 2**201 Planck times.  Compare with
Hubble's constant (q.v.) and note that multiplying the two together gives an
answer just a little bit less than 1.\n"""),
                       temperature = Cosmos.temperature,
                       composition = { 'dark energy': .73,
                                       'cold dark matter': .23,
                                       'atoms': .04 },
                       # microwave background: mass density and number density:
                       photon = Object(mass = 4.68e-31 * kg / metre**3,
                                       number = 413e6 / metre**3))
del Cosmos

# See also: http://www.daviddarling.info/encyclopedia/L/LocalGroup.html
# Data from apod:
LocalGroup = body.Group("The Local Group",
                        # Error bar is a wild guess, based on MilkyWay.orbit.speed
Beispiel #5
0
See study.LICENSE for copyright and license information.
"""

from study.value.units import Object, Quantity, \
     mega, year, day, hour, minute, metre, kg, bar, arc, Centigrade
from home import Sun, Earth, KLplanet, KLsurface
from common import Orbit, Spin, Discovery
Float = Quantity.fromDecimal

Mercury = KLplanet('Mercury',
                   KLsurface(.382,
                             .38,
                             Spin(58 * day + 16 * hour, 0),
                             flattening=0,
                             material="silicates",
                             temperature=Centigrade(Quantity.within(110,
                                                                    290))),
                   Orbit(Sun, Float(57.91, 2, 9, metre),
                         Spin(.241 * year, 7.005), .2056),
                   .0553,
                   5.43,
                   atmosphere="trace Na",
                   discovery=Discovery("prehistoric",
                                       -1e4,
                                       etymology="""Latin: Mercurius.

From Latin, named for the messenger of the goods; so called because it moves so
fast.  Compare the element hydrargyrum.
"""))

Mercury.surface.temperature.document(
    """Mercury's wildly varying surface temperature
Beispiel #6
0
It is (USGS assures me) probable that Simon Marius discovered the same moons at
about the same time, maybe as much as a month earlier: but Galileo published
first.
""")
Io = NASAmoon("Io", Jupiter, _tmp, 422, 1.77,
              NASAshell(1830, 1819, 1815), "silicates, sulphur, SO2", 893.3, 3.53)
Europa = NASAmoon("Europa", Jupiter, _tmp, 670.9, 3.551181,
                  # http://www.solarviews.com/eng/europa.htm
                  # Mean orbital velocity = 13.74 km / s
                  # Orbital eccentricity = 0.009
                  # Orbital inclination = 0.470 degrees
                  # Escape velocity = 2.02 km / s
                  # Visual geometric albedo = 0.64
                  # Magnitude = 5.29 Vo
                  NASAshell(1569, 1565), "ice", 479.7, Quantity.within(3, .01))
Ganymede = NASAmoon("Ganymede", Jupiter, _tmp, 1070, 7.15,
                    NASAshell(2634), "dirty ice", 1482, 1.94)
Callisto = NASAmoon("Callisto", Jupiter, _tmp, 1883, 16.69,
                    NASAshell(2403), "dirty ice", 1076, 1.851)
Amalthea = NASAmoon("Amalthea", Jupiter,
                    Discovery("E.E. Barnard", 1892, date="1892 September 9",
                              location="Mt. Hamilton",
                              etymology="""Greek Mythology.

Amalthea was a naiad, who nursed baby Jove.  Her pet goat fed him.
Flammarion suggested her name for this moon.
"""),
                    181, 0.50, NASAshell(131, 73, 67), "rock, sulphur")
Himalia = NASAmoon("Himalia", Jupiter,
                   Discovery("C.D. Perrine", 1904, date="1904 December 4",
Beispiel #7
0
Available source for more data:
http://solarsystem.nasa.gov/planets/profile.cfm?Object=Mars&Display=Facts

See study.LICENSE for copyright and license information.
"""

from study.value.units import Object, Quantity, \
     mega, year, day, hour, minute, metre, kg, bar, arc, Centigrade
from home import Sun, Earth, KLplanet, KLsurface
from common import Orbit, Spin, Discovery
Float = Quantity.fromDecimal

Mercury = KLplanet('Mercury',
                   KLsurface(.382, .38, Spin(58 * day + 16 * hour, 0),
                             flattening = 0, material = "silicates",
                             temperature=Centigrade(Quantity.within(110, 290))),
                   Orbit(Sun, Float(57.91, 2, 9, metre),
                         Spin(.241 * year, 7.005), .2056),
                   .0553, 5.43, atmosphere="trace Na",
                   discovery=Discovery("prehistoric", -1e4,
                                       etymology="""Latin: Mercurius.

From Latin, named for the messenger of the goods; so called because it moves so
fast.  Compare the element hydrargyrum.
"""))

Mercury.surface.temperature.document("""Mercury's wildly varying surface temperature

As Mercury spins only slightly (less than a factor of two) faster than it
orbits, its surface spends long periods alternately directly exposed to the
Sun's heat and utterly hidden from it.  Without an atmosphere to re-distribute