astropy / astroplan

Observation planning package for astronomers – maintainer @bmorris3
https://astroplan.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
200 stars 109 forks source link

Observer sun_set_time and sun_rise_time methods crashing #579

Closed maxkroft closed 9 months ago

maxkroft commented 9 months ago

When I was trying to do some observing planning with astroplan, my sun_set_time calculation was failing. I thought I was doing something wrong, so I copied the code from one of the examples to test it out.

I am running this snippet of code on Windows 11, python v3.11.7.

This code is directly copied from here


from astroplan import Observer from astropy.time import Time import astropy.units as u

mmt = Observer.at_site('mmt', pressure=0*u.bar)

usno_sunset = Time('2019-01-01 00:31')

astroplan_sunset = mmt.sun_set_time(usno_sunset - 10u.min,horizon=-0.8333u.deg, which='next')

print(usno_sunset, astroplan_sunset)


When I run this, I get the following error:

Traceback (most recent call last):

File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)

File c:\users\kroft\documents\python\untitled0.py:12 astroplan_sunset = mmt.sun_set_time(usno_sunset - 10u.min,horizon=-0.8333u.deg, which='next')

File ~\anaconda3\Lib\site-packages\astropy\units\decorators.py:302 in wrapper return_ = wrapped_function(*func_args, **func_kwargs)

File ~\anaconda3\Lib\site-packages\astroplan\observer.py:1401 in sun_set_time return self.target_set_time(time, get_sun(time), which, horizon,

File ~\anaconda3\Lib\site-packages\astropy\coordinates\funcs.py:168 in get_sun return SkyCoord(cartrep, frame=GCRS(obstime=time))

File ~\anaconda3\Lib\site-packages\astropy\coordinates\sky_coordinate.py:331 in init skycoord_kwargs, components, info = _parse_coordinate_data(

File ~\anaconda3\Lib\site-packages\astropy\coordinates\sky_coordinate_parsers.py:279 in _parse_coordinate_data _skycoord_kwargs, _components = _parse_coordinate_arg(

File ~\anaconda3\Lib\site-packages\astropy\coordinates\sky_coordinate_parsers.py:453 in _parse_coordinate_arg data = coords.represent_as(frame.representation_type)

File ~\anaconda3\Lib\site-packages\astropy\coordinates\representation.py:873 in represent_as new_rep = other_class.from_cartesian(self.to_cartesian())

File ~\anaconda3\Lib\site-packages\astropy\coordinates\representation.py:2030 in from_cartesian p = cart.get_xyz(xyz_axis=-1)

File ~\anaconda3\Lib\site-packages\astropy\coordinates\representation.py:1351 in get_xyz return np.stack([self._x, self._y, self._z], axis=xyz_axis)

File ~\anaconda3\Lib\site-packages\astropy\units\quantity.py:1683 in array_function return super().array_function(function, types, args, kwargs)

File ~\anaconda3\Lib\site-packages\numpy\core\shape_base.py:456 in stack return _nx.concatenate(expanded_arrays, axis=axis, out=out,

File ~\anaconda3\Lib\site-packages\astropy\units\quantity.py:1688 in __array_function__ args, kwargs, unit, out = function_helper(*args, **kwargs)

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