Beispiel #1
0
def main():
    site = sites.load(args.site)
    if args.date is None:
        date = datetime.date.today()
    else:
        date = args.date
    
    run(site, args.sources, args.start_utc, args.end_utc, date,
        show_extra_panels=args.extra_info)
Beispiel #2
0
def main():
    site = sites.load(args.site)
   
    if (args.utc is not None):
        args.lst = site.utc_to_lst(args.utc, args.date)

    if (args.lst is not None) and (args.date is None):
        # A fixed LST is used, but no date is provided.
        # Fix date to today's date.
        args.date = datetime.date.today()

    modes.run(args.modename, site, args.lst, args.date, args.targets, \
                args.testsources, args.calibrators, args)
Beispiel #3
0
def main():
    site = sites.load(args.site)
    if args.lst is None:
        lst = site.lstnow()
    else:
        lst = args.lst
        
    alt_deg, az_deg = args.coords
    ra_deg, decl_deg = site.get_skyposn(alt_deg, az_deg, lst=lst)

    lst_hms = utils.deg_to_hmsstr(lst*15)[0]
    print "%s oriented at (alt=%g deg, az=%g deg) at LST=%s is pointed towards" \
            "\n    RA=%s\n    Dec=%s" % (site.name, alt_deg, az_deg, lst_hms, \
                    utils.deg_to_hmsstr(ra_deg)[0], utils.deg_to_dmsstr(decl_deg)[0])
Beispiel #4
0
def main():
    site = sites.load(args.site)
    if args.date is None:
        date = datetime.date.today()
    else:
        date = args.date

    print "Converting LST to UTC for %s on %s" % \
                (site.name, date.strftime("%b %d, %Y"))

    for lst in args.lst:
        lst_hours = utils.parse_timestr(lst)
        lst_hms = utils.deg_to_hmsstr(lst_hours*15)

        utc_hours = site.lst_to_utc(lst_hours, date)
        utc_hms = utils.deg_to_hmsstr(utc_hours*15)
        print "    LST: %s = UTC: %s" % (lst_hms[0], utc_hms[0])
Beispiel #5
0
def main():
    site = sites.load(args.site)
    if args.date is None:
        date = datetime.date.today()
    else:
        date = args.date

    print "Converting UTC to LST for %s on %s" % \
                (site.name, date.strftime("%b %d, %Y"))

    for utc in args.utc:
        utc_hours = utils.parse_timestr(utc)
        utc_hms = utils.deg_to_hmsstr(utc_hours*15)

        lst_hours = site.utc_to_lst(utc_hours, date)
        lst_hms = utils.deg_to_hmsstr(lst_hours*15)
        print "    UTC: %s = LST: %s" % (utc_hms[0], lst_hms[0])
Beispiel #6
0
def get_riseset_info(site, src, utc=None, lst=None, date=None):
    """Convenience function to get rise/set info for a site/source.

        Inputs:
            site: The observing site to get info for.
            src: The source to generate info for.
            utc: The UTC to get info for. (Default: now)
            lst: The LST to get info for. (Default: now)
            date: The date to get info for. (Default: now)

        Outputs:
            riseset_info: A dictionary of rise/set info.
    """
    if (utc is not None) and (lst is not None):
        raise ValueError("Only one of 'utc' and 'lst' can be provided.")
    if not isinstance(site, sites.base.BaseSite):
        site = sites.load(site)
    if not isinstance(src, sources.Source):
        src = sources.Source.from_string(src)
    if utc is not None:
        lst = site.utc_to_lst(utc, date)
    if (lst is not None) and (date is None):
        # A fixed LST is used, but no date is provided.
        # Fix date to today's date.
        date = datetime.date.today()
    if (lst is None) and (date is None):
        date = datetime.date.today()
        lst = site.lstnow()
    if (lst is None) and (date is not None):
        # Want current LST for a specified date. This doesn't make sense.
        raise ValueError("Incompatible inputs: 'lst' is None, but 'date' is not None!")
    rs_info = {'msg':"", 'circumpolar':False, 'neverrises':False}
    ra_deg, dec_deg = src.get_posn(lst, date)
    rs_info['ra_deg'] = ra_deg
    rs_info['dec_deg'] = dec_deg
    rs_info['ra_hmsstr'] = utils.deg_to_hmsstr(ra_deg, 2)[0]
    rs_info['dec_dmsstr'] = utils.deg_to_dmsstr(dec_deg, 2)[0]
    alt, az = src.get_altaz(site, lst, date)
    rs_info['alt_deg'] = alt[0]
    rs_info['az_deg'] = az[0]
    try:
        risetime, settime = src.get_rise_set_times(site, date)
    except errors.SourceIsCircumpolar:
        rs_info['msg'] = "Source is circumpolar."
        rs_info['circumpolar'] = True
        rs_info['is_visible'] = True
        rs_info['next_riseset'] = None
    except errors.SourceNeverRises:
        rs_info['msg'] = "Source never rises."
        rs_info['neverrises'] = True
        rs_info['is_visible'] = False
        rs_info['next_riseset'] = None
    except errors.MultipleRiseSets:
        rs_info['msg'] = "Multiple rise/set times?!"
    except:
        # Any other error
        raise
    else:
        if src.is_visible(site, lst, date):
            rs_info['is_visible'] = True
            rs_info['next_riseset'] = \
                    utils.deg_to_hmsstr(((settime-lst)%24)*15)[0]
        else:
            rs_info['is_visible'] = False
            rs_info['next_riseset'] = \
                        utils.deg_to_hmsstr(((risetime-lst)%24)*15)[0]
        rs_info['uptime'] = \
                    utils.deg_to_hmsstr(((settime-risetime)%24)*15)[0]
        rs_info['rise_lst'] = \
                    utils.deg_to_hmsstr((risetime%24)*15)[0]
        rs_info['rise_utc'] = \
                    utils.deg_to_hmsstr((site.lst_to_utc(risetime, \
                                date)%24)*15)[0]
        rs_info['set_lst'] = \
                    utils.deg_to_hmsstr((settime%24)*15)[0]
        rs_info['set_utc'] = \
                    utils.deg_to_hmsstr((site.lst_to_utc(settime, \
                                date)%24)*15)[0]
    return rs_info