<commit_before># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import numpy as np

from astropy import units as u
from astropy.utils.state import ScienceState
from astropy.utils.decorators import format_doc
from astropy.coordinates.angles import Angle
from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product, matrix_transpose
from astropy.coordinates import representation as r
from astropy.coordinates.baseframe import (BaseCoordinateFrame,
                                           frame_transform_graph, base_doc)
from astropy.coordinates.attributes import (CoordinateAttribute,
                                            QuantityAttribute,
                                            DifferentialAttribute)
from astropy.coordinates.transformations import AffineTransform
from astropy.coordinates.errors import ConvertError

from .icrs import ICRS

__all__ = ['Galactocentric']


# Measured by minimizing the difference between a plane of coordinates along
#   l=0, b=[-90,90] and the Galactocentric x-z plane
# This is not used directly, but accessed via `get_roll0`.  We define it here to
# prevent having to create new Angle objects every time `get_roll0` is called.
_ROLL0 = Angle(58.5986320306*u.degree)


class galactocentric_frame_defaults(ScienceState):
    """The ScienceState instance that controls global setting of Galactocentric
    default solar motion parameters
    """

    # the default is to use the original definition of this frame
    _value = 'pre-v4.0'
    _references = None

    @staticmethod
    def get_solar_params_from_string(arg):
        """Return Galactocentric solar parameters given string names for the parameter sets.
        """

        params = dict()
        references = dict()

        # Currently, all versions use the same sky position for Sgr A*:
        params['galcen_coord'] = ICRS(ra=266.4051*u.degree,
                                      dec=-28.936175*u.degree)
        references['galcen_coord'] = \
            'http://adsabs.harvard.edu/abs/2004ApJ...616..872R'

        # The roll angle is the same for both frames:
        params['roll'] = 0 * u.deg

        if arg == 'pre-v4.0':
            params['galcen_distance'] = 8.3 * u.kpc
            references['galcen_distance'] = \
                'https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G'

            params['galcen_v_sun'] = r.CartesianDifferential([11.1,
                                                              220+12.24,
                                                              7.25]*u.km/u.s)
            references['galcen_v_sun'] = \
                ['https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S',
                 'https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B']

            params['z_sun'] = 27.0 * u.pc
            references['z_sun'] = \
                'https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C'

        elif arg == 'latest':
            params['galcen_distance'] = 8.122 * u.kpc
            references['galcen_distance'] = \
                'https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G'

            params['galcen_v_sun'] = r.CartesianDifferential([12.9,
                                                              245.6,
                                                              7.78]*u.km/u.s)
            references['galcen_v_sun'] = \
                ['https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..210D',
                 'https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G',
                 'https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R']
<commit_msg>resolve latest into the actual version name<commit_after># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import numpy as np

from astropy import units as u
from astropy.utils.state import ScienceState
from astropy.utils.decorators import format_doc
from astropy.coordinates.angles import Angle
from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product, matrix_transpose
from astropy.coordinates import representation as r
from astropy.coordinates.baseframe import (BaseCoordinateFrame,
                                           frame_transform_graph, base_doc)
from astropy.coordinates.attributes import (CoordinateAttribute,
                                            QuantityAttribute,
                                            DifferentialAttribute)
from astropy.coordinates.transformations import AffineTransform
from astropy.coordinates.errors import ConvertError

from .icrs import ICRS

__all__ = ['Galactocentric']


# Measured by minimizing the difference between a plane of coordinates along
#   l=0, b=[-90,90] and the Galactocentric x-z plane
# This is not used directly, but accessed via `get_roll0`.  We define it here to
# prevent having to create new Angle objects every time `get_roll0` is called.
_ROLL0 = Angle(58.5986320306*u.degree)


class galactocentric_frame_defaults(ScienceState):
    """The ScienceState instance that controls global setting of Galactocentric
    default solar motion parameters
    """

    # the default is to use the original definition of this frame
    _value = 'pre-v4.0'
    _references = None

    @staticmethod
    def get_solar_params_from_string(arg):
        """Return Galactocentric solar parameters given string names for the parameter sets.
        """
        # Resolve the meaning of 'latest': The latest parameter set is from v4.0
        # - update this as newer parameter choices are added
        if arg == 'latest':
            arg = 'v4.0'

        params = dict()
        references = dict()

        # Currently, all versions use the same sky position for Sgr A*:
        params['galcen_coord'] = ICRS(ra=266.4051*u.degree,
                                      dec=-28.936175*u.degree)
        references['galcen_coord'] = \
            'http://adsabs.harvard.edu/abs/2004ApJ...616..872R'

        # The roll angle is the same for both frames:
        params['roll'] = 0 * u.deg

        if arg == 'pre-v4.0':
            params['galcen_distance'] = 8.3 * u.kpc
            references['galcen_distance'] = \
                'https://ui.adsabs.harvard.edu/#abs/2009ApJ...692.1075G'

            params['galcen_v_sun'] = r.CartesianDifferential([11.1,
                                                              220+12.24,
                                                              7.25]*u.km/u.s)
            references['galcen_v_sun'] = \
                ['https://ui.adsabs.harvard.edu/#abs/2010MNRAS.403.1829S',
                 'https://ui.adsabs.harvard.edu/#abs/2015ApJS..216...29B']

            params['z_sun'] = 27.0 * u.pc
            references['z_sun'] = \
                'https://ui.adsabs.harvard.edu/#abs/2001ApJ...553..184C'

        elif arg == 'v4.0':
            params['galcen_distance'] = 8.122 * u.kpc
            references['galcen_distance'] = \
                'https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G'

            params['galcen_v_sun'] = r.CartesianDifferential([12.9,
                                                              245.6,
                                                              7.78]*u.km/u.s)
            references['galcen_v_sun'] = \
                ['https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..210D',
                 'https://ui.adsabs.harvard.edu/abs/2018A%26A...615L..15G',
                 'https://ui.adsabs.harvard.edu/abs/2004ApJ...616..872R']

{'fraction_non_alphanumeric': 0.1062924038845284, 'fraction_numerical': 0.04469868298523347, 'mean_word_length': 1.8793565683646112, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5895384', 'n_tokens_mistral': 2319, 'n_tokens_neox': 2062, 'n_words': 491}