<commit_before># coding: utf-8
"""Bodies of the Solar System.

Contains some predefined bodies of the Solar System:

* Sun (☉)
* Earth (♁)
* Moon (☾)
* Mercury (☿)
* Venus (♀)
* Mars (♂)
* Jupiter (♃)
* Saturn (♄)
* Uranus (⛢)
* Neptune (♆)
* Pluto (♇)

and a way to define new bodies (:py:class:`~Body` class).

"""
from astropy.constants import R_earth
from astropy import units as u


class Body(object):
    """Class to represent a body of the Solar System.

    """
    def __init__(self, parent, k, name, symbol=None, R=0 * u.km):
        """Constructor.

        Parameters
        ----------
        parent : Body
            Central body.
        k : ~astropy.units.Quantity
            Standard gravitational parameter.
        name : str
            Name of the body.
        symbol : str, optional
            Symbol for the body.
        R : ~astropy.units.Quantity, optional
            Radius of the body.

        """
        self.parent = parent
        self.k = k
        self.name = name
        self.symbol = symbol
        self.R = R

    @classmethod
    @u.quantity_input(k=u.km ** 3 / u.s ** 2, R=u.km)
    def from_parameters(cls, parent, k, name, symbol, R):
        return cls(parent, k, name, symbol, R)

    def __str__(self):
        return u"{0} ({1})".format(self.name, self.symbol)

    def _repr_latex_(self):
        """Creates a LaTeX representation.

        Used by the IPython notebook.

        """
        return self.__str__()


Sun = Body.from_parameters(
    None, k=132712440018 * u.km ** 3 / u.s ** 2,
    name="Sun", symbol=u"\u2609", R=695700 * u.km)
Earth = Body.from_parameters(
    Sun, k=398600 * u.km ** 3 / u.s ** 2,
    name="Earth", symbol=u"\u2641", R=R_earth.to(u.km))

'''
* Equatorial radius, obtained from [NASA Planetary Fact Sheets](https://nssdc.gsfc.nasa.gov/planetary/planetfact.html)
* Mass paremeter, obtained from [JPL Development Ephemeris 424](ftp://ssd.jpl.nasa.gov/pub/eph/planets/ioms/de424.iom.pdf)
* Symbols, following this [guideline](https://solarsystem.nasa.gov/galleries/solar-system-symbols)
'''<commit_msg>Added data references to module docstring<commit_after># coding: utf-8
"""Bodies of the Solar System.

Contains some predefined bodies of the Solar System:

* Sun (☉)
* Earth (♁)
* Moon (☾)
* Mercury (☿)
* Venus (♀)
* Mars (♂)
* Jupiter (♃)
* Saturn (♄)
* Uranus (⛢)
* Neptune (♆)
* Pluto (♇)

and a way to define new bodies (:py:class:`~Body` class).

Data references are the following:

* Equatorial radius, obtained from [NASA Planetary Fact Sheets](https://nssdc.gsfc.nasa.gov/planetary/planetfact.html)
* Mass paremeter, obtained from [JPL Development Ephemeris 424](ftp://ssd.jpl.nasa.gov/pub/eph/planets/ioms/de424.iom.pdf)
* Symbols, following this [guideline](https://solarsystem.nasa.gov/galleries/solar-system-symbols)

"""
from astropy.constants import R_earth
from astropy import units as u


class Body(object):
    """Class to represent a body of the Solar System.

    """
    def __init__(self, parent, k, name, symbol=None, R=0 * u.km):
        """Constructor.

        Parameters
        ----------
        parent : Body
            Central body.
        k : ~astropy.units.Quantity
            Standard gravitational parameter.
        name : str
            Name of the body.
        symbol : str, optional
            Symbol for the body.
        R : ~astropy.units.Quantity, optional
            Radius of the body.

        """
        self.parent = parent
        self.k = k
        self.name = name
        self.symbol = symbol
        self.R = R

    @classmethod
    @u.quantity_input(k=u.km ** 3 / u.s ** 2, R=u.km)
    def from_parameters(cls, parent, k, name, symbol, R):
        return cls(parent, k, name, symbol, R)

    def __str__(self):
        return u"{0} ({1})".format(self.name, self.symbol)

    def _repr_latex_(self):
        """Creates a LaTeX representation.

        Used by the IPython notebook.

        """
        return self.__str__()


Sun = Body.from_parameters(
    None, k=132712440018 * u.km ** 3 / u.s ** 2,
    name="Sun", symbol=u"\u2609", R=695700 * u.km)
Earth = Body.from_parameters(
    Sun, k=398600 * u.km ** 3 / u.s ** 2,
    name="Earth", symbol=u"\u2641", R=R_earth.to(u.km))
{'fraction_non_alphanumeric': 0.14390359168241965, 'fraction_numerical': 0.022684310018903593, 'mean_word_length': 2.4358766233766236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4477014', 'n_tokens_mistral': 1563, 'n_tokens_neox': 1434, 'n_words': 406}