astropy / astropy/astroplan

.to_table() TypeError, possible bug

Open
#456 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
225
Forks
121
Avg merge
28m
Merged PRs (30d)
1

Description

Hi!

I have problems with the newer versions of astroplan.
With 0.4 and astropy-3.2 I have no problem, but with 0.6 and 0.7.dev1234 the
priority_schedule.to_table() method drops the following error:

Traceback (most recent call last):
File "rc80_scheduler.py", line 447, in
out_table = priority_schedule.to_table()
File "/usr/local/lib/python3.7/site-packages/astroplan-0.7.dev1234-py3.7.egg/astroplan/scheduling.py", line 304, in to_table
u.Quantity(ra), u.Quantity(dec), config],
File "/usr/local/lib/python3.7/site-packages/astropy/units/quantity.py", line 387, in __new__
raise TypeError("The value must be a valid Python or "
TypeError: The value must be a valid Python or Numpy numeric type.

I use python3.7 and astropy-4.0.

I managed to circumvent the problem by changing the code in
/usr/local/lib/python3.7/site-packages/astroplan-0.7.dev1234-py3.7.egg/astroplan/scheduling.py
in line 303 to:

return Table([target_names, start_times, end_times, durations, ra, dec, config],
names=('target', 'start time (UTC)', 'end time (UTC)',
'duration (minutes)', 'ra', 'dec', 'configuration'))

It seems the ra,dec unit conversion (u.Quantity(ra), u.Quantity(dec)) caused the problem.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in astroplan/scheduling.py around line 304 and reproduce the failure with priority_schedule.to_table() under Python 3.7 and Astropy 4.0. Compare the reported workaround with the existing table construction and verify that the method returns a table without the TypeError.】【。

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.