How to use the astroplan.Observer.at_site 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
def test_dcr_angles():
    """Check the DCR angle calculations by comparing to astroplan's calculations of the same.
    """
    # Note: test_chromatic.py and test_sed.py both also test aspects of the dcr module, so
    # this particular test could belong in either of them too.  But I (MJ) put it here, since
    # I wrote it in conjunction with the tests of PhotonDCR to try to make sure that code
    # 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)
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))