[AstroPy] Calculating alt/az or zenith angle/parallactic angle

Francisco Gallardo lópez f.gallardo.lopez at gmail.com
Fri Jan 27 06:07:36 EST 2017


We run into a similar problem with a project in SpaceApps.

I think we discarded Skycoord due to the speed so we used PyEphem.

Let me tell you in advance that I am not sure whether this works (I did not
properly tested it nor had time to check it out properly).

https://github.com/juanlu-sanz/neo-challege-2016/blob/master/spice/restapi.py


Go to line 103: def conversion(ar,dec,times_list,lat,lon):

[*AGAIN*: I am not sure whether this works properly as we did not have time
to test it!!] (and as per the coding style and so on: We did the entire
thing in a weekend so, please have some mercy :-P)

obs.date=times_list[k]
LST=math.degrees(obs.sidereal_time())
HA = ar[k] - LST
x = math.cos(HA) * math.cos(dec[k])
y = math.sin(HA) * math.cos(dec[k])
z = math.sin(dec[k])
zhor = x * math.sin(90 - lat) + z * math.cos(90 - lat)
alt.append(math.asin(zhor))


BR
Fran Gallardo

2017-01-27 11:56 GMT+01:00 Tim Cornwell <realtimcornwell at gmail.com>:

> Hi Tim,
>
> I can see how that works bit what I want is to be able to calculate from
> the local hour angle i.e. a relative time (LST-RA) instead of starting with
> an absolute time. For context, I’m writing some simulation code and don’t
> need to work with absolute time. From what I see, it’s not possible in
> astropy to start with hour angle instead of some form of absolute time. I
> can work around this but it seems to be a hole in either the package or
> more likely in the documentation.
>
> Thanks,
> Tim
>
> --
> Tim Cornwell
> Sent with Airmail
>
> On 27 January 2017 at 10:51:42 am, Tim Staley (tim.staley at physics.ox.ac.uk)
> wrote:
>
> Hi Tim,
>
> you want something like the following:
>
> from astropy.coordinates import SkyCoord, AltAz, EarthLocation
>
> from astropy.time import Time
> import astropy.units as u
>
> obs_time = Time('2017-01-01T18:00')
>
> sky_posn = SkyCoord(0 * u.deg, 30 * u.deg)
> earth_location = EarthLocation.from_geodetic(0*u.deg, 35*u.deg)
>
> altaz = sky_posn.transform_to(
> AltAz(obstime=obs_time,
> location=earth_location))
>
> print(altaz.alt.deg, altaz.az.deg)
>
>
> Cheers,
> Tim
>
> On 27/01/17 10:34, Tim Cornwell wrote:
> > Hi
> >
> > I am given an hour angle and wish to calculate alt/az or zenith
> > angle/parallactic angle for a given SkyCoord and Location. After
> > reading the documentation and many tries, I cannot see how to do this
> > with the current Astropy Time/Angle classes. It is possible?
> >
> > Thanks,
> > Tim
> >
> > --
> > Tim Cornwell
> > Sent with Airmail
> >
> >
> > _______________________________________________
> > AstroPy mailing list
> > AstroPy at scipy.org
> > https://mail.scipy.org/mailman/listinfo/astropy
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20170127/847f2d08/attachment.html>


More information about the AstroPy mailing list