How to use the astroplan.FixedTarget.from_name function in astroplan

To help you get started, we’ve selected a few astroplan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GalSim-developers / GalSim / tests / test_photon_array.py View on Github external
# is working properly.
    import astropy.time

    # Set up an observation date, time, location, coordinate
    # These are arbitrary, so ripped from astroplan's docs
    # https://media.readthedocs.org/pdf/astroplan/latest/astroplan.pdf
    subaru = astroplan.Observer.at_site('subaru')
    time = astropy.time.Time('2015-06-16 12:00:00')

    # Stars that are visible from the north in summer time.
    names = ['Vega', 'Polaris', 'Altair', 'Regulus', 'Spica', 'Algol', 'Fomalhaut', 'Markab',
             'Deneb', 'Mizar', 'Dubhe', 'Sirius', 'Rigel', 'Etamin', 'Alderamin']

    for name in names:
        try:
            star = astroplan.FixedTarget.from_name(name)
        except Exception as e:
            print('Caught exception trying to make star from name ',name)
            print(e)
            print('Aborting.  (Probably some kind of network problem.)')
            return
        print(star)

        ap_z = subaru.altaz(time, star).zen
        ap_q = subaru.parallactic_angle(time, star)
        print('According to astroplan:')
        print('  z,q = ', ap_z.deg, ap_q.deg)

        # Repeat with GalSim
        coord = galsim.CelestialCoord(star.ra.deg * galsim.degrees, star.dec.deg * galsim.degrees)
        lat = subaru.location.lat.deg * galsim.degrees
        local_sidereal_time = subaru.local_sidereal_time(time)
github ojhall94 / stateoftheuniverse / stateoftheuniverse / widgets / constillations / get_constillations.py View on Github external
from astropy import units as u
from astroplan import Observer, FixedTarget
from astropy.coordinates import SkyCoord, AltAz, Angle, get_constellation
from astropy.time import Time
import numpy as np

subaru = Observer.at_site('subaru')

altair = FixedTarget.from_name('Altair')
vega = FixedTarget.from_name('Vega')

time = Time('2019-08-27 12:00:00')

alt = Angle(np.arange(0,90,5), unit=u.deg)
az = Angle(np.arange(0,395,5), unit=u.deg)

#altaz = AltAz(az=az[0], alt=alt[0], location=subaru.location)
altaz = SkyCoord(az=az[1]*u.degree, alt=alt[1]*u.degree, frame='altaz') 
print(subaru.location)
print(type(subaru))
print(altaz)
print(get_constellation(altaz))
github ojhall94 / stateoftheuniverse / stateoftheuniverse / widgets / constillations / get_constillations.py View on Github external
from astropy import units as u
from astroplan import Observer, FixedTarget
from astropy.coordinates import SkyCoord, AltAz, Angle, get_constellation
from astropy.time import Time
import numpy as np

subaru = Observer.at_site('subaru')

altair = FixedTarget.from_name('Altair')
vega = FixedTarget.from_name('Vega')

time = Time('2019-08-27 12:00:00')

alt = Angle(np.arange(0,90,5), unit=u.deg)
az = Angle(np.arange(0,395,5), unit=u.deg)

#altaz = AltAz(az=az[0], alt=alt[0], location=subaru.location)
altaz = SkyCoord(az=az[1]*u.degree, alt=alt[1]*u.degree, frame='altaz') 
print(subaru.location)
print(type(subaru))
print(altaz)
print(get_constellation(altaz))
github astropy / astroplan / dev / planning-example.py View on Github external
A target object defines a single observation target, with coordinates
and an optional name.
'''
from astroplan import FixedTarget

# Define a target.

from astropy.coordinates import SkyCoord
t1 = FixedTarget(name='Polaris',
                 coord=SkyCoord('02h31m49.09s', '+89d15m50.8s', frame='icrs'))

# Leaves scope for NonSiderealTarget, etc.

# Convenience methods for looking up/constructing targets by name via
# astroquery:
t1 = FixedTarget.from_name('Polaris')

# ================================
# Condition objects, observability
# ================================

"""
Q: Can I observe this target on the night of May 1, 2015 between 18:30
and 05:30 HST, above airmass 1.2, on a telescope that can observe between
15 degrees and 89 degrees altitude?
"""

# first we define the conditions
from astroplan import TimeRange, AltitudeRange, AirmassRange, is_observable
# `is_observable` is a temporary function which will eventually be a method of
# something to support caching