Beispiel #1
0
    def cmpfunc(cstdout, c, e, i):
        from warnings import warn

        ldats = [
            l[(l.index(':') + 2):].strip() for l in cstdout.split('\n')
            if l.strip() != ''
        ]
        racs, deccs = (ldats[0].split()[0])[3:], (ldats[0].split()[1])[4:]
        raes, deces = (ldats[1].split()[0])[3:], (ldats[1].split()[1])[4:]
        ilat, ilong = (ldats[2].split()[0])[4:], (ldats[2].split()[1])[5:]

        drac = coords.AngularCoordinate(racs).d - c.ra.d
        ddecc = coords.AngularCoordinate(deccs).d - c.dec.d
        drae = coords.AngularCoordinate(raes).d - e.ra.d
        ddece = coords.AngularCoordinate(deces).d - e.dec.d
        dlat = float(ilat) - i.lat.d
        dlong = float(ilong) - i.long.d

        for s in ('drac', 'ddecc', 'drae', 'ddece', 'dlat', 'dlong'):
            val = locals()[s]
            if abs(val) > 5e-8:
                warn('%s too large:%g !!!' % (s, val))
Beispiel #2
0
def meade_lx200_cmd_St_set_latitude(value):
    """For the :StsDD*MM# command, Sets the current site latitdue to sDD*MM

    Returns: 0 - Invalid, 1 - Valid
    """
    #Expect this to be followed by an Sg command to set the longitude...
    global local_site, config
    try:
        value = value.replace("*", "d")
        local_site.latitude = coords.AngularCoordinate(value)
        #That worked, should be safe to save the value to disk later...
        config.set("site", "latitude", value)
        return "1"
    except Exception as err:
        sys.stderr.write("Error with :St%s# latitude: %s\n" % (value, err))
        return "0"
Beispiel #3
0
def meade_lx200_cmd_Sg_set_longitude(value):
    """For the :SgDDD*MM# command, Set current site longitude to DDD*MM

    Returns: 0 - Invalid, 1 - Valid
    """
    #Expected immediately after the set latitude command
    #e.g. :St+56*29# then :Sg003*08'#
    global local_site, config
    try:
        value = value.replace("*", "d")
        local_site.longitude = coords.AngularCoordinate(value)
        sys.stderr.write("Local site now latitude %0.3fd, longitude %0.3fd\n" %
                         (local_site.latitude.d, local_site.longitude.d))
        #That worked, should be safe to save the value to disk:
        config.set("site", "longitude", value)
        save_config()
        return "1"
    except Exception as err:
        sys.stderr.write("Error with :Sg%s# longitude: %s\n" % (value, err))
        return "0"
Beispiel #4
0
config.read("telescope_server.ini")
server_name = config.get("server", "name")  #e.g. 10.0.0.1
server_port = config.getint("server", "port")  #e.g. 4030
#server_name = socket.gethostbyname(socket.gethostname())
#if server_name.startswith("127.0."): #e.g. 127.0.0.1
#    #This works on Linux but not on Mac OS X or Windows:
#    server_name = commands.getoutput("/sbin/ifconfig").split("\n")[1].split()[1][5:]
##server_name = "10.0.0.1" #Override for wifi access
#server_port = 4030 #Default port used by SkySafari

#If default to low precision, SkySafari turns it on anyway:
high_precision = True

#Default to Greenwich, GMT - Latitude 51deg 28' 38'' N, Longitude zero
local_site = obstools.Site(
    coords.AngularCoordinate(config.get("site", "latitude")),
    coords.AngularCoordinate(config.get("site", "longitude")),
    tz=0)
#Rather than messing with the system clock, will store any difference
#between the local computer's date/time and any date/time set by the
#client (which should match any location set by the client).
local_time_offset = 0

#This will probably best be inferred by calibration...
#For Greenwich, magnetic north is estimated to be 2 deg 40 min west
#of grid north at Greenwich in July 2013.
#http://www.geomag.bgs.ac.uk/data_service/models_compass/gma_calc.html
#local_site_magnetic_offset = -2.67 * pi / 180.0

#These will come from sensor information... storing them in radians
local_alt = 85 * pi / 180.0
Beispiel #5
0
config = configparser.ConfigParser()
config.read("telescope_server.ini")
server_name = config.get("server", "name") #e.g. 10.0.0.1
server_port = config.getint("server", "port") #e.g. 4030
#server_name = socket.gethostbyname(socket.gethostname())
#if server_name.startswith("127.0."): #e.g. 127.0.0.1
#    #This works on Linux but not on Mac OS X or Windows:
#    server_name = commands.getoutput("/sbin/ifconfig").split("\n")[1].split()[1][5:]
##server_name = "10.0.0.1" #Override for wifi access
#server_port = 4030 #Default port used by SkySafari

#If default to low precision, SkySafari turns it on anyway:
high_precision = True

#Default to Greenwich, GMT - Latitude 51deg 28' 38'' N, Longitude zero
local_site = obstools.Site(coords.AngularCoordinate(config.get("site", "latitude")),
                           coords.AngularCoordinate(config.get("site", "longitude")),
                           tz=0)
#Rather than messing with the system clock, will store any difference
#between the local computer's date/time and any date/time set by the
#client (which should match any location set by the client).
local_time_offset = 0

#This will probably best be inferred by calibration...
#For Greenwich, magnetic north is estimated to be 2 deg 40 min west
#of grid north at Greenwich in July 2013.
#http://www.geomag.bgs.ac.uk/data_service/models_compass/gma_calc.html
#local_site_magnetic_offset = -2.67 * pi / 180.0

#These will come from sensor information... storing them in radians
local_alt = 85 * pi / 180.0
Beispiel #6
0
# Default Settings:
defaultObservationCmd = "~/PSR_8bit_Scripts/Observe_DE601_C34.py"
defaultOutputPath = os.getcwd() + "/schedule.txt"
defaultAllowIdle = False
defaultIdlePenalty = 2
defaultInitialRetries = 20
defaultTimePenalty = 1
defaultDropPenalty = 500
defaultLocation = 'DE609'
defaultLogPath = os.getcwd()
defaultObserverSetupTime = 2
defaultInputPath = None

# Config:
maxObsDays = 4  # in case no limit is specified
sites = dict(DE609=obstools.Site(lat=coords.AngularCoordinate('53d42m0s'),
                                 long=coords.AngularCoordinate('9d58m50s'),
                                 name="DE609"),
             DE601=obstools.Site(lat=coords.AngularCoordinate('50d31m0s'),
                                 long=coords.AngularCoordinate('6d53m0s'),
                                 name="DE601"),
             DE602=obstools.Site(lat=coords.AngularCoordinate('48d30m4s'),
                                 long=coords.AngularCoordinate('11d17m13s'),
                                 name="DE602"),
             DE603=obstools.Site(lat=coords.AngularCoordinate('50d59m0s'),
                                 long=coords.AngularCoordinate('11d43m0s'),
                                 name="DE603"),
             DE605=obstools.Site(lat=coords.AngularCoordinate('50d55m0s'),
                                 long=coords.AngularCoordinate('6d21m0s'),
                                 name="DE605"),
             SE607=obstools.Site(lat=coords.AngularCoordinate('57d23m54s'),
Beispiel #7
0
def sex_to_degrees(ra,dec):
    ra=coords.AngularCoordinate(ra,sghms=True)
    dec=coords.AngularCoordinate(dec,sghms=False)
    return ra.degrees,dec.degrees