[AstroPy] Visibility plot with the list of coords

Ilya Yakunin arckest at gmail.com
Mon Jul 27 09:32:03 EDT 2015


Hi!

I'd like to plot observability curves for list of the objects of my
interest. Following this example
https://astropy.readthedocs.org/en/v1.0.3/coordinates/observing-example.html
I created coords list using SkyCoord:

>>>coords = SkyCoord(data[:,2], data[:,3], unit=(u.deg,u.deg))

which contains more than 300 objects.

And then, when I'm trying to transform equatorial coords to horizontal I get:

>>>from astropy.coordinates import get_sun
>>>delta_midnight = np.linspace(-12, 12, 1000)*u.hour
>>>times = midnight + delta_midnight
>>>altazframe = AltAz(obstime=times, location=bta_location)
>>>sunaltazs = get_sun(times).transform_to(altazframe)
>>>coordaltazs = coords.transform_to(altazframe)

Traceback (most recent call last):
  File "testing", line 38, in <module>
    corraaltazs = coords.transform_to(altazframe)
  File "/usr/lib/python2.7/dist-packages/astropy/coordinates/sky_coordinate.py",
line 348, in transform_to
    new_coord = trans(self.frame, generic_frame)
  File "/usr/lib/python2.7/dist-packages/astropy/coordinates/transformations.py",
line 920, in __call__
    curr_coord = t(curr_coord, curr_toframe)
  File "/usr/lib/python2.7/dist-packages/astropy/coordinates/transformations.py",
line 708, in __call__
    res = self.func(fromcoord, toframe)
  File "/usr/lib/python2.7/dist-packages/astropy/coordinates/builtin_frames/icrs_cirs_transforms.py",
line 41, in icrs_to_cirs
    cirs_ra, cirs_dec = erfa.atciq(i_ra, i_dec, 0, 0, px, 0, astrom)
  File "/usr/lib/python2.7/dist-packages/astropy/_erfa/core.py", line
22306, in atciq
    broadcast = numpy.broadcast(numpy.int32(0.0), numpy.int32(0.0),
rc_in, dc_in, pr_in, pd_in, px_in, rv_in, astrom_in)
ValueError: shape mismatch: objects cannot be broadcast to a single shape

But when I use a single string from coords list (say, coords[20] )
everything goes well.
Looks like transform_to() waits for a single SkyCoord object but I
have a list. Is there any way to convert and plot several objects on
one plot?

Thanks for the any help!

-- 
Cheers,
Ilya



More information about the AstroPy mailing list