<commit_before># coding: utf-8

""" ...explain... """

from __future__ import division, print_function

__author__ = "adrn <<EMAIL>>"

# Standard library

# Third-party
import numpy as np
import astropy.coordinates as coord
import astropy.units as u

__all__ = ['cartesian_to_spherical', 'cartesian_to_physicsspherical',
           'cartesian_to_cylindrical']

def _pos_to_repr(pos):

    if hasattr(pos, 'xyz'):  # Representation-like
        pos_repr = coord.CartesianRepresentation(pos.xyz)

    elif hasattr(pos, 'cartesian') or hasattr(pos, 'to_cartesian'):  # Frame-like
        pos_repr = pos.represent_as(coord.CartesianRepresentation)

    elif hasattr(pos, 'unit'):  # Quantity-like
        pos_repr = coord.CartesianRepresentation(pos)

    else:
        raise TypeError("Unsupported position type '{0}'. Position must be "
                        "an Astropy Representation or Frame, or a "
                        "Quantity instance".format(type(pos)))

    return pos_repr

def cartesian_to_spherical(pos, vel):<commit_msg>add explanation<commit_after># coding: utf-8

""" Velocity transformations for coordinate representations. """

from __future__ import division, print_function

__author__ = "adrn <<EMAIL>>"

# Standard library

# Third-party
import numpy as np
import astropy.coordinates as coord

__all__ = ['cartesian_to_spherical', 'cartesian_to_physicsspherical',
           'cartesian_to_cylindrical']

def _pos_to_repr(pos):

    if hasattr(pos, 'xyz'):  # Representation-like
        pos_repr = coord.CartesianRepresentation(pos.xyz)

    elif hasattr(pos, 'cartesian') or hasattr(pos, 'to_cartesian'):  # Frame-like
        pos_repr = pos.represent_as(coord.CartesianRepresentation)

    elif hasattr(pos, 'unit'):  # Quantity-like
        pos_repr = coord.CartesianRepresentation(pos)

    else:
        raise TypeError("Unsupported position type '{0}'. Position must be "
                        "an Astropy Representation or Frame, or a "
                        "Quantity instance".format(type(pos)))

    return pos_repr

def cartesian_to_spherical(pos, vel):
{'fraction_non_alphanumeric': 0.10415671285236502, 'fraction_numerical': 0.0019111323459149545, 'mean_word_length': 3.4553191489361703, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2219639', 'n_tokens_mistral': 666, 'n_tokens_neox': 638, 'n_words': 154}