GithubHelp home page GithubHelp logo

Comments (12)

OrbitalMechanic avatar OrbitalMechanic commented on May 19, 2024

I uninstalled the version of poliastro I installed using Git and reinstalled using pip. The bottom line is 6 tests failed and 27 passed. What am I doing wrong? The output from the uninstall, the reinstall and the test are below.

Please advise.

users-MacBook-Pro:~ user$ sudo pip uninstall poliastro
Password:
The directory '/Users/user/Library/Logs/pip' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling poliastro-0.3.0.dev0:
  /Users/user/anaconda/lib/python2.7/site-packages/poliastro-0.3.0_dev-py2.7.egg
Proceed (y/n)? y
  Successfully uninstalled poliastro-0.3.0.dev0
users-MacBook-Pro:~ user$ pip install poliastro
Collecting poliastro
  Downloading poliastro-0.2.0.tar.gz (84kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 86kB 1.3MB/s 
Installing collected packages: poliastro
  Running setup.py install for poliastro
Successfully installed poliastro-0.2.0
users-MacBook-Pro:~ user$ python -c "import poliastro; poliastro.test()"
==================================================================== test session starts ====================================================================
platform darwin -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4
collected 32 items 

anaconda/lib/python2.7/site-packages/poliastro/tests/test_bodies.py ....
anaconda/lib/python2.7/site-packages/poliastro/tests/test_maneuver.py ..F.FF
anaconda/lib/python2.7/site-packages/poliastro/tests/test_plotting.py ..
anaconda/lib/python2.7/site-packages/poliastro/tests/test_twobody.py .........F..F....
anaconda/lib/python2.7/site-packages/poliastro/tests/test_util.py .F.

========================================================================= FAILURES ==========================================================================
_________________________________________________________________ test_maneuver_total_time __________________________________________________________________

    def test_maneuver_total_time():
        dt1 = 10.0 * u.s
        dt2 = 100.0 * u.s
        _v = np.zeros(3) * u.km / u.s  # Unused velocity
        expected_total_time = 110.0 * u.s
        man = Maneuver((dt1, _v), (dt2, _v))
>       assert_almost_equal(man.get_total_time(), expected_total_time)

anaconda/lib/python2.7/site-packages/poliastro/tests/test_maneuver.py:42: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:474: in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:842: in assert_array_almost_equal
    precision=decimal)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:646: in assert_array_compare
    val = comparison(x, y)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:838: in compare
    return around(z, decimal) <= 10.0**(-decimal)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity 0.0 s>, obj = array(False, dtype=bool), context = (<ufunc 'less_equal'>, (<Quantity 0.0 s>, 1e-07), 0)

    def __array_prepare__(self, obj, context=None):
        # This method gets called by Numpy whenever a ufunc is called on the
        # array. The object passed in ``obj`` is an empty version of the
        # output array which we can e.g. change to an array sub-class, add
        # attributes to, etc. After this is called, then the ufunc is called
        # and the values in this empty array are set.

        # If no context is set, just return the input
        if context is None:
            return obj

        # Find out which ufunc is being used
        function = context[0]

        from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS

        # Check whether we even support this ufunc
        if function in UNSUPPORTED_UFUNCS:
            raise TypeError("Cannot use function '{0}' with quantities"
                            .format(function.__name__))

        # Now find out what arguments were passed to the ufunc, usually, this
        # will include at least the present object, and another, which could
        # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs.
        args = context[1][:function.nin]
        units = [getattr(arg, 'unit', None) for arg in args]

        # If the ufunc is supported, then we call a helper function (defined
        # in quantity_helper.py) which returns the scale by which the inputs
        # should be multiplied before being passed to the ufunc, as well as
        # the unit the output from the ufunc will have.
        if function in UFUNC_HELPERS:
            converters, result_unit = UFUNC_HELPERS[function](function, *units)
        else:
            raise TypeError("Unknown ufunc {0}.  Please raise issue on "
                            "https://github.com/astropy/astropy"
                            .format(function.__name__))

        if any(converter is False for converter in converters):
            # for two-argument ufuncs with a quantity and a non-quantity,
            # the quantity normally needs to be dimensionless, *except*
            # if the non-quantity can have arbitrary unit, i.e., when it
            # is all zero, infinity or NaN.  In that case, the non-quantity
            # can just have the unit of the quantity
            # (this allows, e.g., `q > 0.` independent of unit)
            maybe_arbitrary_arg = args[converters.index(False)]
            try:
                if _can_have_arbitrary_unit(maybe_arbitrary_arg):
                    converters = [None, None]
                else:
                    raise UnitsError("Can only apply '{0}' function to "
                                     "dimensionless quantities when other "
                                     "argument is not a quantity (unless the "
                                     "latter is all zero/infinity/nan)"
>                                    .format(function.__name__))
E                                    UnitsError: Can only apply 'less_equal' function to dimensionless quantities when other argument is not a quantity (unless the latter is all zero/infinity/nan)

anaconda/lib/python2.7/site-packages/astropy/units/quantity.py:317: UnitsError
___________________________________________________________________ test_hohmann_maneuver ___________________________________________________________________

    def test_hohmann_maneuver():
        # Data from Vallado, example 6.1
        alt_i = 191.34411 * u.km
        alt_f = 35781.34857 * u.km
        ss_i = State.circular(Earth, alt_i)
        expected_dv = 3.935224 * u.km / u.s
        expected_t_trans = 5.256713 * u.h
        man = Maneuver.hohmann(ss_i, Earth.R + alt_f)
        assert_almost_equal(ss_i.apply_maneuver(man).ecc, 0)
        assert_almost_equal(man.get_total_cost().to(u.km / u.s), expected_dv,
>                           decimal=5)

anaconda/lib/python2.7/site-packages/poliastro/tests/test_maneuver.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:474: in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:842: in assert_array_almost_equal
    precision=decimal)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:646: in assert_array_compare
    val = comparison(x, y)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:838: in compare
    return around(z, decimal) <= 10.0**(-decimal)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity 0.0 km / s>, obj = array(False, dtype=bool), context = (<ufunc 'less_equal'>, (<Quantity 0.0 km / s>, 1e-05), 0)

    def __array_prepare__(self, obj, context=None):
        # This method gets called by Numpy whenever a ufunc is called on the
        # array. The object passed in ``obj`` is an empty version of the
        # output array which we can e.g. change to an array sub-class, add
        # attributes to, etc. After this is called, then the ufunc is called
        # and the values in this empty array are set.

        # If no context is set, just return the input
        if context is None:
            return obj

        # Find out which ufunc is being used
        function = context[0]

        from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS

        # Check whether we even support this ufunc
        if function in UNSUPPORTED_UFUNCS:
            raise TypeError("Cannot use function '{0}' with quantities"
                            .format(function.__name__))

        # Now find out what arguments were passed to the ufunc, usually, this
        # will include at least the present object, and another, which could
        # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs.
        args = context[1][:function.nin]
        units = [getattr(arg, 'unit', None) for arg in args]

        # If the ufunc is supported, then we call a helper function (defined
        # in quantity_helper.py) which returns the scale by which the inputs
        # should be multiplied before being passed to the ufunc, as well as
        # the unit the output from the ufunc will have.
        if function in UFUNC_HELPERS:
            converters, result_unit = UFUNC_HELPERS[function](function, *units)
        else:
            raise TypeError("Unknown ufunc {0}.  Please raise issue on "
                            "https://github.com/astropy/astropy"
                            .format(function.__name__))

        if any(converter is False for converter in converters):
            # for two-argument ufuncs with a quantity and a non-quantity,
            # the quantity normally needs to be dimensionless, *except*
            # if the non-quantity can have arbitrary unit, i.e., when it
            # is all zero, infinity or NaN.  In that case, the non-quantity
            # can just have the unit of the quantity
            # (this allows, e.g., `q > 0.` independent of unit)
            maybe_arbitrary_arg = args[converters.index(False)]
            try:
                if _can_have_arbitrary_unit(maybe_arbitrary_arg):
                    converters = [None, None]
                else:
                    raise UnitsError("Can only apply '{0}' function to "
                                     "dimensionless quantities when other "
                                     "argument is not a quantity (unless the "
                                     "latter is all zero/infinity/nan)"
>                                    .format(function.__name__))
E                                    UnitsError: Can only apply 'less_equal' function to dimensionless quantities when other argument is not a quantity (unless the latter is all zero/infinity/nan)

anaconda/lib/python2.7/site-packages/astropy/units/quantity.py:317: UnitsError
_________________________________________________________________ test_bielliptic_maneuver __________________________________________________________________

    def test_bielliptic_maneuver():
        # Data from Vallado, example 6.2
        alt_i = 191.34411 * u.km
        alt_b = 503873.0 * u.km
        alt_f = 376310.0 * u.km
        ss_i = State.circular(Earth, alt_i)
        expected_dv = 3.904057 * u.km / u.s
        expected_t_trans = 593.919803 * u.h
        man = Maneuver.bielliptic(ss_i, Earth.R + alt_b, Earth.R + alt_f)
        assert_almost_equal(ss_i.apply_maneuver(man).ecc, 0)
        assert_almost_equal(man.get_total_cost().to(u.km / u.s), expected_dv,
>                           decimal=5)

anaconda/lib/python2.7/site-packages/poliastro/tests/test_maneuver.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:474: in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:842: in assert_array_almost_equal
    precision=decimal)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:646: in assert_array_compare
    val = comparison(x, y)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:838: in compare
    return around(z, decimal) <= 10.0**(-decimal)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity 0.0 km / s>, obj = array(False, dtype=bool), context = (<ufunc 'less_equal'>, (<Quantity 0.0 km / s>, 1e-05), 0)

    def __array_prepare__(self, obj, context=None):
        # This method gets called by Numpy whenever a ufunc is called on the
        # array. The object passed in ``obj`` is an empty version of the
        # output array which we can e.g. change to an array sub-class, add
        # attributes to, etc. After this is called, then the ufunc is called
        # and the values in this empty array are set.

        # If no context is set, just return the input
        if context is None:
            return obj

        # Find out which ufunc is being used
        function = context[0]

        from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS

        # Check whether we even support this ufunc
        if function in UNSUPPORTED_UFUNCS:
            raise TypeError("Cannot use function '{0}' with quantities"
                            .format(function.__name__))

        # Now find out what arguments were passed to the ufunc, usually, this
        # will include at least the present object, and another, which could
        # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs.
        args = context[1][:function.nin]
        units = [getattr(arg, 'unit', None) for arg in args]

        # If the ufunc is supported, then we call a helper function (defined
        # in quantity_helper.py) which returns the scale by which the inputs
        # should be multiplied before being passed to the ufunc, as well as
        # the unit the output from the ufunc will have.
        if function in UFUNC_HELPERS:
            converters, result_unit = UFUNC_HELPERS[function](function, *units)
        else:
            raise TypeError("Unknown ufunc {0}.  Please raise issue on "
                            "https://github.com/astropy/astropy"
                            .format(function.__name__))

        if any(converter is False for converter in converters):
            # for two-argument ufuncs with a quantity and a non-quantity,
            # the quantity normally needs to be dimensionless, *except*
            # if the non-quantity can have arbitrary unit, i.e., when it
            # is all zero, infinity or NaN.  In that case, the non-quantity
            # can just have the unit of the quantity
            # (this allows, e.g., `q > 0.` independent of unit)
            maybe_arbitrary_arg = args[converters.index(False)]
            try:
                if _can_have_arbitrary_unit(maybe_arbitrary_arg):
                    converters = [None, None]
                else:
                    raise UnitsError("Can only apply '{0}' function to "
                                     "dimensionless quantities when other "
                                     "argument is not a quantity (unless the "
                                     "latter is all zero/infinity/nan)"
>                                    .format(function.__name__))
E                                    UnitsError: Can only apply 'less_equal' function to dimensionless quantities when other argument is not a quantity (unless the latter is all zero/infinity/nan)

anaconda/lib/python2.7/site-packages/astropy/units/quantity.py:317: UnitsError
__________________________________________________________________ test_perigee_and_apogee __________________________________________________________________

    def test_perigee_and_apogee():
        expected_r_a = 500 * u.km
        expected_r_p = 300 * u.km
        a = (expected_r_a + expected_r_p) / 2
        ecc = expected_r_a / a - 1
        _a = 1.0 * u.deg  # Unused angle
        ss = State.from_elements(Earth, a, ecc, _a, _a, _a, _a)
>       assert_almost_equal(ss.r_a, expected_r_a)

anaconda/lib/python2.7/site-packages/poliastro/tests/test_twobody.py:107: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:474: in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:842: in assert_array_almost_equal
    precision=decimal)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:646: in assert_array_compare
    val = comparison(x, y)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:838: in compare
    return around(z, decimal) <= 10.0**(-decimal)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity 0.0 km>, obj = array(False, dtype=bool), context = (<ufunc 'less_equal'>, (<Quantity 0.0 km>, 1e-07), 0)

    def __array_prepare__(self, obj, context=None):
        # This method gets called by Numpy whenever a ufunc is called on the
        # array. The object passed in ``obj`` is an empty version of the
        # output array which we can e.g. change to an array sub-class, add
        # attributes to, etc. After this is called, then the ufunc is called
        # and the values in this empty array are set.

        # If no context is set, just return the input
        if context is None:
            return obj

        # Find out which ufunc is being used
        function = context[0]

        from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS

        # Check whether we even support this ufunc
        if function in UNSUPPORTED_UFUNCS:
            raise TypeError("Cannot use function '{0}' with quantities"
                            .format(function.__name__))

        # Now find out what arguments were passed to the ufunc, usually, this
        # will include at least the present object, and another, which could
        # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs.
        args = context[1][:function.nin]
        units = [getattr(arg, 'unit', None) for arg in args]

        # If the ufunc is supported, then we call a helper function (defined
        # in quantity_helper.py) which returns the scale by which the inputs
        # should be multiplied before being passed to the ufunc, as well as
        # the unit the output from the ufunc will have.
        if function in UFUNC_HELPERS:
            converters, result_unit = UFUNC_HELPERS[function](function, *units)
        else:
            raise TypeError("Unknown ufunc {0}.  Please raise issue on "
                            "https://github.com/astropy/astropy"
                            .format(function.__name__))

        if any(converter is False for converter in converters):
            # for two-argument ufuncs with a quantity and a non-quantity,
            # the quantity normally needs to be dimensionless, *except*
            # if the non-quantity can have arbitrary unit, i.e., when it
            # is all zero, infinity or NaN.  In that case, the non-quantity
            # can just have the unit of the quantity
            # (this allows, e.g., `q > 0.` independent of unit)
            maybe_arbitrary_arg = args[converters.index(False)]
            try:
                if _can_have_arbitrary_unit(maybe_arbitrary_arg):
                    converters = [None, None]
                else:
                    raise UnitsError("Can only apply '{0}' function to "
                                     "dimensionless quantities when other "
                                     "argument is not a quantity (unless the "
                                     "latter is all zero/infinity/nan)"
>                                    .format(function.__name__))
E                                    UnitsError: Can only apply 'less_equal' function to dimensionless quantities when other argument is not a quantity (unless the latter is all zero/infinity/nan)

anaconda/lib/python2.7/site-packages/astropy/units/quantity.py:317: UnitsError
_______________________________________________________ test_apply_zero_maneuver_returns_equal_state ________________________________________________________

    def test_apply_zero_maneuver_returns_equal_state():
        _d = 1.0 * u.AU  # Unused distance
        _ = 0.5 * u.one  # Unused dimensionless value
        _a = 1.0 * u.deg  # Unused angle
        ss = State.from_elements(Sun, _d, _, _a, _a, _a, _a)
        dt = 0 * u.s
        dv = [0, 0, 0] * u.km / u.s
        ss_new = ss.apply_maneuver([(dt, dv)])
>       assert_almost_equal(ss_new.r.to(u.km), ss.r.to(u.km))

anaconda/lib/python2.7/site-packages/poliastro/tests/test_twobody.py:152: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:474: in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:842: in assert_array_almost_equal
    precision=decimal)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:646: in assert_array_compare
    val = comparison(x, y)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:838: in compare
    return around(z, decimal) <= 10.0**(-decimal)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity [ 0., 0., 0.] km>, obj = array([False, False, False], dtype=bool), context = (<ufunc 'less_equal'>, (<Quantity [ 0., 0., 0.] km>, 1e-07), 0)

    def __array_prepare__(self, obj, context=None):
        # This method gets called by Numpy whenever a ufunc is called on the
        # array. The object passed in ``obj`` is an empty version of the
        # output array which we can e.g. change to an array sub-class, add
        # attributes to, etc. After this is called, then the ufunc is called
        # and the values in this empty array are set.

        # If no context is set, just return the input
        if context is None:
            return obj

        # Find out which ufunc is being used
        function = context[0]

        from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS

        # Check whether we even support this ufunc
        if function in UNSUPPORTED_UFUNCS:
            raise TypeError("Cannot use function '{0}' with quantities"
                            .format(function.__name__))

        # Now find out what arguments were passed to the ufunc, usually, this
        # will include at least the present object, and another, which could
        # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs.
        args = context[1][:function.nin]
        units = [getattr(arg, 'unit', None) for arg in args]

        # If the ufunc is supported, then we call a helper function (defined
        # in quantity_helper.py) which returns the scale by which the inputs
        # should be multiplied before being passed to the ufunc, as well as
        # the unit the output from the ufunc will have.
        if function in UFUNC_HELPERS:
            converters, result_unit = UFUNC_HELPERS[function](function, *units)
        else:
            raise TypeError("Unknown ufunc {0}.  Please raise issue on "
                            "https://github.com/astropy/astropy"
                            .format(function.__name__))

        if any(converter is False for converter in converters):
            # for two-argument ufuncs with a quantity and a non-quantity,
            # the quantity normally needs to be dimensionless, *except*
            # if the non-quantity can have arbitrary unit, i.e., when it
            # is all zero, infinity or NaN.  In that case, the non-quantity
            # can just have the unit of the quantity
            # (this allows, e.g., `q > 0.` independent of unit)
            maybe_arbitrary_arg = args[converters.index(False)]
            try:
                if _can_have_arbitrary_unit(maybe_arbitrary_arg):
                    converters = [None, None]
                else:
                    raise UnitsError("Can only apply '{0}' function to "
                                     "dimensionless quantities when other "
                                     "argument is not a quantity (unless the "
                                     "latter is all zero/infinity/nan)"
>                                    .format(function.__name__))
E                                    UnitsError: Can only apply 'less_equal' function to dimensionless quantities when other argument is not a quantity (unless the latter is all zero/infinity/nan)

anaconda/lib/python2.7/site-packages/astropy/units/quantity.py:317: UnitsError
_______________________________________________________________ test_rotate_vector_with_units _______________________________________________________________

    def test_rotate_vector_with_units():
        vector = [1, 0, 0] * u.m
        angle = 90 * u.deg
        axis = 'y'
        expected_vector = [0, 0, -1] * u.m
        result = util.rotate(vector, angle, axis)
>       assert_array_almost_equal(result, expected_vector)

anaconda/lib/python2.7/site-packages/poliastro/tests/test_util.py:25: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:842: in assert_array_almost_equal
    precision=decimal)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:646: in assert_array_compare
    val = comparison(x, y)
anaconda/lib/python2.7/site-packages/numpy/testing/utils.py:838: in compare
    return around(z, decimal) <= 10.0**(-decimal)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity [ 0., 0., 0.] m>, obj = array([False, False, False], dtype=bool), context = (<ufunc 'less_equal'>, (<Quantity [ 0., 0., 0.] m>, 1e-06), 0)

    def __array_prepare__(self, obj, context=None):
        # This method gets called by Numpy whenever a ufunc is called on the
        # array. The object passed in ``obj`` is an empty version of the
        # output array which we can e.g. change to an array sub-class, add
        # attributes to, etc. After this is called, then the ufunc is called
        # and the values in this empty array are set.

        # If no context is set, just return the input
        if context is None:
            return obj

        # Find out which ufunc is being used
        function = context[0]

        from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS

        # Check whether we even support this ufunc
        if function in UNSUPPORTED_UFUNCS:
            raise TypeError("Cannot use function '{0}' with quantities"
                            .format(function.__name__))

        # Now find out what arguments were passed to the ufunc, usually, this
        # will include at least the present object, and another, which could
        # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs.
        args = context[1][:function.nin]
        units = [getattr(arg, 'unit', None) for arg in args]

        # If the ufunc is supported, then we call a helper function (defined
        # in quantity_helper.py) which returns the scale by which the inputs
        # should be multiplied before being passed to the ufunc, as well as
        # the unit the output from the ufunc will have.
        if function in UFUNC_HELPERS:
            converters, result_unit = UFUNC_HELPERS[function](function, *units)
        else:
            raise TypeError("Unknown ufunc {0}.  Please raise issue on "
                            "https://github.com/astropy/astropy"
                            .format(function.__name__))

        if any(converter is False for converter in converters):
            # for two-argument ufuncs with a quantity and a non-quantity,
            # the quantity normally needs to be dimensionless, *except*
            # if the non-quantity can have arbitrary unit, i.e., when it
            # is all zero, infinity or NaN.  In that case, the non-quantity
            # can just have the unit of the quantity
            # (this allows, e.g., `q > 0.` independent of unit)
            maybe_arbitrary_arg = args[converters.index(False)]
            try:
                if _can_have_arbitrary_unit(maybe_arbitrary_arg):
                    converters = [None, None]
                else:
                    raise UnitsError("Can only apply '{0}' function to "
                                     "dimensionless quantities when other "
                                     "argument is not a quantity (unless the "
                                     "latter is all zero/infinity/nan)"
>                                    .format(function.__name__))
E                                    UnitsError: Can only apply 'less_equal' function to dimensionless quantities when other argument is not a quantity (unless the latter is all zero/infinity/nan)

anaconda/lib/python2.7/site-packages/astropy/units/quantity.py:317: UnitsError
============================================================ 6 failed, 26 passed in 8.54 seconds ============================================================
users-MacBook-Pro:~ user$ 

from poliastro.

astrojuanlu avatar astrojuanlu commented on May 19, 2024

Hello @OrbitalMechanic, did you close the issue because you managed to make the tests pass? If so, do you know what was the problem?

from poliastro.

OrbitalMechanic avatar OrbitalMechanic commented on May 19, 2024

If it was closed it was purely by accident. I haven't discovered the
reason for the failures. Please reopen the issue.

Sam Dupree.

On 04/23/2015 00:39:45, Juan Luis Cano RodrΓ­guez wrote:

Hello @OrbitalMechanic https://github.com/OrbitalMechanic, did you
close the issue because you managed to make the test pass? If so, do
you know what was the problem?

β€”
Reply to this email directly or view it on GitHub
#35 (comment).

from poliastro.

astrojuanlu avatar astrojuanlu commented on May 19, 2024

Thanks @OrbitalMechanic, I changed the formatting of your last comment to properly see the result (you can use triple backticks ``` for that). Can you tell me how did you download poliastro and which astropy version do you have?

If I understood correctly, you manage your Python packages through Anaconda and the root environment is installed in a location which needs super admin privileges, am I right? Perhaps you can try to create a conda environment to make testing easier:

$ conda create -n poliastro27 python=2.7 numpy astropy matplotlib numba
$ source activate poliastro27
$ cd poliastro
$ python setup.py install

from poliastro.

OrbitalMechanic avatar OrbitalMechanic commented on May 19, 2024

Initially I used GitHub to clone a version of the source to my system
and installed it per the following commands:

$ git clone https://github.com/Pybonacci/poliastro.git
$ cd poliastro/
$ python setup.py install

Not happy with the results I got from running the tests, I uninstalled
poliastro using the command "pip uninstall poliastro" and when realizing
that the preferred method of installing poliastro was to use pip, I
reinstalled poliastro using the command "pip install poliastro".

After looking at the installation procedures under "Getting Started" is
there a difference in just using "pip install poliastro" as opposed to
using "pip install numpy astropy matplotlib poliastro" as cite on the
webpage, even though I have numpy, astropy and matplotlib already installed?

On 04/24/2015 04:57:12, Juan Luis Cano RodrΓ­guez wrote:

Thanks @OrbitalMechanic https://github.com/OrbitalMechanic, I
changed the formatting of your last comment to properly see the result
(you can use triple backticks ``` for that). Can you tell me how did
you download poliastro and which astropy version do you have?

If I understood correctly, you manage your Python packages through
Anaconda and the root environment is installed in a location which
needs super admin privileges, am I right? Perhaps you can try to
create a conda environment to make testing easier:

|$ conda create -n poliastro27 python=2.7 numpy astropy matplotlib numba
$ source activate poliastro27
$ cd poliastro
$ python setup.py install
|

β€”
Reply to this email directly or view it on GitHub
#35 (comment).

from poliastro.

astrojuanlu avatar astrojuanlu commented on May 19, 2024

While there is no difference between installing poliastro with all the
requirements explicitely or not when using pip, this will install the
stable version available in PyPI which is 2.0 and has some differences with
the one from GitHub.

The first time you had many tests failing probably because of an old numba
version. It only works with the latest one, which is 0.18.2 if I recall
correctly.

The second time the tests failed because of a change in recent versions of
astropy that I had not tested with poliastro 2.0. I will therefore release
a 2.0.1 installable with pip without these problems.

Thanks for the bug report!
On Apr 24, 2015 3:29 PM, "OrbitalMechanic" [email protected] wrote:

Initially I used GitHub to clone a version of the source to my system
and installed it per the following commands:

$ git clone https://github.com/Pybonacci/poliastro.git
$ cd poliastro/
$ python setup.py install

Not happy with the results I got from running the tests, I uninstalled
poliastro using the command "pip uninstall poliastro" and when realizing
that the preferred method of installing poliastro was to use pip, I
reinstalled poliastro using the command "pip install poliastro".

After looking at the installation procedures under "Getting Started" is
there a difference in just using "pip install poliastro" as opposed to
using "pip install numpy astropy matplotlib poliastro" as cite on the
webpage, even though I have numpy, astropy and matplotlib already
installed?

On 04/24/2015 04:57:12, Juan Luis Cano RodrΓ­guez wrote:

Thanks @OrbitalMechanic https://github.com/OrbitalMechanic, I
changed the formatting of your last comment to properly see the result
(you can use triple backticks ``` for that). Can you tell me how did
you download poliastro and which astropy version do you have?

If I understood correctly, you manage your Python packages through
Anaconda and the root environment is installed in a location which
needs super admin privileges, am I right? Perhaps you can try to
create a conda environment to make testing easier:

|$ conda create -n poliastro27 python=2.7 numpy astropy matplotlib numba
$ source activate poliastro27
$ cd poliastro
$ python setup.py install
|

Reply to this email directly or view it on GitHub
<#35 (comment)
.

Reply to this email directly or view it on GitHub
#35 (comment).

from poliastro.

OrbitalMechanic avatar OrbitalMechanic commented on May 19, 2024

Please let me know when the 2.0.1 becomes available, and thanks for your
help. :-)

On 04/24/2015 13:02:01, Juan Luis Cano RodrΓ­guez wrote:

While there is no difference between installing poliastro with all the
requirements explicitely or not when using pip, this will install the
stable version available in PyPI which is 2.0 and has some differences
with
the one from GitHub.

The first time you had many tests failing probably because of an old numba
version. It only works with the latest one, which is 0.18.2 if I recall
correctly.

The second time the tests failed because of a change in recent versions of
astropy that I had not tested with poliastro 2.0. I will therefore release
a 2.0.1 installable with pip without these problems.

Thanks for the bug report!
On Apr 24, 2015 3:29 PM, "OrbitalMechanic" [email protected]
wrote:

Initially I used GitHub to clone a version of the source to my system
and installed it per the following commands:

$ git clone https://github.com/Pybonacci/poliastro.git
$ cd poliastro/
$ python setup.py install

Not happy with the results I got from running the tests, I uninstalled
poliastro using the command "pip uninstall poliastro" and when realizing
that the preferred method of installing poliastro was to use pip, I
reinstalled poliastro using the command "pip install poliastro".

After looking at the installation procedures under "Getting Started" is
there a difference in just using "pip install poliastro" as opposed to
using "pip install numpy astropy matplotlib poliastro" as cite on the
webpage, even though I have numpy, astropy and matplotlib already
installed?

On 04/24/2015 04:57:12, Juan Luis Cano RodrΓ­guez wrote:

Thanks @OrbitalMechanic https://github.com/OrbitalMechanic, I
changed the formatting of your last comment to properly see the result
(you can use triple backticks ``` for that). Can you tell me how did
you download poliastro and which astropy version do you have?

If I understood correctly, you manage your Python packages through
Anaconda and the root environment is installed in a location which
needs super admin privileges, am I right? Perhaps you can try to
create a conda environment to make testing easier:

|$ conda create -n poliastro27 python=2.7 numpy astropy matplotlib
numba
$ source activate poliastro27
$ cd poliastro
$ python setup.py install
|

Reply to this email directly or view it on GitHub

<#35 (comment)
.

Reply to this email directly or view it on GitHub

#35 (comment).

β€”
Reply to this email directly or view it on GitHub
#35 (comment).

from poliastro.

astrojuanlu avatar astrojuanlu commented on May 19, 2024

I just released poliastro 0.2.1 (not 2.0.1, sorry πŸ˜…) to fix this bug. You can already pip install it, I added your name to the release notes.

http://pybonacci.github.io/poliastro/changelog.html#new-in-poliastro-0-2-1

As soon as you try poliastro 0.2.1 and check that all test pass I will fix this issue.

from poliastro.

OrbitalMechanic avatar OrbitalMechanic commented on May 19, 2024

I was able to install poliastro ver. 0.2.1 successfully. All tests ran
successfully - see below.

Thanks for your help. I really appreciated it.

Sam Dupree.

users-MacBook-Pro:~ user$ sudo pip install poliastro
Password:
Collecting poliastro
Downloading poliastro-0.2.1.tar.gz (86kB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 90kB 1.2MB/s
Installing collected packages: poliastro
Running setup.py install for poliastro
Successfully installed poliastro-0.2.1
users-MacBook-Pro:~ user$ python -c "import poliastro; poliastro.test()"
========================================================== test session
starts ===========================================================
platform darwin -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4
collected 30 items

anaconda/lib/python2.7/site-packages/poliastro/tests/test_bodies.py ....
anaconda/lib/python2.7/site-packages/poliastro/tests/test_maneuver.py ......
anaconda/lib/python2.7/site-packages/poliastro/tests/test_twobody.py
.................
anaconda/lib/python2.7/site-packages/poliastro/tests/test_util.py ...

======================================================= 30 passed in
3.95 seconds ========================================================
users-MacBook-Pro:~ user$

On 04/26/2015 04:19:39, Juan Luis Cano RodrΓ­guez wrote:

I just released poliastro 0.2.1 (not 2.0.1, sorry πŸ˜…) to
fix this bug. You can already |pip install| it, I added your name in
the release notes.

http://pybonacci.github.io/poliastro/changelog.html#new-in-poliastro-0-2-1

As soon as you try poliastro 0.2.1 and check that all test pass I will
fix this issue.

β€”
Reply to this email directly or view it on GitHub
#35 (comment).

mail-signature

<IYA-2009.jpg>
<mmb_emblem-2.gif> Samuel H. Dupree, [email protected]
10501 Rising Ridge Road
Apartment 201 http://users.speakeasy.net/~sdupree/
Fredericksburg, VA 22407, USA

 HOME: 540-693-1240            WORK: 540-653-6509     FAX: 866-514-9629

/ "The Greatest Show on Earth" is not on Earth. It's in Space!/


from poliastro.

astrojuanlu avatar astrojuanlu commented on May 19, 2024

Perfect, thanks! Don't hesitate to send me your criticism or ideas about the package. Before May 10th I will release version 0.3, with substantial improvements :)

Closing!

from poliastro.

ashalogu23 avatar ashalogu23 commented on May 19, 2024

This is from poliastro 0.4 run on ubuntu 15.10
No plots are genertaed with poliastro.
Matplotlib examples work well

from poliastro.plotting import OrbitPlotter
op = OrbitPlotter()
#ss_a, ss_f = ss_i.apply_maneuver(hoh, intermediate=True)
op.plot(ss, label="Initial orbit")

The output

[<matplotlib.lines.Line2D at 0x7f808c286278>,
 <matplotlib.lines.Line2D at 0x7f808c1b3438>]

no plots

ss = State.from_vectors(Earth, r, v)
ss.epoch
ss.epoch.iso
from poliastro.plotting import plot
plot(ss)

output

/home/loga/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_axes.py:519: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labelled objects found. "

OUT[9][<matplotlib.lines.Line2D at 0x7f808c17ecc0>,
 <matplotlib.lines.Line2D at 0x7f808c1859e8>]

from poliastro.

astrojuanlu avatar astrojuanlu commented on May 19, 2024

Hello @ashalogu23, I guess you are missing a pyplot.show() call at the end. Try the Jupyter notebook for nicer interactive plots. The last warning was fixed as part of #103. Please open a new issue if the problem persists.

from poliastro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.