Specutils Import Error: Concatonate dtype

25 Views Asked by At

I have recently been using python's specutils in my Jupyter Notebook. Unfortunately, upon needing to import it again I get the error TypeError: concatenate() got an unexpected keyword argument 'dtype'.

I am unsure of how to resolve this error. I have tried installing an older version of numpy before np.concatenate received the argument dtype, but that has not worked.

Any help would be much appreciated. I have attached the entire error below if it is of use to anyone.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/c0/bxk1h7r54tb6c3hllk8gs7nr0000gn/T/ipykernel_3886/2843005521.py in <module>
----> 1 from specutils import Spectrum1D
      2 from specutils import SpectralRegion
      3 from specutils.analysis import equivalent_width
      4 from specutils.fitting import fit_generic_continuum

~/anaconda3/lib/python3.9/site-packages/specutils/__init__.py in <module>
     21 
     22 # Allow loading spectrum object from top level module
---> 23 from .spectra import *  # noqa
     24 
     25 # Load the IO functions

~/anaconda3/lib/python3.9/site-packages/specutils/spectra/__init__.py in <module>
      3 `~astropy.nddata.NDData`-inherited classes used for storing the spectrum data.
      4 """
----> 5 from .spectrum1d import *  # noqa
      6 from .spectral_region import *  # noqa
      7 from .spectrum_collection import *  # noqa

~/anaconda3/lib/python3.9/site-packages/specutils/spectra/spectrum1d.py in <module>
     13 from ..utils.wcs_utils import gwcs_from_array
     14 
---> 15 from ndcube import NDCube
     16 
     17 __all__ = ['Spectrum1D']

~/anaconda3/lib/python3.9/site-packages/ndcube/__init__.py in <module>
     28 from .global_coords import GlobalCoords
     29 from .ndcollection import NDCollection
---> 30 from .ndcube import NDCube
     31 from .ndcube_sequence import NDCubeSequence
     32 from .version import version as __version__

~/anaconda3/lib/python3.9/site-packages/ndcube/ndcube.py in <module>
     13 try:
     14     # Import sunpy coordinates if available to register the frames and WCS functions with astropy
---> 15     import sunpy.coordinates  # pylint: disable=unused-import  # NOQA
     16 except ImportError:
     17     pass

~/anaconda3/lib/python3.9/site-packages/sunpy/coordinates/__init__.py in <module>
     19 """
     20 
---> 21 from . import sun
     22 from .ephemeris import *
     23 from .frames import *

~/anaconda3/lib/python3.9/site-packages/sunpy/coordinates/sun.py in <module>
     32 from .ephemeris import get_earth
     33 from .frames import HeliographicStonyhurst
---> 34 from .transformations import _SOLAR_NORTH_POLE_HCRS, _SUN_DETILT_MATRIX
     35 
     36 __author__ = "Albert Y. Shih"

~/anaconda3/lib/python3.9/site-packages/sunpy/coordinates/transformations.py in <module>
    645 
    646 # Calculate the rotation matrix to de-tilt the Sun's rotation axis to be parallel to the Z axis
--> 647 _SUN_DETILT_MATRIX = _rotation_matrix_reprs_to_reprs(_SOLAR_NORTH_POLE_HCRS,
    648                                                      CartesianRepresentation(0, 0, 1))
    649 

~/anaconda3/lib/python3.9/site-packages/sunpy/coordinates/transformations.py in _rotation_matrix_reprs_to_reprs(start_representation, end_representation)
    595     A = start_representation.to_cartesian()
    596     B = end_representation.to_cartesian()
--> 597     rotation_axis = A.cross(B)
    598     rotation_angle = -np.arccos(A.dot(B) / (A.norm() * B.norm()))  # negation is required
    599 

~/anaconda3/lib/python3.9/site-packages/astropy/coordinates/representation.py in cross(self, other)

~/anaconda3/lib/python3.9/site-packages/astropy/coordinates/representation.py in get_xyz(self, xyz_axis)

~/anaconda3/lib/python3.9/site-packages/numpy/core/overrides.py in stack(*args, **kwargs)

~/anaconda3/lib/python3.9/site-packages/astropy/units/quantity.py in __array_function__(self, function, types, args, kwargs)
   1681             # If, e.g., we are casting float to int, we want to fail if
   1682             # precision is lost, but let things pass if it works.
-> 1683             _value = np.array(_value, copy=False, subok=True)
   1684             if not np.can_cast(_value.dtype, self.dtype):
   1685                 self_dtype_array = np.array(_value, self.dtype, subok=True)

~/anaconda3/lib/python3.9/site-packages/numpy/core/shape_base.py in stack(arrays, axis, out, dtype, casting)
    469 def _block_format_index(index):
    470     """
--> 471     Convert a list of indices ``[0, 1, 2]`` into ``"arrays[0][1][2]"``.
    472     """
    473     idx_str = ''.join('[{}]'.format(i) for i in index if i is not None)

~/anaconda3/lib/python3.9/site-packages/numpy/core/overrides.py in concatenate(*args, **kwargs)

~/anaconda3/lib/python3.9/site-packages/astropy/units/quantity.py in __array_function__(self, function, types, args, kwargs)
   1686                 if not np.all((self_dtype_array == _value) | np.isnan(_value)):
   1687                     raise TypeError(
-> 1688                         "cannot convert value type to array type without precision loss"
   1689                     )
   1690 

TypeError: concatenate() got an unexpected keyword argument 'dtype'
0

There are 0 best solutions below