astropy / astropy/astroplan

Missing targets in plot_airmass and wrong values

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

Description

🐞 **Problem**

I wanted to study the visibility of two comets. The coordinates for the comets are stored in a `comets.dat` file:

```text
Name,RA(J2000),DE(J2000)

12P/Pons-Brooks,18h27m29.43s,38°37'1.25"
C/2023 H2 (Lemmon),22h17m4.56s,-37°36'10.31"
```

The main code looks like this:

```python
import matplotlib.pyplot as plt
import pandas as pd
from astroplan import FixedTarget, Observer
from astroplan.plots import plot_airmass
from astropy import units as u
from astropy.coordinates import Angle, EarthLocation, SkyCoord
from astropy.time import Time

location = EarthLocation.from_geodetic(
lon="3d23m05s",
lat="37d03m51s",
height=2896.0 * u.m,
)
telescope = Observer(
location,
name="Observatorio Sierra Nevada (OSN)",
timezone="Europe/Madrid",
)
observation_data = pd.read_csv("comets.dat")
time = Time("2023-12-01 18:00:00")

def main():
targets = []
for _, body in observation_data.iterrows():
name, ra, dec = (
body["Name"],
Angle(body["RA(J2000)"], unit=u.hour),
Angle(body["DE(J2000)"], unit=u.deg),
)
target_coords = SkyCoord(ra=ra, dec=dec, frame="icrs")
targets.append(FixedTarget(coord=target_coords, name=name))

plot_airmass(
targets,
telescope,
time,
altitude_yaxis=True,
brightness_shading=True,
style_kwargs={"linestyle": "--"},
)
plt.show()

if __name__ == "__main__":
main()
```

The output figure is this one:

![output](https://github.com/astropy/astroplan/assets/28702884/7b686fca-b3f2-4606-933d-92c591727d9b)

Note that there is only one object instead of two. Furthermore, the values being displayed in the graph are not the ones I get with other software (KStars and Stellarium) for the same location and time.

I am missing something in my code? The documentation and tutorials are very clean and detailed on how to use the library.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided main() example with comets.dat and inspect how the targets are built before plot_airmass() is called. Trace the plot_airmass entry point and compare its calculated coordinates and visibility values with the stated observer location and time; done means explaining both the missing target and differing values, with a reproducible test or documented correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, pandas, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.