当前位置: 首页>>代码示例>>Python>>正文


Python EarthLocation.of_site方法代码示例

本文整理汇总了Python中astropy.coordinates.EarthLocation.of_site方法的典型用法代码示例。如果您正苦于以下问题:Python EarthLocation.of_site方法的具体用法?Python EarthLocation.of_site怎么用?Python EarthLocation.of_site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在astropy.coordinates.EarthLocation的用法示例。


在下文中一共展示了EarthLocation.of_site方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: airmass_plots

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def airmass_plots(KPNO=False,ING=False,MLO=False):

    observer_site = Observer.at_site("Kitt Peak", timezone="US/Mountain")

    if KPNO:
        print('plotting airmass curves for Kitt Peak')
        observing_location = EarthLocation.of_site('Kitt Peak')
        observer_site = Observer.at_site("Kitt Peak", timezone="US/Mountain")
        start_time = Time('2017-03-12 01:00:00') # UTC time, so 1:00 UTC = 6 pm AZ mountain time
        end_time = Time('2017-03-12 14:00:00')

    elif MLO:
        print('plotting airmass curves for MLO')
        observing_location = EarthLocation.of_site(u'Palomar')
        observer_site = Observer.at_site("Palomar", timezone="US/Pacific")
        # for run starting 2019-Apr-04 at MLO
        start_time = Time('2019-04-03 01:00:00') # need to enter UTC time, MLO UTC+6?
        end_time = Time('2019-04-03 14:00:00')
        
    elif ING:
        print('plotting airmass curves for INT')
        observing_location = EarthLocation.of_site(u'Roque de los Muchachos')
        observer_site = Observer.at_site("Roque de los Muchachos", timezone="GMT")
        # for run starting 2019-Feb-04 at INT
        start_time = Time('2019-02-04 19:00:00') # INT is on UTC
        end_time = Time('2019-02-05 07:00:00')

    #observing_time = Time('2017-05-19 07:00')  # 1am UTC=6pm AZ mountain time
    #observing_time = Time('2018-03-12 07:00')  # 1am UTC=6pm AZ mountain time
    #aa = AltAz(location=observing_location, obstime=observing_time)


    #for i in range(len(pointing_ra)):



    delta_t = end_time - start_time
    observing_time = start_time + delta_t*np.linspace(0, 1, 75)
    nplots = int(sum(obs_mass_flag)/8.)
    print(nplots)
    for j in range(nplots):
        plt.figure()
        legend_list = []
        for i in range(8):
            pointing_center = coords.SkyCoord(pointing_ra[8*j+i]*u.deg, pointing_dec[8*j+i]*u.deg, frame='icrs')
            if i == 3:
                plot_airmass(pointing_center,observer_site,observing_time,brightness_shading=True)
            else:
                plot_airmass(pointing_center,observer_site,observing_time)
            legend_list.append('Pointing %02d'%(8*j+i+1))
    
        plt.legend(legend_list)
        #plt.ylim(0.9,2.5)
        plt.gca().invert_yaxis()
        plt.subplots_adjust(bottom=.15)
        #plt.axvline(x=7*u.hour,ls='--',color='k')
        plt.axhline(y=2,ls='--',color='k')
        plt.savefig(outfile_prefix+'airmass-%02d.png'%(j+1))
开发者ID:rfinn,项目名称:Virgo,代码行数:60,代码来源:kpno-halpha.p3.py

示例2: test_is_night

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def test_is_night():
    lco = Observer(location=EarthLocation.of_site('lco'))  # Las Campanas
    aao = Observer(location=EarthLocation.of_site('aao'))  # Sydney, Australia
    vbo = Observer(location=EarthLocation.of_site('vbo'))  # India

    time1 = Time('2015-07-28 17:00:00')
    nights1 = [observer.is_night(time1) for observer in [lco, aao, vbo]]
    assert np.all(nights1 == [False, True, True])

    time2 = Time('2015-07-28 02:00:00')
    nights2 = [observer.is_night(time2) for observer in [lco, aao, vbo]]
    assert np.all(nights2 == [True, False, False])
开发者ID:StuartLittlefair,项目名称:astroplan,代码行数:14,代码来源:test_observer.py

示例3: test_icrs_to_camera

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def test_icrs_to_camera():
    from ctapipe.coordinates import CameraFrame

    obstime = Time('2013-11-01T03:00')
    location = EarthLocation.of_site('Roque de los Muchachos')
    horizon_frame = AltAz(location=location, obstime=obstime)

    # simulate crab "on" observations
    crab = SkyCoord(ra='05h34m31.94s', dec='22d00m52.2s')
    telescope_pointing = crab.transform_to(horizon_frame)

    camera_frame = CameraFrame(
        focal_length=28 * u.m,
        telescope_pointing=telescope_pointing,
        location=location, obstime=obstime,
    )

    ceta_tauri = SkyCoord(ra='5h37m38.6854231s', dec='21d08m33.158804s')
    ceta_tauri_camera = ceta_tauri.transform_to(camera_frame)

    camera_center = SkyCoord(0 * u.m, 0 * u.m, frame=camera_frame)
    crab_camera = crab.transform_to(camera_frame)

    assert crab_camera.x.to_value(u.m) == approx(0.0, abs=1e-10)
    assert crab_camera.y.to_value(u.m) == approx(0.0, abs=1e-10)

    # assert ceta tauri is in FoV
    assert camera_center.separation_3d(ceta_tauri_camera) < u.Quantity(0.6, u.m)
开发者ID:dipierr,项目名称:ctapipe,代码行数:30,代码来源:test_coordinates.py

示例4: check_moon

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def check_moon(file, avoid=30.*u.degree):
    if not isinstance(avoid, u.Quantity):
        avoid = float(avoid)*u.degree
    else:
        avoid = avoid.to(u.degree)

    header = fits.getheader(file)

    mlo = EarthLocation.of_site('Keck Observatory') # Update later
    obstime = Time(header['DATE-OBS'], format='isot', scale='utc', location=mlo)
    moon = get_moon(obstime, mlo)

    if 'RA' in header.keys() and 'DEC' in header.keys():
        coord_string = '{} {}'.format(header['RA'], header['DEC'])
        target = SkyCoord(coord_string, unit=(u.hourangle, u.deg))
    else:
        ## Assume zenith
        target = SkyCoord(obstime.sidereal_time('apparent'), mlo.latitude)

    moon_alt = moon.transform_to(AltAz(obstime=obstime, location=mlo)).alt.to(u.deg)
    if moon_alt < 0*u.degree:
        print('Moon is down')
        return True
    else:
        sep = target.separation(moon)
        print('Moon is up. Separation = {:.1f} deg'.format(sep.to(u.degree).value))
        return (sep > avoid)
开发者ID:joshwalawender,项目名称:VYSOStools,代码行数:29,代码来源:check_moon.py

示例5: test_EarthLocation_basic

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def test_EarthLocation_basic():
    greenwichel = EarthLocation.of_site('greenwich')
    lon, lat, el = greenwichel.to_geodetic()
    assert_quantity_allclose(lon, Longitude('0:0:0', unit=u.deg),
                             atol=10*u.arcsec)
    assert_quantity_allclose(lat, Latitude('51:28:40', unit=u.deg),
                             atol=1*u.arcsec)
    assert_quantity_allclose(el, 46*u.m, atol=1*u.m)

    names = EarthLocation.get_site_names()
    assert 'greenwich' in names
    assert 'example_site' in names

    with pytest.raises(KeyError) as exc:
        EarthLocation.of_site('nonexistent site')
    assert exc.value.args[0] == "Site 'nonexistent site' not in database. Use EarthLocation.get_site_names to see available sites."
开发者ID:Cadair,项目名称:astropy,代码行数:18,代码来源:test_sites.py

示例6: MMT_barycentric_correction

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def MMT_barycentric_correction(sp, header_MMT) :  # Applying barycentric correction to wavelengths
    thistime =  Time('2014-05-05T09:21:00', format='isot', scale='utc')
    thisradec = SkyCoord("17:23:37.23", "+34:11:59.07", unit=(u.hourangle, u.deg), frame='icrs')
    mmt= EarthLocation.of_site('mmt') # Needs internet connection 
    barycor_vel = jrr.barycen.compute_barycentric_correction(thistime, thisradec, location=mmt)
    header_MMT += ("# The barycentric correction factor for s1723 was" + str(barycor_vel))
    jrr.barycen.apply_barycentric_correction(sp, barycor_vel, colwav='oldwave', colwavnew='wave') 
    return(0)
开发者ID:janerigby,项目名称:JRR_Code,代码行数:10,代码来源:S1723_working.py

示例7: main

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def main():

    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--ra', type=float, default=25.0,
        help='Right Ascension (degrees)')
    parser.add_argument('--dec', type=float, default=12.0,
        help='Declination (degrees)')
    parser.add_argument('--mjd', type=float, default=55000.0,
        help='Modified Julien Date (days)')
    parser.add_argument('--scan-offset', type=float, default=15.0,
        help='Scan offset (hours)')
    parser.add_argument('--scan-width', type=float, default=4.0,
        help='Scan width (hours)')
    parser.add_argument('--scan-steps', type=int, default=100,
        help='Number of sampling points')
    parser.add_argument('--astropy-apo', action='store_true',
        help='User apo observatory from astropy')
    args = parser.parse_args()

    if args.astropy_apo:
        sdss = EarthLocation.of_site('apo')
    else:
        sdss = EarthLocation(lat=32.7797556*u.deg, lon=-(105+49./60.+13/3600.)*u.deg, height=2797*u.m)

    coord = SkyCoord(ra=args.ra*u.degree, dec=args.dec*u.degree, frame='icrs')

    # scan of time
    hours = args.scan_offset + np.linspace(-0.5*args.scan_width, 0.5*args.scan_width, args.scan_steps)
    my_alt = np.zeros((hours.size))
    py_alt = np.zeros((hours.size))
    py_ha = np.zeros((hours.size))

    for i in range(hours.size):
        mjd_value = args.mjd*u.day + hours[i]*u.hour
        time = Time(val=mjd_value, scale='tai', format='mjd', location=sdss)
        # altitude from astropy
        py_alt[i] = coord.transform_to(AltAz(obstime=time, location=sdss)).alt.to(u.deg).value
        # this is supposed to be the hour angle from astropy
        py_ha[i] = time.sidereal_time('apparent').to(u.deg).value - args.ra 
        # simple rotation to get alt,az based on ha
        my_alt[i], az = hadec2altaz(py_ha[i], args.dec, sdss.latitude.to(u.deg).value) 
        print hours[i], py_ha[i], py_alt[i], my_alt[i]

    py_ha = np.array(map(normalize_angle, py_ha.tolist()))
    ii = np.argsort(py_ha)
    py_ha=py_ha[ii]
    py_alt=py_alt[ii]
    my_alt=my_alt[ii]

    fig = plt.figure(figsize=(8,6))
    plt.plot(py_ha, py_alt - my_alt, 'o', c='b')
    plt.title('Compare hadec2altaz')
    # plt.title('(ra,dec) = (%.2f,%.2f)' % (args.ra, args.dec))
    plt.xlabel('Hour Angle [deg]')
    plt.ylabel('astropy_alt - rotation_alt [deg]')
    plt.grid(True)
    plt.show()
开发者ID:dmargala,项目名称:tpcorr,代码行数:59,代码来源:test_coords.py

示例8: __init__

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
    def __init__(self, date=None, site='sutherland', targets=None, tz=2*u.h, **options): #res
        
        self.sitename = site.title()
        self.siteloc = EarthLocation.of_site(self.sitename)
        #TODO from time import timezone
        self.tz = tz                         #can you get this from the site location??
        #obs = Observer(self.siteloc)
        self.targets = {}
        self.trajectories = {}
        self.plots = OrderedDict()
        
        if not date:
            now = datetime.now()        #current local time
            #default behaviour of this function changes depending on the time of day.
            #if calling during early morning hours (at telescope) - let midnight refer to previous midnight
            #if calling during afternoon hours - let midnight refer to coming midnight
            d = now.day# + (now.hour > 7)    #FIXME =32??
            date = datetime(now.year, now.month, d, 0, 0, 0)
        else:
            raise NotImplementedError
        self.date = date
        
        self.midnight = midnight = Time(date) - tz    #midnight UTC in local time
        #TODO: efficiency here.  Dont need to plot everything over 
        self.hours = h = np.linspace(-12, 12, 250) * u.h      #variable time 
        self.t = t = midnight + h
        self.tp = t.plot_date
        self.frames = AltAz(obstime=t, location=self.siteloc)
        #self.tmoon
        
        #collect name, coordinates in dict

        if not targets is None:
            self.add_coordinates(targets)
        
        #Get sun, moon coordinates
        sun = get_sun(t)
        self.sun = sun.transform_to(self.frames)    #WARNING: slow!!!!
        #TODO: other bright stars / planets
        
        #get dawn / dusk times
        self.dusk, self.dawn = self.get_daylight()
        self.sunset, self.sunrise = self.dusk['sunset'], self.dawn['sunrise']
        
        #get moon rise/set times, phase, illumination etc...
        self.moon = get_moon(t).transform_to(self.frames)
        self.mooning = self.get_moonlight()
        self.moon_phase, self.moon_ill  = self.get_moon_phase()
        
        self.setup_figure()
        #HACK
        self.cid = self.figure.canvas.mpl_connect('draw_event', self._on_first_draw)
开发者ID:apodemus,项目名称:obstools,代码行数:54,代码来源:viz.py

示例9: get_the_spectra

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def get_the_spectra(filenames, obslog, colwave='obswave') :
    df = {}
    for thisfile in filenames :
        print("loading file ", thisfile)
        df[thisfile] = pandas.read_table(thisfile, delim_whitespace=True, comment="#")
        # Apply the Barycentric correction
        thisobs = obslog.loc[thisfile]
        keck = EarthLocation.of_site('keck')
        my_target = SkyCoord(thisobs['RA'], thisobs['DEC'], unit=(units.hourangle, units.deg), frame='icrs')
        my_start_time = Time( thisobs['DATE-OBS'] + "T" + thisobs['UT_START'] , format='isot', scale='utc')
        midpt = TimeDelta(thisobs['EXPTIME'] / 2.0, format='sec')
        my_time = my_start_time + midpt  # time at middle of observation
        barycor_vel = jrr.barycen.compute_barycentric_correction(my_time, my_target, location=keck)
        #print "DEBUGGING", my_target, thisobs, my_target, my_start_time
        print("FYI, the barycentric correction factor for", thisfile,  "was", barycor_vel)
        jrr.barycen.apply_barycentric_correction(df[thisfile], barycor_vel, colwav='obswave', colwavnew='wave') #   
        df[thisfile]['Nfiles'] = 1 # N of exposures that went into this spectrum
    return(df)  # return a dictionary of dataframes of spectra
开发者ID:janerigby,项目名称:JRR_Code,代码行数:20,代码来源:esi_stack_spectra.py

示例10: getMonths

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def getMonths(ra, dec):
    from astropy import units as u
    from astropy.time import Time
    from astropy.coordinates import SkyCoord, EarthLocation, AltAz, get_sun, FK5
    from datetime import datetime
    fk5 = SkyCoord(ra, dec, frame='fk5')
    # fk5c = SkyCoord(ra, dec, frame='fk5')
    # print fk5c
     # same as SkyCoord.from_name('M33'): use the explicit coordinates to allow building doc plots w/o internet
    kpno = EarthLocation.of_site('kpno')
    utcoffset = -7*u.hour  # Mountain Standard Time

    delta_midnight = np.linspace(-5, 5,11)*u.hour

    months = np.array([1,2,3,4,5,6,7,8,9,10,11,12])
    days = np.array([7, 14, 21, 28])
    monthDict = {1:'Jan', 2:'Feb', 3:'Mar', 4:'Apr', 5:'May', 6:'Jun', 7:'Jul', 8:'Aug', 9:'Sep', 10:'Oct', 11:'Nov', 12:'Dec'}
    monthBool = []
    for m in months:
        upMonth = [False, False, False, False]
        for j,day in enumerate(days):
            t = datetime(2017, m, day, 00, 00, 00)
            midnight = Time(t) - utcoffset
            times = midnight + delta_midnight
            # print times
            altazframe = AltAz(obstime=times, location=kpno)
            # sunaltazs = get_sun(times).transform_to(altazframe)
            fk5altazs = fk5.transform_to(altazframe)
            am = fk5altazs.secz
            # print am
            up = np.where((am < 1.5) & (am > 1.0))
            # print len(up[0])
            if len(up[0]) >= 3:
                upMonth[j] = True
        # print upMonth
        if any(upMonth):
            monthBool.append(True)
        else:
            monthBool.append(False)
    monthBool = np.array(monthBool)
    obsmonths = months[monthBool]
    return obsmonths
开发者ID:bjanesh,项目名称:bjanesh.github.io,代码行数:44,代码来源:generate_pages.py

示例11: test_separation_is_the_same

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def test_separation_is_the_same():
    from ctapipe.coordinates import TelescopeFrame

    obstime = Time('2013-11-01T03:00')
    location = EarthLocation.of_site('Roque de los Muchachos')
    horizon_frame = AltAz(location=location, obstime=obstime)

    crab = SkyCoord(ra='05h34m31.94s', dec='22d00m52.2s')
    ceta_tauri = SkyCoord(ra='5h37m38.6854231s', dec='21d08m33.158804s')

    # simulate crab "on" observations
    telescope_pointing = crab.transform_to(horizon_frame)

    telescope_frame = TelescopeFrame(
        telescope_pointing=telescope_pointing,
        location=location,
        obstime=obstime,
    )

    ceta_tauri_telescope = ceta_tauri.transform_to(telescope_frame)
    crab_telescope = crab.transform_to(telescope_frame)

    sep = ceta_tauri_telescope.separation(crab_telescope).to_value(u.deg)
    assert ceta_tauri.separation(crab).to_value(u.deg) == approx(sep, rel=1e-4)
开发者ID:dipierr,项目名称:ctapipe,代码行数:26,代码来源:test_coordinates.py

示例12: plot_moon

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def plot_moon(ra, dec, year, months, outfile='plot_moon.png'):
    """
    This will plot distance/illumination of moon
    for one specified month
    """
    # Setup local time.
    utc_offset = 10 * u.hour   # Hawaii Standard Time
        
    month_labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

    # Observatory (for symbol)
    keck_loc = EarthLocation.of_site('keck')
    keck = ephem.Observer()
    keck.long = keck_loc.longitude.value
    keck.lat = keck_loc.latitude.value
    
    # Setup Object
    obj = ephem.FixedBody()
    obj._ra = ephem.hours(ra)
    obj._dec = ephem.degrees(dec)
    obj._epoch = 2000
    obj.compute()
    
    month_labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

    # Labels and colors for different months.
    labels = []
    label_fmt = '{0:s} {1:d}'
    for ii in range(len(months)):
        label = label_fmt.format(month_labels[months[ii]-1], year)
        labels.append(label)

    sym = ['rD', 'bD', 'gD', 'cD', 'mD', 'yD']
    colors = ['r', 'b', 'g', 'c', 'm', 'y']

    daysInMonth = np.arange(1, 31)

    moondist = np.zeros(len(daysInMonth), dtype=float)
    moonillum = np.zeros(len(daysInMonth), dtype=float)

    moon = ephem.Moon()

    py.close(3)
    py.figure(3, figsize=(7, 7))
    py.clf()
    py.subplots_adjust(left=0.1)

    for mm in range(len(months)):
        for dd in range(len(daysInMonth)):
            # Set the date and time to midnight
            keck.date = '%d/%d/%d %d' % (year, months[mm],
                                         daysInMonth[dd],
                                         utc_offset.value)

            moon.compute(keck)
            obj.compute(keck)
            sep = ephem.separation((obj.ra, obj.dec), (moon.ra, moon.dec))
            sep *= 180.0 / math.pi

            moondist[dd] = sep
            moonillum[dd] = moon.phase

            print( 'Day: %2d   Moon Illum: %4.1f   Moon Dist: %4.1f' % \
                  (daysInMonth[dd], moonillum[dd], moondist[dd]))

        py.plot(daysInMonth, moondist, sym[mm],label=labels[mm])

        for dd in range(len(daysInMonth)):
            py.text(daysInMonth[dd] + 0.45, moondist[dd]-2, '%2d' % moonillum[dd], 
                    color=colors[mm])

    py.plot([0,31], [30,30], 'k')
    py.legend(loc=2, numpoints=1)
    py.title('Moon distance and %% Illumination (RA = %s, DEC = %s)' % (ra, dec), fontsize=14)
    py.xlabel('Day of Month (UT)', fontsize = 16)
    py.ylabel('Moon Distance (degrees)', fontsize = 16)
    py.axis([0, 31, 0, 200])

    py.savefig(outfile)
开发者ID:jluastro,项目名称:JLU-python-code,代码行数:83,代码来源:skycalc.py

示例13: main

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def main():

    ##-------------------------------------------------------------------------
    ## Parse Command Line Arguments
    ##-------------------------------------------------------------------------
    ## create a parser object for understanding command-line arguments
    parser = argparse.ArgumentParser(
             description="Program description.")
    ## add flags
    ## add arguments
    parser.add_argument("-y", "--year",
        type=int, dest="year",
        default=-1,
        help="The calendar year to analyze")
    parser.add_argument("-s", "--site",
        type=str, dest="site",
        default='Keck Observatory',
        help="Site name to use")
    parser.add_argument("-z", "--timezone",
        type=str, dest="timezone",
        default='US/Hawaii',
        help='pytz timezone name')
    parser.add_argument("-d", "--dark_time",
        type=float, dest="dark_time",
        default=2,
        help='Minimum dark time required (hours)')
    parser.add_argument("-w", "--wait_time",
        type=float, dest="wait_time",
        default=2.5,
        help='Maximum time after dusk to wait for moon set (hours)')

    args = parser.parse_args()

    if args.year == -1:
        args.year = dt.now().year

    ##-------------------------------------------------------------------------
    ## 
    ##-------------------------------------------------------------------------
    loc = EarthLocation.of_site(args.site)
    obs = Observer.at_site(args.site)
    utc = pytz.timezone('UTC')
    localtz = pytz.timezone(args.timezone)
#     hour = tdelta(seconds=60.*60.*1.)

#     pyephem_site = ephem.Observer()
#     pyephem_site.lat = str(loc.lat.to(u.degree).value)
#     pyephem_site.lon = str(loc.lon.to(u.deg).value)
#     pyephem_site.elevation = loc.height.to(u.m).value
#     pyephem_moon = ephem.Moon()

    oneday = TimeDelta(60.*60.*24., format='sec')
    date_iso_string = '{:4d}-01-01T00:00:00'.format(args.year)
    start_date = Time(date_iso_string, format='isot', scale='utc', location=loc)
    sunset = obs.sun_set_time(start_date, which='next')

    ical_file = 'DarkMoonCalendar_{:4d}.ics'.format(args.year)
    if os.path.exists(ical_file): os.remove(ical_file)
    with open(ical_file, 'w') as FO:
        FO.write('BEGIN:VCALENDAR\n'.format())
        FO.write('PRODID:-//hacksw/handcal//NONSGML v1.0//EN\n'.format())

        while sunset < start_date + 365*oneday:
            search_around = sunset + oneday
            sunset = analyze_day(search_around, obs, FO, localtz, args,
                                 verbose=True)
        FO.write('END:VCALENDAR\n')
开发者ID:joshwalawender,项目名称:DarkMoonCalendar,代码行数:69,代码来源:observing_calendar.py

示例14: print

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
    if os.path.exists(bis_g2_path):
        with fits.open(bis_g2_path) as image:
            for h in cal_header_keys:
                harps_results[trim_eso_header(h)][i] = image[0].header.get(h, np.nan)
                print(h, image[0].header.get(h, np.nan))

    else:
        logger.warning(f"Could not find calibration file ({bis_g2_path}) for {dataset_identifier}")


# Step 6: Add an astropy-calculated barycentric velocity correction to each
#         header.

logger.info("Calculating barycentric velocity corrections")

observatory = EarthLocation.of_site("lasilla")
gaia_coord = SkyCoord(ra=gaia_result["ra"] * u.degree,
                      dec=gaia_result["dec"] * u.degree,
                      pm_ra_cosdec=gaia_result["pmra"] * u.mas/u.yr,
                      pm_dec=gaia_result["pmdec"] * u.mas/u.yr,
                      obstime=Time(2015.5, format="decimalyear"),
                      frame="icrs")

def apply_space_motion(coord, time):
    return SkyCoord(ra=coord.ra + coord.pm_ra_cosdec/np.cos(coord.dec.radian) * (time - coord.obstime),
                    dec=coord.dec + coord.pm_dec * (time - coord.obstime),
                    obstime=time, frame="icrs")


berv_key = "ASTROPY BERV"
harps_results[berv_key] = np.nan * np.ones(len(harps_results))
开发者ID:andycasey,项目名称:bedell-tours-eso,代码行数:33,代码来源:query_object.py

示例15: demo_site_chooser

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import of_site [as 别名]
def demo_site_chooser() :
    EarthLocation.get_site_names()  # Print names of all sites astropy knows about. May need internet connection
    keck = EarthLocation.of_site('keck')  
    lco  = EarthLocation.of_site('Las Campanas Observatory') 
    return(0)
开发者ID:janerigby,项目名称:jrr,代码行数:7,代码来源:barycen.py


注:本文中的astropy.coordinates.EarthLocation.of_site方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。